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
09c98ed1
Commit
09c98ed1
authored
Sep 16, 2020
by
yann300
Committed by
Aniket
Sep 18, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use remix-astwalker in remix-debug
parent
39333492
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
18 additions
and
32 deletions
+18
-32
index.js
libs/remix-debug/index.js
+0
-2
package.json
libs/remix-debug/package.json
+1
-0
astHelper.js
libs/remix-debug/src/solidity-decoder/astHelper.js
+8
-7
internalCallTree.js
libs/remix-debug/src/solidity-decoder/internalCallTree.js
+3
-5
sourceMappingDecoder.js
libs/remix-debug/src/source/sourceMappingDecoder.js
+6
-17
tests.js
libs/remix-debug/test/tests.js
+0
-1
No files found.
libs/remix-debug/index.js
View file @
09c98ed1
...
@@ -12,7 +12,6 @@ const SolidityDecoder = require('./src/solidity-decoder')
...
@@ -12,7 +12,6 @@ const SolidityDecoder = require('./src/solidity-decoder')
const
BreakpointManager
=
require
(
'./src/code/breakpointManager'
)
const
BreakpointManager
=
require
(
'./src/code/breakpointManager'
)
const
SourceMappingDecoder
=
require
(
'./src/source/sourceMappingDecoder'
)
const
SourceMappingDecoder
=
require
(
'./src/source/sourceMappingDecoder'
)
const
AstWalker
=
require
(
'./src/source/astWalker'
)
const
traceHelper
=
require
(
'./src/trace/traceHelper'
)
const
traceHelper
=
require
(
'./src/trace/traceHelper'
)
...
@@ -28,7 +27,6 @@ module.exports = {
...
@@ -28,7 +27,6 @@ module.exports = {
init
,
init
,
traceHelper
,
traceHelper
,
SourceMappingDecoder
,
SourceMappingDecoder
,
AstWalker
,
EthDebugger
:
EthDebugger
,
EthDebugger
:
EthDebugger
,
TransactionDebugger
:
TransactionDebugger
,
TransactionDebugger
:
TransactionDebugger
,
/**
/**
...
...
libs/remix-debug/package.json
View file @
09c98ed1
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
"ethereumjs-util"
:
"^6.2.0"
,
"ethereumjs-util"
:
"^6.2.0"
,
"ethereumjs-vm"
:
"4.1.3"
,
"ethereumjs-vm"
:
"4.1.3"
,
"@remix-project/remix-lib"
:
"0.4.30"
,
"@remix-project/remix-lib"
:
"0.4.30"
,
"@remix-project/remix-astwalker"
:
"0.0.25"
,
"web3"
:
"^1.2.4"
"web3"
:
"^1.2.4"
},
},
"devDependencies"
:
{
"devDependencies"
:
{
...
...
libs/remix-debug/src/solidity-decoder/astHelper.js
View file @
09c98ed1
'use strict'
'use strict'
const
AstWalker
=
require
(
'../source/astW
alker'
)
const
{
AstWalker
}
=
require
(
'@remix-project/remix-astw
alker'
)
/**
/**
* return all contract definitions of the given @astList
* return all contract definitions of the given @astList
...
@@ -15,12 +15,13 @@ function extractContractDefinitions (sourcesList) {
...
@@ -15,12 +15,13 @@ function extractContractDefinitions (sourcesList) {
}
}
const
walker
=
new
AstWalker
()
const
walker
=
new
AstWalker
()
for
(
let
k
in
sourcesList
)
{
for
(
let
k
in
sourcesList
)
{
walker
.
walk
(
sourcesList
[
k
].
ast
,
{
'ContractDefinition'
:
(
node
)
=>
{
walker
.
walkFull
(
sourcesList
[
k
].
ast
,
(
node
)
=>
{
ret
.
contractsById
[
node
.
id
]
=
node
if
(
node
.
nodeType
===
'ContractDefinition'
)
{
ret
.
sourcesByContract
[
node
.
id
]
=
k
ret
.
contractsById
[
node
.
id
]
=
node
ret
.
contractsByName
[
k
+
':'
+
node
.
name
]
=
node
ret
.
sourcesByContract
[
node
.
id
]
=
k
return
false
ret
.
contractsByName
[
k
+
':'
+
node
.
name
]
=
node
}})
}
})
}
}
return
ret
return
ret
}
}
...
...
libs/remix-debug/src/solidity-decoder/internalCallTree.js
View file @
09c98ed1
'use strict'
'use strict'
const
{
AstWalker
}
=
require
(
'@remix-project/remix-astwalker'
)
const
remixLib
=
require
(
'@remix-project/remix-lib'
)
const
remixLib
=
require
(
'@remix-project/remix-lib'
)
const
SourceLocationTracker
=
require
(
'../source/sourceLocationTracker'
)
const
SourceLocationTracker
=
require
(
'../source/sourceLocationTracker'
)
const
AstWalker
=
require
(
'../source/astWalker'
)
const
EventManager
=
require
(
'../eventManager'
)
const
EventManager
=
require
(
'../eventManager'
)
const
decodeInfo
=
require
(
'./decodeInfo'
)
const
decodeInfo
=
require
(
'./decodeInfo'
)
...
@@ -312,22 +312,20 @@ function resolveFunctionDefinition (tree, step, sourceLocation) {
...
@@ -312,22 +312,20 @@ function resolveFunctionDefinition (tree, step, sourceLocation) {
function
extractVariableDeclarations
(
ast
,
astWalker
)
{
function
extractVariableDeclarations
(
ast
,
astWalker
)
{
const
ret
=
{}
const
ret
=
{}
astWalker
.
walk
(
ast
,
(
node
)
=>
{
astWalker
.
walk
Full
(
ast
,
(
node
)
=>
{
if
(
node
.
nodeType
===
'VariableDeclaration'
)
{
if
(
node
.
nodeType
===
'VariableDeclaration'
)
{
ret
[
node
.
src
]
=
node
ret
[
node
.
src
]
=
node
}
}
return
true
})
})
return
ret
return
ret
}
}
function
extractFunctionDefinitions
(
ast
,
astWalker
)
{
function
extractFunctionDefinitions
(
ast
,
astWalker
)
{
const
ret
=
{}
const
ret
=
{}
astWalker
.
walk
(
ast
,
(
node
)
=>
{
astWalker
.
walk
Full
(
ast
,
(
node
)
=>
{
if
(
node
.
nodeType
===
'FunctionDefinition'
)
{
if
(
node
.
nodeType
===
'FunctionDefinition'
)
{
ret
[
node
.
src
]
=
node
ret
[
node
.
src
]
=
node
}
}
return
true
})
})
return
ret
return
ret
}
}
...
...
libs/remix-debug/src/source/sourceMappingDecoder.js
View file @
09c98ed1
'use strict'
'use strict'
const
{
AstWalker
}
=
require
(
'@remix-project/remix-astwalker'
)
const
remixLib
=
require
(
'@remix-project/remix-lib'
)
const
remixLib
=
require
(
'@remix-project/remix-lib'
)
const
util
=
remixLib
.
util
const
util
=
remixLib
.
util
const
AstWalker
=
require
(
'./astWalker'
)
/**
/**
* Decompress the source mapping given by solc-bin.js
* Decompress the source mapping given by solc-bin.js
...
@@ -144,33 +144,26 @@ function findNodeAtInstructionIndex (astNodeType, instIndex, sourceMap, ast) {
...
@@ -144,33 +144,26 @@ function findNodeAtInstructionIndex (astNodeType, instIndex, sourceMap, ast) {
function
findNodeAtSourceLocation
(
astNodeType
,
sourceLocation
,
ast
)
{
function
findNodeAtSourceLocation
(
astNodeType
,
sourceLocation
,
ast
)
{
const
astWalker
=
new
AstWalker
()
const
astWalker
=
new
AstWalker
()
const
callback
=
{}
let
found
=
null
let
found
=
null
c
allback
[
'*'
]
=
function
(
node
)
{
c
onst
callback
=
function
(
node
)
{
const
nodeLocation
=
sourceLocationFromAstNode
(
node
)
const
nodeLocation
=
sourceLocationFromAstNode
(
node
)
if
(
!
nodeLocation
)
{
if
(
!
nodeLocation
)
{
return
true
return
}
}
if
(
nodeLocation
.
start
<=
sourceLocation
.
start
&&
nodeLocation
.
start
+
nodeLocation
.
length
>=
sourceLocation
.
start
+
sourceLocation
.
length
)
{
if
(
nodeLocation
.
start
<=
sourceLocation
.
start
&&
nodeLocation
.
start
+
nodeLocation
.
length
>=
sourceLocation
.
start
+
sourceLocation
.
length
)
{
if
(
astNodeType
===
node
.
nodeType
)
{
if
(
astNodeType
===
node
.
nodeType
)
{
found
=
node
found
=
node
return
false
}
else
{
return
true
}
}
}
else
{
return
false
}
}
}
}
astWalker
.
walk
(
ast
.
ast
,
callback
)
astWalker
.
walk
Full
(
ast
.
ast
,
callback
)
return
found
return
found
}
}
function
nodesAtPosition
(
astNodeType
,
position
,
ast
)
{
function
nodesAtPosition
(
astNodeType
,
position
,
ast
)
{
const
astWalker
=
new
AstWalker
()
const
astWalker
=
new
AstWalker
()
const
callback
=
{}
const
found
=
[]
const
found
=
[]
c
allback
[
'*'
]
=
function
(
node
)
{
c
onst
callback
=
function
(
node
)
{
var
nodeLocation
=
sourceLocationFromAstNode
(
node
)
var
nodeLocation
=
sourceLocationFromAstNode
(
node
)
if
(
!
nodeLocation
)
{
if
(
!
nodeLocation
)
{
return
return
...
@@ -178,14 +171,10 @@ function nodesAtPosition (astNodeType, position, ast) {
...
@@ -178,14 +171,10 @@ function nodesAtPosition (astNodeType, position, ast) {
if
(
nodeLocation
.
start
<=
position
&&
nodeLocation
.
start
+
nodeLocation
.
length
>=
position
)
{
if
(
nodeLocation
.
start
<=
position
&&
nodeLocation
.
start
+
nodeLocation
.
length
>=
position
)
{
if
(
!
astNodeType
||
astNodeType
===
node
.
nodeType
)
{
if
(
!
astNodeType
||
astNodeType
===
node
.
nodeType
)
{
found
.
push
(
node
)
found
.
push
(
node
)
if
(
astNodeType
)
return
false
}
}
return
true
}
else
{
return
false
}
}
}
}
astWalker
.
walk
(
ast
.
ast
,
callback
)
astWalker
.
walk
Full
(
ast
.
ast
,
callback
)
return
found
return
found
}
}
...
...
libs/remix-debug/test/tests.js
View file @
09c98ed1
'use strict'
'use strict'
require
(
'./astwalker.js'
)
require
(
'./traceManager.js'
)
require
(
'./traceManager.js'
)
require
(
'./codeManager.js'
)
require
(
'./codeManager.js'
)
require
(
'./disassembler.js'
)
require
(
'./disassembler.js'
)
...
...
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