Merge pull request #180 from rsw0x/master

Reference to StringCache outliving scope
This commit is contained in:
Brian Schott 2015-01-01 22:19:23 -08:00
commit c8657bcb91
1 changed files with 1 additions and 1 deletions

View File

@ -164,13 +164,13 @@ struct ModuleCache
return null; return null;
const(Token)[] tokens; const(Token)[] tokens;
auto parseStringCache = StringCache(StringCache.defaultBucketCount);
{ {
ubyte[] source = cast(ubyte[]) Mallocator.it.allocate(fileSize); ubyte[] source = cast(ubyte[]) Mallocator.it.allocate(fileSize);
scope (exit) Mallocator.it.deallocate(source); scope (exit) Mallocator.it.deallocate(source);
f.rawRead(source); f.rawRead(source);
LexerConfig config; LexerConfig config;
config.fileName = cachedLocation; config.fileName = cachedLocation;
auto parseStringCache = StringCache(StringCache.defaultBucketCount);
// The first three bytes are sliced off here if the file starts with a // The first three bytes are sliced off here if the file starts with a
// Unicode byte order mark. The lexer/parser don't handle them. // Unicode byte order mark. The lexer/parser don't handle them.