Commit 393c5215 authored by soad003's avatar soad003

Static Analysis: Naming as suggested by axic

parent fd402799
...@@ -8,7 +8,7 @@ function assignAndCompare () { ...@@ -8,7 +8,7 @@ function assignAndCompare () {
} }
assignAndCompare.prototype.visit = function (node) { assignAndCompare.prototype.visit = function (node) {
if (common.isBlockWithTopLevelUnAssignedBinOp(node)) common.getUnAssignedTopLevelBinOps(node).forEach((n) => this.warningNodes.push(n)) if (common.isSubScopeWithTopLevelUnAssignedBinOp(node)) common.getUnAssignedTopLevelBinOps(node).forEach((n) => this.warningNodes.push(n))
} }
assignAndCompare.prototype.report = function (compilationResults) { assignAndCompare.prototype.report = function (compilationResults) {
......
...@@ -386,8 +386,8 @@ function getFullQuallyfiedFuncDefinitionIdent (contract, func, paramTypes) { ...@@ -386,8 +386,8 @@ function getFullQuallyfiedFuncDefinitionIdent (contract, func, paramTypes) {
return getContractName(contract) + '.' + getFunctionDefinitionName(func) + '(' + util.concatWithSeperator(paramTypes, ',') + ')' return getContractName(contract) + '.' + getFunctionDefinitionName(func) + '(' + util.concatWithSeperator(paramTypes, ',') + ')'
} }
function getUnAssignedTopLevelBinOps (blocklike) { function getUnAssignedTopLevelBinOps (subScope) {
return blocklike.children.filter(isBinaryOpInExpression) return subScope.children.filter(isBinaryOpInExpression)
} }
// #################### Trivial Node Identification // #################### Trivial Node Identification
...@@ -616,16 +616,16 @@ function isConstructor (node) { ...@@ -616,16 +616,16 @@ function isConstructor (node) {
} }
/** /**
* True if is block has top level binops (e.g. that are not assigned to anything, most of the time confused compare instead of assign) * True if is block / SubScope has top level binops (e.g. that are not assigned to anything, most of the time confused compare instead of assign)
* @node {ASTNode} some AstNode * @node {ASTNode} some AstNode
* @return {bool} * @return {bool}
*/ */
function isBlockWithTopLevelUnAssignedBinOp (node) { function isSubScopeWithTopLevelUnAssignedBinOp (node) {
return nodeType(node, exactMatch(nodeTypes.BLOCK)) && node.children && node.children.some(isBinaryOpInExpression) || return nodeType(node, exactMatch(nodeTypes.BLOCK)) && node.children && node.children.some(isBinaryOpInExpression) ||
isBlockLikeStatement(node) && node.children && node.children.some(isBinaryOpInExpression) // Second Case for if without braces isSubScopeStatement(node) && node.children && node.children.some(isBinaryOpInExpression) // Second Case for if without braces
} }
function isBlockLikeStatement (node) { function isSubScopeStatement (node) {
return (nodeType(node, exactMatch(nodeTypes.IFSTATEMENT)) || return (nodeType(node, exactMatch(nodeTypes.IFSTATEMENT)) ||
nodeType(node, exactMatch(nodeTypes.FORSTATEMENT)) || nodeType(node, exactMatch(nodeTypes.FORSTATEMENT)) ||
nodeType(node, exactMatch(nodeTypes.WHILESTATEMENT)) || nodeType(node, exactMatch(nodeTypes.WHILESTATEMENT)) ||
...@@ -952,7 +952,7 @@ module.exports = { ...@@ -952,7 +952,7 @@ module.exports = {
isAbiNamespaceCall: isAbiNamespaceCall, isAbiNamespaceCall: isAbiNamespaceCall,
isSpecialVariableAccess: isSpecialVariableAccess, isSpecialVariableAccess: isSpecialVariableAccess,
isDynamicArrayAccess: isDynamicArrayAccess, isDynamicArrayAccess: isDynamicArrayAccess,
isBlockWithTopLevelUnAssignedBinOp: isBlockWithTopLevelUnAssignedBinOp, isSubScopeWithTopLevelUnAssignedBinOp: isSubScopeWithTopLevelUnAssignedBinOp,
hasFunctionBody: hasFunctionBody, hasFunctionBody: hasFunctionBody,
isInteraction: isInteraction, isInteraction: isInteraction,
isEffect: isEffect, isEffect: isEffect,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment