From 23fb4ee34b29e94934f25b886b89899bee58943c Mon Sep 17 00:00:00 2001 From: Mojtaba Samimi <33888540+archmoj@users.noreply.github.com> Date: Wed, 1 Apr 2020 11:46:36 -0400 Subject: [PATCH] increase counter before calling parse --- index.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index e76e68b..47b0289 100644 --- a/index.js +++ b/index.js @@ -44,12 +44,13 @@ function getArgNames(ast) { } function preprocess(func) { + PREFIX_COUNTER++; + //Compute new prefix + var prefix = "_inline_" + PREFIX_COUNTER + "_" + var src = ["(", func, ")()"].join("") var ast = esprima.parse(src, { range: true }) - //Compute new prefix - var prefix = "_inline_" + (PREFIX_COUNTER++) + "_" - //Parse out arguments var argNames = getArgNames(ast) var compiledArgs = new Array(argNames.length) @@ -192,4 +193,4 @@ function preprocess(func) { return routine } -module.exports = preprocess \ No newline at end of file +module.exports = preprocess