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
d3207060
Commit
d3207060
authored
Jul 24, 2020
by
Iuri Matias
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor GetInstructionIndex
parent
31ba1e8f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
16 deletions
+5
-16
codeManager.js
libs/remix-lib/src/code/codeManager.js
+2
-13
sourceLocationTracker.js
libs/remix-lib/src/sourceLocationTracker.js
+1
-1
codeManager.js
libs/remix-lib/test/codeManager.js
+2
-2
No files found.
libs/remix-lib/src/code/codeManager.js
View file @
d3207060
...
...
@@ -93,18 +93,7 @@ CodeManager.prototype.getFunctionFromStep = function (stepIndex, sourceMap, ast)
* @param {String} step - vm trace step
* @param {Function} callback - instruction index
*/
CodeManager
.
prototype
.
getInstructionIndex
=
function
(
address
,
step
,
callback
)
{
try
{
const
pc
=
this
.
traceManager
.
getCurrentPC
(
step
)
const
itemIndex
=
this
.
codeResolver
.
getInstructionIndex
(
address
,
pc
)
callback
(
null
,
itemIndex
)
}
catch
(
error
)
{
console
.
log
(
error
)
return
callback
(
'Cannot retrieve current PC for '
+
step
,
null
)
}
}
CodeManager
.
prototype
.
newGetInstructionIndex
=
function
(
address
,
step
)
{
CodeManager
.
prototype
.
getInstructionIndex
=
function
(
address
,
step
)
{
try
{
const
pc
=
this
.
traceManager
.
getCurrentPC
(
step
)
const
itemIndex
=
this
.
codeResolver
.
getInstructionIndex
(
address
,
pc
)
...
...
@@ -140,7 +129,7 @@ function retrieveCodeAndTrigger (codeMananger, address, stepIndex, tx) {
function
retrieveIndexAndTrigger
(
codeMananger
,
address
,
step
,
code
)
{
let
result
try
{
result
=
codeMananger
.
newG
etInstructionIndex
(
address
,
step
)
result
=
codeMananger
.
g
etInstructionIndex
(
address
,
step
)
}
catch
(
error
)
{
return
console
.
log
(
error
)
}
...
...
libs/remix-lib/src/sourceLocationTracker.js
View file @
d3207060
...
...
@@ -37,7 +37,7 @@ SourceLocationTracker.prototype.getSourceLocationFromInstructionIndex = async fu
*/
SourceLocationTracker
.
prototype
.
getSourceLocationFromVMTraceIndex
=
async
function
(
address
,
vmtraceStepIndex
,
contracts
)
{
const
sourceMap
=
await
extractSourceMap
(
this
,
this
.
codeManager
,
address
,
contracts
)
const
index
=
this
.
codeManager
.
newG
etInstructionIndex
(
address
,
vmtraceStepIndex
)
const
index
=
this
.
codeManager
.
g
etInstructionIndex
(
address
,
vmtraceStepIndex
)
return
this
.
sourceMappingDecoder
.
atIndex
(
index
,
sourceMap
)
}
...
...
libs/remix-lib/test/codeManager.js
View file @
d3207060
...
...
@@ -69,7 +69,7 @@ function continueTesting (t, codeManager) {
t
.
test
(
'CodeManager.getInstructionIndex'
,
function
(
st
)
{
st
.
plan
(
2
)
try
{
const
result
=
codeManager
.
newG
etInstructionIndex
(
'0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5'
,
16
)
const
result
=
codeManager
.
g
etInstructionIndex
(
'0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5'
,
16
)
console
.
log
(
result
)
st
.
ok
(
result
===
25
)
}
catch
(
error
)
{
...
...
@@ -77,7 +77,7 @@ function continueTesting (t, codeManager) {
}
try
{
const
result
=
codeManager
.
newG
etInstructionIndex
(
'(Contract Creation - Step 63)'
,
70
)
const
result
=
codeManager
.
g
etInstructionIndex
(
'(Contract Creation - Step 63)'
,
70
)
console
.
log
(
result
)
st
.
ok
(
result
===
6
)
}
catch
(
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