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
9af7f48d
Unverified
Commit
9af7f48d
authored
Jun 24, 2020
by
yann300
Committed by
GitHub
Jun 24, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1499 from ethereum/fixSourceMaps
fix source maps
parents
244295e4
fbb3d0da
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
1 deletion
+28
-1
sourceMappingDecoder.js
remix-lib/src/sourceMappingDecoder.js
+3
-0
sourceMapping.js
remix-lib/test/resources/sourceMapping.js
+14
-0
sourceMappingDecoder.js
remix-lib/test/sourceMappingDecoder.js
+11
-1
No files found.
remix-lib/src/sourceMappingDecoder.js
View file @
9af7f48d
...
@@ -216,6 +216,9 @@ function atIndex (index, mapping) {
...
@@ -216,6 +216,9 @@ function atIndex (index, mapping) {
}
}
current
=
current
.
split
(
':'
)
current
=
current
.
split
(
':'
)
if
(
current
[
2
]
===
'-1'
)
{
// if the current step has -1 for the file attribute, we discard it
if
(
current
[
2
]
===
'-1'
)
{
// if the current step has -1 for the file attribute, we discard it
// case: 'file' is not yet assigned, while processing the srcmap (reverse looping) to find 'start', 'length' (etc..), we tumble on -1 for the file.
// in that case the step has to be discarded
if
(
ret
.
file
===
undefined
)
ret
=
{}
continue
continue
}
}
if
(
ret
.
start
===
undefined
&&
current
[
0
]
&&
current
[
0
]
!==
'-1'
&&
current
[
0
].
length
)
{
if
(
ret
.
start
===
undefined
&&
current
[
0
]
&&
current
[
0
]
!==
'-1'
&&
current
[
0
].
length
)
{
...
...
remix-lib/test/resources/sourceMapping.js
View file @
9af7f48d
...
@@ -17,6 +17,20 @@ sourceRuntimeMapping.source = `contract test {
...
@@ -17,6 +17,20 @@ sourceRuntimeMapping.source = `contract test {
}
}
}`
}`
sourceRuntimeMapping
.
tokenSaleChallengeSourceMap
=
'0:286:0:-:0;;;;5:9:-1;2:2;;;27:1;24;17:12;2:2;0:286:0;;;;;;;;;;;;;;;;;;;;;12:1:-1;9;2:12;34:44:0;;;;;;15:2:-1;10:3;7:11;4:2;;;31:1;28;21:12;4:2;34:44:0;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;161:123;;;:::i;:::-;;;;;;;;;;;;;;;;;;;34:44;;;;;;;;;;;;;;;;;:::o;161:123::-;192:7;211:10;:19;;:48;119:7;231:9;;:27;211:48;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;211:48:0;276:1;269:8;;161:123;:::o'
sourceRuntimeMapping
.
tokenSaleChallengeSource
=
`
contract TokenSaleChallenge {
mapping(address => uint256) public balanceOf;
uint256 constant PRICE_PER_TOKEN = 1 ether;
uint256 numTokens = 30;
function test() public returns(uint256) {
msg.sender.transfer(numTokens * PRICE_PER_TOKEN);
return 2;
}
}
`
sourceRuntimeMapping
.
ballotSourceMap
=
'33:1970:0:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;33:1970:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;712:577;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;712:577:0;;;;;;;;;;;;;;;;;;;:::i;:::-;;1641:360;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;495:164;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;495:164:0;;;;;;;;;;;;;;;;;;;:::i;:::-;;1349:286;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;1349:286:0;;;;;;;;;;;;;;;;;;;:::i;:::-;;712:577;759:20;782:6;:18;789:10;782:18;;;;;;;;;;;;;;;759:41;;835:6;:12;;;;;;;;;;;;831:25;;;849:7;;;831:25;865:115;903:1;872:33;;:6;:10;879:2;872:10;;;;;;;;;;;;;;;:19;;;;;;;;;;;;:33;;;;:70;;;;;932:10;909:33;;:6;:10;916:2;909:10;;;;;;;;;;;;;;;:19;;;;;;;;;;;;:33;;;;872:70;865:115;;;961:6;:10;968:2;961:10;;;;;;;;;;;;;;;:19;;;;;;;;;;;;956:24;;865:115;;;1000:10;994:16;;:2;:16;;;990:29;;;1012:7;;;990:29;1043:4;1028:6;:12;;;:19;;;;;;;;;;;;;;;;;;1075:2;1057:6;:15;;;:20;;;;;;;;;;;;;;;;;;1087:24;1114:6;:10;1121:2;1114:10;;;;;;;;;;;;;;;1087:37;;1138:10;:16;;;;;;;;;;;;1134:148;;;1208:6;:13;;;1168:9;1178:10;:15;;;;;;;;;;;;1168:26;;;;;;;;;;;;;;;;;:36;;;:53;;;;;;;;;;;1134:148;;;1269:6;:13;;;1248:10;:17;;;:34;;;;;;;;;;;1134:148;712:577;;;;:::o;1641:360::-;1689:22;1723:24;1750:1;1723:28;;1766:10;1779:1;1766:14;;1761:234;1789:9;:16;;;;1782:4;:23;;;1761:234;;;1859:16;1831:9;1841:4;1831:15;;;;;;;;;;;;;;;;;:25;;;:44;1827:168;;;1914:9;1924:4;1914:15;;;;;;;;;;;;;;;;;:25;;;1895:44;;1976:4;1957:23;;1827:168;1807:6;;;;;;;1761:234;;;;1641:360;;:::o;495:164::-;572:11;;;;;;;;;;;558:25;;:10;:25;;;;:50;;;;587:6;:15;594:7;587:15;;;;;;;;;;;;;;;:21;;;;;;;;;;;;558:50;554:63;;;610:7;;554:63;651:1;626:6;:15;633:7;626:15;;;;;;;;;;;;;;;:22;;:26;;;;495:164;;:::o;1349:286::-;1398:20;1421:6;:18;1428:10;1421:18;;;;;;;;;;;;;;;1398:41;;1453:6;:12;;;;;;;;;;;;:46;;;;1483:9;:16;;;;1469:10;:30;;;;1453:46;1449:59;;;1501:7;;;1449:59;1532:4;1517:6;:12;;;:19;;;;;;;;;;;;;;;;;;1560:10;1546:6;:11;;;:24;;;;;;;;;;;;;;;;;;1615:6;:13;;;1580:9;1590:10;1580:21;;;;;;;;;;;;;;;;;:31;;;:48;;;;;;;;;;;1349:286;;;:::o'
sourceRuntimeMapping
.
ballotSourceMap
=
'33:1970:0:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;33:1970:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;712:577;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;712:577:0;;;;;;;;;;;;;;;;;;;:::i;:::-;;1641:360;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;495:164;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;495:164:0;;;;;;;;;;;;;;;;;;;:::i;:::-;;1349:286;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;1349:286:0;;;;;;;;;;;;;;;;;;;:::i;:::-;;712:577;759:20;782:6;:18;789:10;782:18;;;;;;;;;;;;;;;759:41;;835:6;:12;;;;;;;;;;;;831:25;;;849:7;;;831:25;865:115;903:1;872:33;;:6;:10;879:2;872:10;;;;;;;;;;;;;;;:19;;;;;;;;;;;;:33;;;;:70;;;;;932:10;909:33;;:6;:10;916:2;909:10;;;;;;;;;;;;;;;:19;;;;;;;;;;;;:33;;;;872:70;865:115;;;961:6;:10;968:2;961:10;;;;;;;;;;;;;;;:19;;;;;;;;;;;;956:24;;865:115;;;1000:10;994:16;;:2;:16;;;990:29;;;1012:7;;;990:29;1043:4;1028:6;:12;;;:19;;;;;;;;;;;;;;;;;;1075:2;1057:6;:15;;;:20;;;;;;;;;;;;;;;;;;1087:24;1114:6;:10;1121:2;1114:10;;;;;;;;;;;;;;;1087:37;;1138:10;:16;;;;;;;;;;;;1134:148;;;1208:6;:13;;;1168:9;1178:10;:15;;;;;;;;;;;;1168:26;;;;;;;;;;;;;;;;;:36;;;:53;;;;;;;;;;;1134:148;;;1269:6;:13;;;1248:10;:17;;;:34;;;;;;;;;;;1134:148;712:577;;;;:::o;1641:360::-;1689:22;1723:24;1750:1;1723:28;;1766:10;1779:1;1766:14;;1761:234;1789:9;:16;;;;1782:4;:23;;;1761:234;;;1859:16;1831:9;1841:4;1831:15;;;;;;;;;;;;;;;;;:25;;;:44;1827:168;;;1914:9;1924:4;1914:15;;;;;;;;;;;;;;;;;:25;;;1895:44;;1976:4;1957:23;;1827:168;1807:6;;;;;;;1761:234;;;;1641:360;;:::o;495:164::-;572:11;;;;;;;;;;;558:25;;:10;:25;;;;:50;;;;587:6;:15;594:7;587:15;;;;;;;;;;;;;;;:21;;;;;;;;;;;;558:50;554:63;;;610:7;;554:63;651:1;626:6;:15;633:7;626:15;;;;;;;;;;;;;;;:22;;:26;;;;495:164;;:::o;1349:286::-;1398:20;1421:6;:18;1428:10;1421:18;;;;;;;;;;;;;;;1398:41;;1453:6;:12;;;;;;;;;;;;:46;;;;1483:9;:16;;;;1469:10;:30;;;;1453:46;1449:59;;;1501:7;;;1449:59;1532:4;1517:6;:12;;;:19;;;;;;;;;;;;;;;;;;1560:10;1546:6;:11;;;:24;;;;;;;;;;;;;;;;;;1615:6;:13;;;1580:9;1590:10;1580:21;;;;;;;;;;;;;;;;;:31;;;:48;;;;;;;;;;;1349:286;;;:::o'
sourceRuntimeMapping
.
ballotSource
=
`
sourceRuntimeMapping
.
ballotSource
=
`
pragma solidity >=0.4.22 <0.6.0;
pragma solidity >=0.4.22 <0.6.0;
...
...
remix-lib/test/sourceMappingDecoder.js
View file @
9af7f48d
...
@@ -22,7 +22,7 @@ tape('SourceMappingDecoder', function (t) {
...
@@ -22,7 +22,7 @@ tape('SourceMappingDecoder', function (t) {
const
testSourceMapping
=
{}
const
testSourceMapping
=
{}
t
.
test
(
'sourceMappingDecoder'
,
function
(
st
)
{
t
.
test
(
'sourceMappingDecoder'
,
function
(
st
)
{
st
.
plan
(
3
2
)
st
.
plan
(
3
6
)
const
sourceMappingDecoder
=
new
SourceMappingDecoder
()
const
sourceMappingDecoder
=
new
SourceMappingDecoder
()
console
.
log
(
'test decompressAll'
)
console
.
log
(
'test decompressAll'
)
let
result
=
sourceMappingDecoder
.
decompressAll
(
sourceMapping
.
mapping
)
let
result
=
sourceMappingDecoder
.
decompressAll
(
sourceMapping
.
mapping
)
...
@@ -81,6 +81,14 @@ tape('SourceMappingDecoder', function (t) {
...
@@ -81,6 +81,14 @@ tape('SourceMappingDecoder', function (t) {
st
.
equal
(
delegateSrcMap
.
length
,
577
)
st
.
equal
(
delegateSrcMap
.
length
,
577
)
st
.
equal
(
delegateSrcMap
.
file
,
0
)
st
.
equal
(
delegateSrcMap
.
file
,
0
)
st
.
equal
(
delegateSrcMap
.
jump
,
'-'
)
st
.
equal
(
delegateSrcMap
.
jump
,
'-'
)
// TokenSaleChallenge - function test(uint256)
const
tokenSaleChallengeMap
=
sourceMappingDecoder
.
atIndex
(
170
,
sourceMapping
.
tokenSaleChallengeSourceMap
)
console
.
log
(
tokenSaleChallengeMap
)
st
.
equal
(
tokenSaleChallengeMap
.
start
,
211
)
st
.
equal
(
tokenSaleChallengeMap
.
length
,
48
)
st
.
equal
(
tokenSaleChallengeMap
.
file
,
0
)
st
.
equal
(
tokenSaleChallengeMap
.
jump
,
'-'
)
})
})
t
.
test
(
'sourceMappingLineColumnConverter'
,
function
(
st
)
{
t
.
test
(
'sourceMappingLineColumnConverter'
,
function
(
st
)
{
...
@@ -106,6 +114,8 @@ tape('SourceMappingDecoder', function (t) {
...
@@ -106,6 +114,8 @@ tape('SourceMappingDecoder', function (t) {
file
:
4
,
file
:
4
,
jump
:
'-'
jump
:
'-'
}
}
// case: 'file' is not yet assigned, while processing the srcmap (reverse looping) to find 'start', 'length' (etc..), we tumble on -1 for the file.
// in that case the step has to be discarded
result
=
sourceMappingDecoder
.
convertOffsetToLineColumn
(
res
,
linesbreak
)
result
=
sourceMappingDecoder
.
convertOffsetToLineColumn
(
res
,
linesbreak
)
st
.
equal
(
result
.
start
.
line
,
7
)
st
.
equal
(
result
.
start
.
line
,
7
)
st
.
equal
(
result
.
start
.
column
,
12
)
st
.
equal
(
result
.
start
.
column
,
12
)
...
...
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