From f58b3bd99b4ba0579a55871fe81f9061f42b3f3d Mon Sep 17 00:00:00 2001 From: cgewecke Date: Wed, 14 Dec 2016 15:16:48 -0800 Subject: [PATCH] Switch from solparse to solidity-parser --- instrumentSolidity.js | 13 ++++++++----- package.json | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/instrumentSolidity.js b/instrumentSolidity.js index 506edb7..3afb8a6 100644 --- a/instrumentSolidity.js +++ b/instrumentSolidity.js @@ -1,11 +1,11 @@ -// var SolidityParser = require("solidity-parser"); -var solparse = require("solparse"); +var SolidityParser = require("solidity-parser"); +//var solparse = require("solparse"); var path = require("path"); module.exports = function(contract, fileName, instrumentingActive){ - // var result = SolidityParser.parseFile("./" + pathToFile); - var result = solparse.parse(contract); + var result = SolidityParser.parse(contract); + //var result = solparse.parse(contract); var instrumented = ""; const __INDENTATION__ = " "; var parse = {}; @@ -324,7 +324,10 @@ module.exports = function(contract, fileName, instrumentingActive){ } for (x in expression.body){ - parse[expression.body[x].type](expression.body[x], instrument); + // Ignore top-level variable declarations grouped together in array by solidity-parser + if (!Array.isArray(expression.body[x])){ + parse[expression.body[x].type](expression.body[x], instrument); + } } } diff --git a/package.json b/package.json index ba6eab0..71e5302 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "ethereumjs-testrpc": "^2.2.7", "istanbul": "^0.4.5", "shelljs": "^0.7.4", - "solparse": "^1.0.15" + "solidity-parser": "git+https://github.com/ConsenSys/solidity-parser.git#master" }, "devDependencies": { "mocha": "^3.1.0"