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
90ced8f4
Unverified
Commit
90ced8f4
authored
Mar 19, 2018
by
yann300
Committed by
GitHub
Mar 19, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #734 from ethereum/addAPISourceLocationTracker
Fix source map cache
parents
4df858a4
1bc5633e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
14 deletions
+12
-14
package.json
remix-lib/package.json
+1
-1
sourceLocationTracker.js
remix-lib/src/sourceLocationTracker.js
+11
-13
No files found.
remix-lib/package.json
View file @
90ced8f4
{
{
"name"
:
"remix-lib"
,
"name"
:
"remix-lib"
,
"version"
:
"0.1.
7
"
,
"version"
:
"0.1.
8
"
,
"description"
:
"Ethereum IDE and tools for the web"
,
"description"
:
"Ethereum IDE and tools for the web"
,
"contributors"
:
[
"contributors"
:
[
{
{
...
...
remix-lib/src/sourceLocationTracker.js
View file @
90ced8f4
...
@@ -11,8 +11,7 @@ function SourceLocationTracker (_codeManager) {
...
@@ -11,8 +11,7 @@ function SourceLocationTracker (_codeManager) {
this
.
codeManager
=
_codeManager
this
.
codeManager
=
_codeManager
this
.
event
=
new
EventManager
()
this
.
event
=
new
EventManager
()
this
.
sourceMappingDecoder
=
new
SourceMappingDecoder
()
this
.
sourceMappingDecoder
=
new
SourceMappingDecoder
()
this
.
sourceMapCacheOfInstructionIndex
=
{}
this
.
sourceMapByAddress
=
{}
this
.
sourceMapCacheOfVMTraceIndex
=
{}
}
}
/**
/**
...
@@ -25,14 +24,10 @@ function SourceLocationTracker (_codeManager) {
...
@@ -25,14 +24,10 @@ function SourceLocationTracker (_codeManager) {
*/
*/
SourceLocationTracker
.
prototype
.
getSourceLocationFromInstructionIndex
=
function
(
address
,
index
,
contracts
,
cb
)
{
SourceLocationTracker
.
prototype
.
getSourceLocationFromInstructionIndex
=
function
(
address
,
index
,
contracts
,
cb
)
{
var
self
=
this
var
self
=
this
if
(
self
.
sourceMapCacheOfInstructionIndex
[
address
])
{
extractSourceMap
(
this
,
this
.
codeManager
,
address
,
contracts
,
function
(
error
,
sourceMap
)
{
return
cb
(
null
,
self
.
sourceMappingDecoder
.
atIndex
(
index
,
self
.
sourceMapCacheOfInstructionIndex
[
address
]))
}
extractSourceMap
(
this
.
codeManager
,
address
,
contracts
,
function
(
error
,
sourceMap
)
{
if
(
error
)
{
if
(
error
)
{
cb
(
error
)
cb
(
error
)
}
else
{
}
else
{
if
(
!
helper
.
isContractCreation
(
address
))
self
.
sourceMapCacheOfInstructionIndex
[
address
]
=
sourceMap
cb
(
null
,
self
.
sourceMappingDecoder
.
atIndex
(
index
,
sourceMap
))
cb
(
null
,
self
.
sourceMappingDecoder
.
atIndex
(
index
,
sourceMap
))
}
}
})
})
...
@@ -48,16 +43,12 @@ SourceLocationTracker.prototype.getSourceLocationFromInstructionIndex = function
...
@@ -48,16 +43,12 @@ SourceLocationTracker.prototype.getSourceLocationFromInstructionIndex = function
*/
*/
SourceLocationTracker
.
prototype
.
getSourceLocationFromVMTraceIndex
=
function
(
address
,
vmtraceStepIndex
,
contracts
,
cb
)
{
SourceLocationTracker
.
prototype
.
getSourceLocationFromVMTraceIndex
=
function
(
address
,
vmtraceStepIndex
,
contracts
,
cb
)
{
var
self
=
this
var
self
=
this
if
(
self
.
sourceMapCacheOfVMTraceIndex
[
address
])
{
extractSourceMap
(
this
,
this
.
codeManager
,
address
,
contracts
,
function
(
error
,
sourceMap
)
{
return
cb
(
null
,
self
.
sourceMappingDecoder
.
atIndex
(
vmtraceStepIndex
,
self
.
sourceMapCacheOfVMTraceIndex
[
address
]))
}
extractSourceMap
(
this
.
codeManager
,
address
,
contracts
,
function
(
error
,
sourceMap
)
{
if
(
!
error
)
{
if
(
!
error
)
{
self
.
codeManager
.
getInstructionIndex
(
address
,
vmtraceStepIndex
,
function
(
error
,
index
)
{
self
.
codeManager
.
getInstructionIndex
(
address
,
vmtraceStepIndex
,
function
(
error
,
index
)
{
if
(
error
)
{
if
(
error
)
{
cb
(
error
)
cb
(
error
)
}
else
{
}
else
{
if
(
!
helper
.
isContractCreation
(
address
))
self
.
sourceMapCacheOfVMTraceIndex
[
address
]
=
sourceMap
cb
(
null
,
self
.
sourceMappingDecoder
.
atIndex
(
index
,
sourceMap
))
cb
(
null
,
self
.
sourceMappingDecoder
.
atIndex
(
index
,
sourceMap
))
}
}
})
})
...
@@ -67,6 +58,10 @@ SourceLocationTracker.prototype.getSourceLocationFromVMTraceIndex = function (ad
...
@@ -67,6 +58,10 @@ SourceLocationTracker.prototype.getSourceLocationFromVMTraceIndex = function (ad
})
})
}
}
SourceLocationTracker
.
prototype
.
clearCache
=
function
()
{
this
.
sourceMapByAddress
=
{}
}
function
getSourceMap
(
address
,
code
,
contracts
)
{
function
getSourceMap
(
address
,
code
,
contracts
)
{
var
isCreation
=
helper
.
isContractCreation
(
address
)
var
isCreation
=
helper
.
isContractCreation
(
address
)
var
bytes
var
bytes
...
@@ -81,11 +76,14 @@ function getSourceMap (address, code, contracts) {
...
@@ -81,11 +76,14 @@ function getSourceMap (address, code, contracts) {
return
null
return
null
}
}
function
extractSourceMap
(
codeManager
,
address
,
contracts
,
cb
)
{
function
extractSourceMap
(
self
,
codeManager
,
address
,
contracts
,
cb
)
{
if
(
self
.
sourceMapByAddress
[
address
])
return
cb
(
null
,
self
.
sourceMapByAddress
[
address
])
codeManager
.
getCode
(
address
,
function
(
error
,
result
)
{
codeManager
.
getCode
(
address
,
function
(
error
,
result
)
{
if
(
!
error
)
{
if
(
!
error
)
{
var
sourceMap
=
getSourceMap
(
address
,
result
.
bytecode
,
contracts
)
var
sourceMap
=
getSourceMap
(
address
,
result
.
bytecode
,
contracts
)
if
(
sourceMap
)
{
if
(
sourceMap
)
{
if
(
!
helper
.
isContractCreation
(
address
))
self
.
sourceMapByAddress
[
address
]
=
sourceMap
cb
(
null
,
sourceMap
)
cb
(
null
,
sourceMap
)
}
else
{
}
else
{
cb
(
'no sourcemap associated with the code '
+
address
)
cb
(
'no sourcemap associated with the code '
+
address
)
...
...
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