diff --git a/jout/production/jalangijava/AndFormula.class b/jout/production/jalangijava/AndFormula.class index 40f74b5c..24bd65fa 100644 Binary files a/jout/production/jalangijava/AndFormula.class and b/jout/production/jalangijava/AndFormula.class differ diff --git a/jout/production/jalangijava/FalseFormula.class b/jout/production/jalangijava/FalseFormula.class index 1fbf357b..d748951c 100644 Binary files a/jout/production/jalangijava/FalseFormula.class and b/jout/production/jalangijava/FalseFormula.class differ diff --git a/jout/production/jalangijava/Formula.class b/jout/production/jalangijava/Formula.class index e6bdd21e..da178254 100644 Binary files a/jout/production/jalangijava/Formula.class and b/jout/production/jalangijava/Formula.class differ diff --git a/jout/production/jalangijava/OrFormula.class b/jout/production/jalangijava/OrFormula.class index 4257f82d..2d419c4d 100644 Binary files a/jout/production/jalangijava/OrFormula.class and b/jout/production/jalangijava/OrFormula.class differ diff --git a/jout/production/jalangijava/RegexpEncoder.class b/jout/production/jalangijava/RegexpEncoder.class index 4357c06b..8e88df45 100644 Binary files a/jout/production/jalangijava/RegexpEncoder.class and b/jout/production/jalangijava/RegexpEncoder.class differ diff --git a/jout/production/jalangijava/RelConstant.class b/jout/production/jalangijava/RelConstant.class index e88a62eb..56ed4564 100644 Binary files a/jout/production/jalangijava/RelConstant.class and b/jout/production/jalangijava/RelConstant.class differ diff --git a/jout/production/jalangijava/TrueFormula.class b/jout/production/jalangijava/TrueFormula.class index 2878ee87..a787f822 100644 Binary files a/jout/production/jalangijava/TrueFormula.class and b/jout/production/jalangijava/TrueFormula.class differ diff --git a/src/js/instrument/esnstrument.js b/src/js/instrument/esnstrument.js index ccf278f6..fc00ece1 100644 --- a/src/js/instrument/esnstrument.js +++ b/src/js/instrument/esnstrument.js @@ -1110,6 +1110,52 @@ "ForStatement":funCond }; + var exprDepth = 0; + var visitorIdentifyTopLevelExprPre = { + "CallExpression":function (node) { + if (node.callee.type === 'MemberExpression' && + node.callee.object.type === 'Identifier' && + node.callee.object.name === astUtil.JALANGI_VAR) { + var funName = node.callee.property.name; + if (exprDepth === 0 && + (funName === 'F' || + funName === 'M' || + funName === 'A' || + funName === 'P' || + funName === 'G' || + funName === 'R' || + funName === 'W' || + funName === 'H' || + funName === 'T' || + funName === 'Rt' || + funName === 'B' || + funName === 'U' || + funName === 'C' || + funName === 'C1' || + funName === 'C2' || + funName === '_' + )) { + // to Manu: node.arguments[0].value should be stored in a file + // console.log(node.arguments[0].value); + } + exprDepth++; + } + } + }; + + var visitorIdentifyTopLevelExprPost = { + "CallExpression":function (node) { + if (node.callee.type === 'MemberExpression' && + node.callee.object.type === 'Identifier' && + node.callee.object.name === astUtil.JALANGI_VAR) { + exprDepth--; + } + return node; + } + }; + + + function addScopes(ast) { function Scope(parent) { @@ -1284,7 +1330,7 @@ condCount = 3; } wrapProgramNode = tryCatchAtTop; - var newAst = transformString(code, [visitorRRPost, visitorOps], [visitorRRPre, undefined]); + var newAst = transformString(code, [visitorRRPost, visitorOps, visitorIdentifyTopLevelExprPost], [visitorRRPre, undefined, visitorIdentifyTopLevelExprPre]); var newCode = escodegen.generate(newAst); if (!tryCatchAtTop) { @@ -1341,7 +1387,7 @@ wrapProgramNode = true; instCodeFileName = makeInstCodeFileName(filename); writeLineToIIDMap("orig2Inst[filename] = \"" + sanitizePath(require('path').resolve(process.cwd(), instCodeFileName)) + "\";\n"); - var newAst = transformString(code, [visitorRRPost, visitorOps], [visitorRRPre, undefined]); + var newAst = transformString(code, [visitorRRPost, visitorOps, visitorIdentifyTopLevelExprPost], [visitorRRPre, undefined, visitorIdentifyTopLevelExprPre]); //console.log(JSON.stringify(newAst, null, '\t')); var newFileOnly = path.basename(instCodeFileName);