File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 7474 "outdent" : " ^0.8.0"
7575 },
7676 "dependencies" : {
77- "@solidity-parser/parser" : " ^0.12.0 " ,
77+ "@solidity-parser/parser" : " ^0.12.1 " ,
7878 "dir-to-object" : " ^2.0.0" ,
7979 "emoji-regex" : " ^9.2.1" ,
8080 "escape-string-regexp" : " ^4.0.0" ,
Original file line number Diff line number Diff line change @@ -5,13 +5,13 @@ const {
55} = require ( 'prettier/standalone' ) ;
66
77const IndexRangeAccess = {
8- print : ( { path, print } ) =>
8+ print : ( { node , path, print } ) =>
99 concat ( [
1010 path . call ( print , 'base' ) ,
1111 '[' ,
12- path . call ( print , 'indexStart' ) ,
12+ node . indexStart ? path . call ( print , 'indexStart' ) : '' ,
1313 ':' ,
14- path . call ( print , 'indexEnd' ) ,
14+ node . indexEnd ? path . call ( print , 'indexEnd' ) : '' ,
1515 ']'
1616 ] )
1717} ;
Original file line number Diff line number Diff line change @@ -7,3 +7,11 @@ contract Arrays {
77 Outcome.OutcomeItem[] memory outcomeFrom = abi.decode (fromPart.outcome, (Outcome.OutcomeItem[]));
88}
99}
10+
11+ contract ArraySlices {
12+ function f (bytes calldata x ) public {
13+ bytes memory a1 = abi.decode (x[:], (bytes ));
14+ bytes4 a2 = abi.decode (x[:4 ], (bytes4 ));
15+ address a3 = abi.decode (x[4 :], (address ));
16+ }
17+ }
Original file line number Diff line number Diff line change @@ -16,6 +16,14 @@ contract Arrays {
1616}
1717}
1818
19+ contract ArraySlices {
20+ function f(bytes calldata x ) public {
21+ bytes memory a1 = abi .decode (x [:], (bytes ));
22+ bytes4 a2 = abi .decode (x [:4 ], (bytes4 ));
23+ address a3 = abi .decode (x [4 :], (address ));
24+ }
25+ }
26+
1927=====================================output=====================================
2028pragma solidity ^0.5.2;
2129
@@ -41,5 +49,13 @@ contract Arrays {
4149 }
4250}
4351
52+ contract ArraySlices {
53+ function f(bytes calldata x ) public {
54+ bytes memory a1 = abi .decode (x [:], (bytes ));
55+ bytes4 a2 = abi .decode (x [:4 ], (bytes4 ));
56+ address a3 = abi .decode (x [4 :], (address ));
57+ }
58+ }
59+
4460================================================================================
4561` ;
You can’t perform that action at this time.
0 commit comments