Unverified Commit f762684c authored by yann300's avatar yann300 Committed by GitHub

Merge pull request #1313 from ethereum/fix/#1108

delete from mapping will not show warning
parents a7f577bd ce0a216d
...@@ -8,7 +8,7 @@ function deleteFromDynamicArray () { ...@@ -8,7 +8,7 @@ function deleteFromDynamicArray () {
} }
deleteFromDynamicArray.prototype.visit = function (node) { deleteFromDynamicArray.prototype.visit = function (node) {
if (common.isDeleteFromDynamicArray(node)) this.relevantNodes.push(node) if (common.isDeleteFromDynamicArray(node) && !common.isMappingIndexAccess(node.children[0])) this.relevantNodes.push(node)
} }
deleteFromDynamicArray.prototype.report = function (compilationResults) { deleteFromDynamicArray.prototype.report = function (compilationResults) {
......
...@@ -536,6 +536,15 @@ function isIndexAccess (node) { ...@@ -536,6 +536,15 @@ function isIndexAccess (node) {
} }
/** /**
* True if node is the access of a mapping index
* @node {ASTNode} node to check for
* @return {bool}
*/
function isMappingIndexAccess (node) {
return isIndexAccess(node) && node.children && node.children[0].attributes.type.startsWith('mapping')
}
/**
* True if call to code within the current contracts context including (delegate) library call * True if call to code within the current contracts context including (delegate) library call
* @node {ASTNode} some AstNode * @node {ASTNode} some AstNode
* @return {bool} * @return {bool}
...@@ -1103,6 +1112,7 @@ module.exports = { ...@@ -1103,6 +1112,7 @@ module.exports = {
isSpecialVariableAccess: isSpecialVariableAccess, isSpecialVariableAccess: isSpecialVariableAccess,
isDynamicArrayAccess: isDynamicArrayAccess, isDynamicArrayAccess: isDynamicArrayAccess,
isIndexAccess: isIndexAccess, isIndexAccess: isIndexAccess,
isMappingIndexAccess: isMappingIndexAccess,
isSubScopeWithTopLevelUnAssignedBinOp: isSubScopeWithTopLevelUnAssignedBinOp, isSubScopeWithTopLevelUnAssignedBinOp: isSubScopeWithTopLevelUnAssignedBinOp,
hasFunctionBody: hasFunctionBody, hasFunctionBody: hasFunctionBody,
isInteraction: isInteraction, isInteraction: isInteraction,
......
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