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
16e299f5
Commit
16e299f5
authored
Feb 02, 2017
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
extract extractSourceLocation
parent
ab541b00
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
20 deletions
+20
-20
internalCallTree.js
src/util/internalCallTree.js
+20
-20
No files found.
src/util/internalCallTree.js
View file @
16e299f5
...
...
@@ -4,7 +4,6 @@ var AstWalker = require('./astWalker')
var
EventManager
=
require
(
'../lib/eventManager'
)
var
decodeInfo
=
require
(
'../solidity/decodeInfo'
)
var
util
=
require
(
'../helpers/util'
)
var
traceHelper
=
require
(
'../helpers/traceHelper'
)
/**
* Tree representing internal jump into function.
...
...
@@ -83,6 +82,25 @@ class InternalCallTree {
}
return
scope
}
extractSourceLocation
(
step
)
{
var
self
=
this
return
new
Promise
(
function
(
resolve
,
reject
)
{
self
.
traceManager
.
getCurrentCalledAddressAt
(
step
,
(
error
,
address
)
=>
{
if
(
!
error
)
{
self
.
sourceLocationTracker
.
getSourceLocationFromVMTraceIndex
(
address
,
step
,
self
.
solidityProxy
.
contracts
,
(
error
,
sourceLocation
)
=>
{
if
(
!
error
)
{
return
resolve
(
sourceLocation
)
}
else
{
return
reject
(
'InternalCallTree - Cannot retrieve sourcelocation for step '
+
step
+
' '
+
error
)
}
})
}
else
{
return
reject
(
'InternalCallTree - Cannot retrieve address for step '
+
step
+
' '
+
error
)
}
})
})
}
}
async
function
buildTree
(
tree
,
step
,
scopeId
)
{
...
...
@@ -93,7 +111,7 @@ async function buildTree (tree, step, scopeId) {
while
(
step
<
tree
.
traceManager
.
trace
.
length
)
{
var
sourceLocation
try
{
sourceLocation
=
await
extractSourceLocation
(
tree
,
step
)
sourceLocation
=
await
tree
.
extractSourceLocation
(
step
)
if
(
sourceLocation
.
start
!==
currentSourceLocation
.
start
||
sourceLocation
.
length
!==
currentSourceLocation
.
length
||
sourceLocation
.
file
!==
currentSourceLocation
.
file
)
{
...
...
@@ -156,24 +174,6 @@ function includeVariableDeclaration (tree, step, sourceLocation, scopeId) {
}
}
function
extractSourceLocation
(
tree
,
step
)
{
return
new
Promise
(
function
(
resolve
,
reject
)
{
tree
.
traceManager
.
getCurrentCalledAddressAt
(
step
,
(
error
,
address
)
=>
{
if
(
!
error
)
{
tree
.
sourceLocationTracker
.
getSourceLocationFromVMTraceIndex
(
address
,
step
,
tree
.
solidityProxy
.
contracts
,
(
error
,
sourceLocation
)
=>
{
if
(
!
error
)
{
return
resolve
(
sourceLocation
)
}
else
{
return
reject
(
'InternalCallTree - Cannot retrieve sourcelocation for step '
+
step
+
' '
+
error
)
}
})
}
else
{
return
reject
(
'InternalCallTree - Cannot retrieve address for step '
+
step
+
' '
+
error
)
}
})
})
}
function
resolveVariableDeclaration
(
tree
,
step
,
sourceLocation
)
{
if
(
!
tree
.
variableDeclarationByFile
[
sourceLocation
.
file
])
{
var
ast
=
tree
.
solidityProxy
.
ast
(
sourceLocation
)
...
...
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