Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
446d9ff5
Commit
446d9ff5
authored
Sep 21, 2017
by
yann300
Committed by
GitHub
Sep 21, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #808 from ethereum/fixRelevantNode
Fix analysis (fn call at contract scope)
parents
ef8592dd
b9fec81c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
1 deletion
+16
-1
abstractAstView.js
src/app/staticanalysis/modules/abstractAstView.js
+16
-1
No files found.
src/app/staticanalysis/modules/abstractAstView.js
View file @
446d9ff5
...
@@ -49,6 +49,7 @@ abstractAstView.prototype.build_visit = function (relevantNodeFilter) {
...
@@ -49,6 +49,7 @@ abstractAstView.prototype.build_visit = function (relevantNodeFilter) {
setCurrentContract
(
that
,
{
setCurrentContract
(
that
,
{
node
:
node
,
node
:
node
,
functions
:
[],
functions
:
[],
relevantNodes
:
[],
modifiers
:
[],
modifiers
:
[],
inheritsFrom
:
[],
inheritsFrom
:
[],
stateVariables
:
common
.
getStateVariableDeclarationsFormContractNode
(
node
)
stateVariables
:
common
.
getStateVariableDeclarationsFormContractNode
(
node
)
...
@@ -65,6 +66,12 @@ abstractAstView.prototype.build_visit = function (relevantNodeFilter) {
...
@@ -65,6 +66,12 @@ abstractAstView.prototype.build_visit = function (relevantNodeFilter) {
localVariables
:
getLocalVariables
(
node
),
localVariables
:
getLocalVariables
(
node
),
parameters
:
getLocalParameters
(
node
)
parameters
:
getLocalParameters
(
node
)
})
})
// push back relevant nodes to their the current fn if any
getCurrentContract
(
that
).
relevantNodes
.
map
((
item
)
=>
{
if
(
item
.
referencedDeclaration
===
node
.
id
)
{
getCurrentFunction
(
that
).
relevantNodes
.
push
(
item
.
node
)
}
})
}
else
if
(
common
.
isModifierDefinition
(
node
))
{
}
else
if
(
common
.
isModifierDefinition
(
node
))
{
setCurrentModifier
(
that
,
{
setCurrentModifier
(
that
,
{
node
:
node
,
node
:
node
,
...
@@ -76,7 +83,15 @@ abstractAstView.prototype.build_visit = function (relevantNodeFilter) {
...
@@ -76,7 +83,15 @@ abstractAstView.prototype.build_visit = function (relevantNodeFilter) {
if
(
!
that
.
isFunctionNotModifier
)
throw
new
Error
(
'abstractAstView.js: Found modifier invocation outside of function scope.'
)
if
(
!
that
.
isFunctionNotModifier
)
throw
new
Error
(
'abstractAstView.js: Found modifier invocation outside of function scope.'
)
getCurrentFunction
(
that
).
modifierInvocations
.
push
(
node
)
getCurrentFunction
(
that
).
modifierInvocations
.
push
(
node
)
}
else
if
(
relevantNodeFilter
(
node
))
{
}
else
if
(
relevantNodeFilter
(
node
))
{
((
that
.
isFunctionNotModifier
)
?
getCurrentFunction
(
that
)
:
getCurrentModifier
(
that
)).
relevantNodes
.
push
(
node
)
var
scope
=
(
that
.
isFunctionNotModifier
)
?
getCurrentFunction
(
that
)
:
getCurrentModifier
(
that
)
if
(
scope
)
{
scope
.
relevantNodes
.
push
(
node
)
}
else
{
scope
=
getCurrentContract
(
that
)
// if we are not in a function scope, add the node to the contract scope
if
(
scope
&&
node
.
children
[
0
]
&&
node
.
children
[
0
].
attributes
&&
node
.
children
[
0
].
attributes
.
referencedDeclaration
)
{
scope
.
relevantNodes
.
push
({
referencedDeclaration
:
node
.
children
[
0
].
attributes
.
referencedDeclaration
,
node
:
node
})
}
}
}
}
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment