diff --git a/lib/compiler/passes/generate-javascript.js b/lib/compiler/passes/generate-javascript.js index e941806..fb159e7 100644 --- a/lib/compiler/passes/generate-javascript.js +++ b/lib/compiler/passes/generate-javascript.js @@ -56,7 +56,7 @@ function generateJavascript(ast, options) { if (options.cache) { parts.push([ 'var key = peg$currPos * ' + ast.rules.length + ' + ' + ruleIndexCode + ',', - ' cached = peg$cache[key];', + ' cached = peg$resultsCache[key];', '', 'if (cached) {', ' peg$currPos = cached.nextPos;', @@ -99,7 +99,7 @@ function generateJavascript(ast, options) { if (options.cache) { parts.push([ '', - 'peg$cache[key] = { nextPos: peg$currPos, result: ' + resultCode + ' };' + 'peg$resultsCache[key] = { nextPos: peg$currPos, result: ' + resultCode + ' };' ].join('\n')); } @@ -897,7 +897,7 @@ function generateJavascript(ast, options) { if (options.cache) { parts.push([ - ' peg$cache = {},', + ' peg$resultsCache = {},', '' ].join('\n')); }