From 29bb921994dea18a474cdb274851bac19d8c8383 Mon Sep 17 00:00:00 2001 From: David Majda Date: Fri, 29 May 2015 14:27:25 -0700 Subject: [PATCH] Rename |peg$cache| to |peg$resultsCache| This change will make the results cache clearly distinguishable from the position details cache (which I'll add in a minute). --- lib/compiler/passes/generate-javascript.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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')); }