trim the fat on the tokens caches

This commit is contained in:
John Bintz 2008-10-14 22:19:32 -04:00
parent 3374374af0
commit a03eac8cd9
3 changed files with 6 additions and 4 deletions

View File

@ -1,3 +1,6 @@
import FunctionTokenProcessor;
import ConstantTokenProcessor;
/**
CodeParser parses a block of PHP code and returns information on the
tokens it finds.

View File

@ -24,7 +24,6 @@ class TestFunctionTokenProcessor extends haxe.unit.TestCase {
var unwound_tokens = token_processor.unwind_tokens();
assertTrue(unwound_tokens.toString().length < target_token_hash.length);
trace(unwound_tokens.toString().length + " bytes vs. " + target_token_hash.length);
token_processor = new FunctionTokenProcessor();
token_processor.populate_from_unwound_tokens(unwound_tokens);

View File

@ -9,7 +9,7 @@ class TokenProcessor {
#if neko
public function load_from_cache() : Bool {
if (neko.FileSystem.exists(this.get_cache_path())) {
this.tokenHash = haxe.Unserializer.run(neko.io.File.getContent(this.get_cache_path()));
this.populate_from_unwound_tokens(haxe.Unserializer.run(neko.io.File.getContent(this.get_cache_path())));
return true;
} else {
return false;
@ -18,7 +18,7 @@ class TokenProcessor {
public function save_to_cache() {
var fh = neko.io.File.write(this.get_cache_path(), true);
fh.writeString(haxe.Serializer.run(this.tokenHash));
fh.writeString(haxe.Serializer.run(this.unwind_tokens()));
fh.close();
}
@ -26,7 +26,7 @@ class TokenProcessor {
#end
public function load_from_resource() {
this.tokenHash = haxe.Unserializer.run(haxe.Resource.getString(this.get_cache_path()));
this.populate_from_unwound_tokens(haxe.Unserializer.run(haxe.Resource.getString(this.get_cache_path())));
}
public function unwind_tokens() : Hash<String> {