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
84dc6846
Commit
84dc6846
authored
Feb 02, 2017
by
yann300
Committed by
GitHub
Feb 02, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #188 from ethereum/hidelocalsiffuncscope
don't display local var if not declared
parents
e6798dea
972397e8
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
15 deletions
+17
-15
localDecoder.js
src/solidity/localDecoder.js
+2
-2
Ethdebugger.js
src/ui/Ethdebugger.js
+8
-0
SolidityLocals.js
src/ui/SolidityLocals.js
+4
-11
internalCallTree.js
src/util/internalCallTree.js
+2
-1
helper.js
test/solidity/localsTests/helper.js
+1
-1
No files found.
src/solidity/localDecoder.js
View file @
84dc6846
'use strict'
function
solidityLocals
(
vmtraceIndex
,
internalTreeCall
,
stack
,
memory
,
storage
)
{
function
solidityLocals
(
vmtraceIndex
,
internalTreeCall
,
stack
,
memory
,
storage
,
currentSourceLocation
)
{
var
scope
=
internalTreeCall
.
findScope
(
vmtraceIndex
)
if
(
!
scope
)
{
var
error
=
{
'message'
:
'Can
\'
t display locals. reason: compilation result might not have been provided'
}
...
...
@@ -11,7 +11,7 @@ function solidityLocals (vmtraceIndex, internalTreeCall, stack, memory, storage)
var
anonymousIncr
=
1
for
(
var
local
in
scope
.
locals
)
{
let
variable
=
scope
.
locals
[
local
]
if
(
variable
.
stackDepth
<
stack
.
length
)
{
if
(
variable
.
stackDepth
<
stack
.
length
&&
variable
.
sourceLocation
.
start
<=
currentSourceLocation
.
start
)
{
var
name
=
variable
.
name
if
(
name
===
''
)
{
name
=
'<'
+
anonymousIncr
+
'>'
...
...
src/ui/Ethdebugger.js
View file @
84dc6846
...
...
@@ -52,6 +52,14 @@ function Ethdebugger () {
self
.
stepChanged
(
stepIndex
)
})
this
.
vmDebugger
=
new
VmDebugger
(
this
,
this
.
traceManager
,
this
.
codeManager
,
this
.
solidityProxy
,
callTree
)
this
.
codeManager
.
event
.
register
(
'changed'
,
this
,
(
code
,
address
,
instIndex
)
=>
{
this
.
callTree
.
sourceLocationTracker
.
getSourceLocationFromVMTraceIndex
(
address
,
this
.
currentStepIndex
,
this
.
solidityProxy
.
contracts
,
(
error
,
sourceLocation
)
=>
{
if
(
!
error
)
{
this
.
event
.
trigger
(
'sourceLocationChanged'
,
[
sourceLocation
])
}
})
})
}
Ethdebugger
.
prototype
.
web3
=
function
()
{
...
...
src/ui/SolidityLocals.js
View file @
84dc6846
...
...
@@ -28,28 +28,21 @@ class SolidityLocals {
}
init
()
{
this
.
parent
.
event
.
register
(
'
indexChanged'
,
this
,
(
index
)
=>
{
this
.
parent
.
event
.
register
(
'
sourceLocationChanged'
,
this
,
(
sourceLocation
)
=>
{
var
warningDiv
=
this
.
view
.
querySelector
(
'#warning'
)
warningDiv
.
innerHTML
=
''
if
(
index
<
0
)
{
warningDiv
.
innerHTML
=
'invalid step index'
return
}
if
(
this
.
parent
.
currentStepIndex
!==
index
)
return
this
.
traceManager
.
waterfall
([
this
.
traceManager
.
getStackAt
,
this
.
traceManager
.
getMemoryAt
],
i
ndex
,
this
.
parent
.
currentStepI
ndex
,
(
error
,
result
)
=>
{
if
(
!
error
)
{
var
stack
=
result
[
0
].
value
var
memory
=
result
[
1
].
value
try
{
this
.
traceManager
.
getStorageAt
(
i
ndex
,
this
.
parent
.
tx
,
(
error
,
storage
)
=>
{
this
.
traceManager
.
getStorageAt
(
this
.
parent
.
currentStepI
ndex
,
this
.
parent
.
tx
,
(
error
,
storage
)
=>
{
if
(
!
error
)
{
var
locals
=
localDecoder
.
solidityLocals
(
index
,
this
.
internalTreeCall
,
stack
,
memory
,
storage
)
var
locals
=
localDecoder
.
solidityLocals
(
this
.
parent
.
currentStepIndex
,
this
.
internalTreeCall
,
stack
,
memory
,
storage
,
sourceLocation
)
this
.
basicPanel
.
update
(
locals
)
}
})
...
...
src/util/internalCallTree.js
View file @
84dc6846
...
...
@@ -132,7 +132,8 @@ function includeVariableDeclaration (tree, step, sourceLocation, scopeId) {
tree
.
scopes
[
scopeId
].
locals
[
variableDeclaration
.
attributes
.
name
]
=
{
name
:
variableDeclaration
.
attributes
.
name
,
type
:
decodeInfo
.
parseType
(
variableDeclaration
.
attributes
.
type
,
states
,
contractName
),
stackDepth
:
stack
.
length
stackDepth
:
stack
.
length
,
sourceLocation
:
sourceLocation
}
}
})
...
...
test/solidity/localsTests/helper.js
View file @
84dc6846
...
...
@@ -12,7 +12,7 @@ function decodeLocal (st, index, traceManager, callTree, verifier) {
index
,
function
(
error
,
result
)
{
if
(
!
error
)
{
var
locals
=
localDecoder
.
solidityLocals
(
index
,
callTree
,
result
[
0
].
value
,
result
[
1
].
value
)
var
locals
=
localDecoder
.
solidityLocals
(
index
,
callTree
,
result
[
0
].
value
,
result
[
1
].
value
,
{},
{
start
:
5000
}
)
verifier
(
locals
)
}
else
{
st
.
fail
(
error
)
...
...
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