From b3205690eee8560e5c8fa8c417b6cac0ad428096 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Fri, 29 Jan 2021 01:04:41 +0530 Subject: [PATCH] comments added --- .../src/solidity-analyzer/modules/similarVariableNames.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libs/remix-analyzer/src/solidity-analyzer/modules/similarVariableNames.ts b/libs/remix-analyzer/src/solidity-analyzer/modules/similarVariableNames.ts index fea0533ffd..ad6186d421 100644 --- a/libs/remix-analyzer/src/solidity-analyzer/modules/similarVariableNames.ts +++ b/libs/remix-analyzer/src/solidity-analyzer/modules/similarVariableNames.ts @@ -46,10 +46,13 @@ export default class similarVariableNames implements AnalyzerModule { } const vars: string[] = this.getFunctionVariables(contract, func).map(getDeclaredVariableName) this.findSimilarVarNames(vars).map((sim) => { + // check if function is implemented if(func.node.implemented) { const astWalker = new AstWalker() const functionBody: any = func.node.body + // Walk through all statements of function astWalker.walk(functionBody, (node) => { + // check if these is an identifier node which is one of the tracked similar variables if (node.nodeType === "Identifier" && (node.name === sim.var1 || node.name === sim.var2)) { warnings.push({ warning: `${funcName} : Variables have very similar names "${sim.var1}" and "${sim.var2}". ${hasModifiersComments} ${multipleContractsWithSameNameComments}`,