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
0ef31dfb
Commit
0ef31dfb
authored
Apr 06, 2017
by
Michael Fröwis
Committed by
chriseth
May 17, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Static Analysis: use astWalker from ethereum-remix
parent
b8e2db29
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
2 additions
and
58 deletions
+2
-58
astWalker.js
src/app/staticanalysis/astWalker.js
+0
-54
abstractAstView.js
src/app/staticanalysis/modules/abstractAstView.js
+1
-2
staticAnalysisRunner.js
src/app/staticanalysis/staticAnalysisRunner.js
+1
-2
No files found.
src/app/staticanalysis/astWalker.js
deleted
100644 → 0
View file @
b8e2db29
'use strict'
/**
* Crawl the given AST through the function walk(ast, callback)
*/
function
AstWalker
()
{
}
/**
* visit all the AST nodes
*
* @param {Object} ast - AST node
* @param {Object or Function} callback - if (Function) the function will be called for every node.
* - if (Object) callback[<Node Type>] will be called for
* every node of type <Node Type>. callback["*"] will be called fo all other nodes.
* in each case, if the callback returns false it does not descend into children.
* If no callback for the current type, children are visited.
*/
AstWalker
.
prototype
.
walk
=
function
(
ast
,
callback
)
{
if
(
callback
instanceof
Function
)
{
callback
=
{
'*'
:
callback
}
}
if
(
!
(
'*'
in
callback
))
{
callback
[
'*'
]
=
function
()
{
return
true
}
}
if
(
manageCallBack
(
ast
,
callback
)
&&
ast
.
children
&&
ast
.
children
.
length
>
0
)
{
for
(
var
k
in
ast
.
children
)
{
var
child
=
ast
.
children
[
k
]
this
.
walk
(
child
,
callback
)
}
}
}
/**
* walk the given @astList
*
* @param {Object} sourcesList - sources list (containing root AST node)
* @param {Function} - callback used by AstWalker to compute response
*/
AstWalker
.
prototype
.
walkAstList
=
function
(
sourcesList
,
callback
)
{
var
walker
=
new
AstWalker
()
for
(
var
k
in
sourcesList
)
{
walker
.
walk
(
sourcesList
[
k
].
AST
,
callback
)
}
}
function
manageCallBack
(
node
,
callback
)
{
if
(
node
.
name
in
callback
)
{
return
callback
[
node
.
name
](
node
)
}
else
{
return
callback
[
'*'
](
node
)
}
}
module
.
exports
=
AstWalker
src/app/staticanalysis/modules/abstractAstView.js
View file @
0ef31dfb
var
common
=
require
(
'./staticAnalysisCommon'
)
// var AstWalker = require('ethereum-remix').util.AstWalker
var
AstWalker
=
require
(
'../astWalker'
)
var
AstWalker
=
require
(
'ethereum-remix'
).
util
.
AstWalker
function
abstractAstView
()
{
this
.
contracts
=
null
...
...
src/app/staticanalysis/staticAnalysisRunner.js
View file @
0ef31dfb
'use strict'
// var AstWalker = require('ethereum-remix').util.AstWalker
var
AstWalker
=
require
(
'./astWalker'
)
var
AstWalker
=
require
(
'ethereum-remix'
).
util
.
AstWalker
var
list
=
require
(
'./modules/list'
)
function
staticAnalysisRunner
()
{
...
...
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