trim the fat on the tokens caches
This commit is contained in:
parent
3374374af0
commit
a03eac8cd9
@ -1,3 +1,6 @@
|
|||||||
|
import FunctionTokenProcessor;
|
||||||
|
import ConstantTokenProcessor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
CodeParser parses a block of PHP code and returns information on the
|
CodeParser parses a block of PHP code and returns information on the
|
||||||
tokens it finds.
|
tokens it finds.
|
||||||
|
@ -24,7 +24,6 @@ class TestFunctionTokenProcessor extends haxe.unit.TestCase {
|
|||||||
var unwound_tokens = token_processor.unwind_tokens();
|
var unwound_tokens = token_processor.unwind_tokens();
|
||||||
|
|
||||||
assertTrue(unwound_tokens.toString().length < target_token_hash.length);
|
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 = new FunctionTokenProcessor();
|
||||||
token_processor.populate_from_unwound_tokens(unwound_tokens);
|
token_processor.populate_from_unwound_tokens(unwound_tokens);
|
||||||
|
@ -9,7 +9,7 @@ class TokenProcessor {
|
|||||||
#if neko
|
#if neko
|
||||||
public function load_from_cache() : Bool {
|
public function load_from_cache() : Bool {
|
||||||
if (neko.FileSystem.exists(this.get_cache_path())) {
|
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;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@ -18,7 +18,7 @@ class TokenProcessor {
|
|||||||
|
|
||||||
public function save_to_cache() {
|
public function save_to_cache() {
|
||||||
var fh = neko.io.File.write(this.get_cache_path(), true);
|
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();
|
fh.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -26,7 +26,7 @@ class TokenProcessor {
|
|||||||
#end
|
#end
|
||||||
|
|
||||||
public function load_from_resource() {
|
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> {
|
public function unwind_tokens() : Hash<String> {
|
||||||
|
Loading…
Reference in New Issue
Block a user