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
662549ce
Commit
662549ce
authored
Dec 23, 2020
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix issue with source location
parent
0bfcb2b8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
20 deletions
+27
-20
internalCallTree.ts
libs/remix-debug/src/solidity-decoder/internalCallTree.ts
+27
-20
No files found.
libs/remix-debug/src/solidity-decoder/internalCallTree.ts
View file @
662549ce
...
@@ -249,32 +249,36 @@ async function includeVariableDeclaration (tree, step, sourceLocation, scopeId,
...
@@ -249,32 +249,36 @@ async function includeVariableDeclaration (tree, step, sourceLocation, scopeId,
const
contractObj
=
await
tree
.
solidityProxy
.
contractObjectAt
(
step
)
const
contractObj
=
await
tree
.
solidityProxy
.
contractObjectAt
(
step
)
let
states
=
null
let
states
=
null
const
generatedSources
=
getGeneratedSources
(
tree
,
scopeId
,
contractObj
)
const
generatedSources
=
getGeneratedSources
(
tree
,
scopeId
,
contractObj
)
const
variableDeclarations
=
resolveVariableDeclaration
(
tree
,
sourceLocation
,
generatedSources
)
const
variableDeclaration
=
resolveVariableDeclaration
(
tree
,
sourceLocation
,
generatedSources
)
// using the vm trace step, the current source location and the ast,
// using the vm trace step, the current source location and the ast,
// we check if the current vm trace step target a new ast node of type VariableDeclaration
// we check if the current vm trace step target a new ast node of type VariableDeclaration
// that way we know that there is a new local variable from here.
// that way we know that there is a new local variable from here.
if
(
variableDeclaration
&&
!
tree
.
scopes
[
scopeId
].
locals
[
variableDeclaration
.
name
])
{
if
(
variableDeclarations
&&
variableDeclarations
.
length
)
{
try
{
for
(
const
variableDeclaration
of
variableDeclarations
)
{
const
stack
=
tree
.
traceManager
.
getStackAt
(
step
)
if
(
variableDeclaration
&&
!
tree
.
scopes
[
scopeId
].
locals
[
variableDeclaration
.
name
])
{
// the stack length at this point is where the value of the new local variable will be stored.
try
{
// so, either this is the direct value, or the offset in memory. That depends on the type.
const
stack
=
tree
.
traceManager
.
getStackAt
(
step
)
if
(
variableDeclaration
.
name
!==
''
)
{
// the stack length at this point is where the value of the new local variable will be stored.
states
=
tree
.
solidityProxy
.
extractStatesDefinitions
()
// so, either this is the direct value, or the offset in memory. That depends on the type.
var
location
=
extractLocationFromAstVariable
(
variableDeclaration
)
if
(
variableDeclaration
.
name
!==
''
)
{
location
=
location
===
'default'
?
'storage'
:
location
states
=
tree
.
solidityProxy
.
extractStatesDefinitions
()
// we push the new local variable in our tree
var
location
=
extractLocationFromAstVariable
(
variableDeclaration
)
tree
.
scopes
[
scopeId
].
locals
[
variableDeclaration
.
name
]
=
{
location
=
location
===
'default'
?
'storage'
:
location
name
:
variableDeclaration
.
name
,
// we push the new local variable in our tree
type
:
parseType
(
variableDeclaration
.
typeDescriptions
.
typeString
,
states
,
contractObj
.
name
,
location
),
tree
.
scopes
[
scopeId
].
locals
[
variableDeclaration
.
name
]
=
{
stackDepth
:
stack
.
length
,
name
:
variableDeclaration
.
name
,
sourceLocation
:
sourceLocation
type
:
parseType
(
variableDeclaration
.
typeDescriptions
.
typeString
,
states
,
contractObj
.
name
,
location
),
stackDepth
:
stack
.
length
,
sourceLocation
:
sourceLocation
}
}
}
catch
(
error
)
{
console
.
log
(
error
)
}
}
}
}
}
catch
(
error
)
{
console
.
log
(
error
)
}
}
}
}
// we check here if we are at the beginning inside a new function.
// we check here if we are at the beginning inside a new function.
// if that is the case, we have to add to locals tree the inputs and output params
// if that is the case, we have to add to locals tree the inputs and output params
const
functionDefinition
=
resolveFunctionDefinition
(
tree
,
previousSourceLocation
,
generatedSources
)
const
functionDefinition
=
resolveFunctionDefinition
(
tree
,
previousSourceLocation
,
generatedSources
)
...
@@ -351,7 +355,10 @@ function extractVariableDeclarations (ast, astWalker) {
...
@@ -351,7 +355,10 @@ function extractVariableDeclarations (ast, astWalker) {
const
ret
=
{}
const
ret
=
{}
astWalker
.
walkFull
(
ast
,
(
node
)
=>
{
astWalker
.
walkFull
(
ast
,
(
node
)
=>
{
if
(
node
.
nodeType
===
'VariableDeclaration'
||
node
.
nodeType
===
'YulVariableDeclaration'
)
{
if
(
node
.
nodeType
===
'VariableDeclaration'
||
node
.
nodeType
===
'YulVariableDeclaration'
)
{
ret
[
node
.
src
]
=
node
ret
[
node
.
src
]
=
[
node
]
}
if
(
node
.
nodeType
===
'VariableDeclarationStatement'
||
node
.
nodeType
===
'YulVariableDeclarationStatement'
)
{
ret
[
node
.
initialValue
.
src
]
=
node
.
declarations
}
}
})
})
return
ret
return
ret
...
...
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