From 03fab0e15d04e2cbb31db47836d4521151348260 Mon Sep 17 00:00:00 2001 From: rsw0x Date: Fri, 2 Jan 2015 00:49:27 -0500 Subject: [PATCH] fixes lifetime issue caused by 19c8468 --- src/modulecache.d | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modulecache.d b/src/modulecache.d index 7df5064..65be38a 100644 --- a/src/modulecache.d +++ b/src/modulecache.d @@ -164,13 +164,13 @@ struct ModuleCache return null; const(Token)[] tokens; - { + auto parseStringCache = StringCache(StringCache.defaultBucketCount); + { ubyte[] source = cast(ubyte[]) Mallocator.it.allocate(fileSize); scope (exit) Mallocator.it.deallocate(source); f.rawRead(source); LexerConfig config; config.fileName = cachedLocation; - auto parseStringCache = StringCache(StringCache.defaultBucketCount); // 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. @@ -178,7 +178,7 @@ struct ModuleCache (source.length >= 3 && source[0 .. 3] == "\xef\xbb\xbf"c) ? source[3 .. $] : source, config, &parseStringCache); - } + } auto semanticAllocator = scoped!(CAllocatorImpl!(BlockAllocator!(1024 * 64))); Module m = parseModuleSimple(tokens[], cachedLocation, semanticAllocator);