-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
Change the order that YulStatements get parsed so that `YulVariableAssignmentStatement` gets tried before `YulLabel`. This prevents and issue pre-0.5.0 where an assignment statement like this: ```solidity assembly { foo: = mload(0x80) } ``` would get parsed as a label and then everything from `=` on would cause an error. Now for versions before 0.5.5 this gets correctly parsed as a variable assignment. Closes #1182 --------- Co-authored-by: Omar Tawfik <[email protected]>
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# This file is generated automatically by infrastructure scripts. Please don't edit by hand. | ||
|
||
Source: > | ||
1 │ foo_label: │ 0..10 | ||
Errors: [] | ||
|
||
Tree: | ||
- (YulStatement) ► (variant꞉ YulLabel): # "foo_label:\n" (0..11) | ||
- (label꞉ YulIdentifier): "foo_label" # (0..9) | ||
- (colon꞉ Colon): ":" # (9..10) | ||
- (trailing_trivia꞉ EndOfLine): "\n" # (10..11) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# This file is generated automatically by infrastructure scripts. Please don't edit by hand. | ||
|
||
Source: > | ||
1 │ foo_label: │ 0..10 | ||
Errors: # 1 total | ||
- > | ||
Error: Expected OpenParen. | ||
╭─[crates/solidity/testing/snapshots/cst_output/YulStatement/label/input.sol:1:10] | ||
│ | ||
1 │ foo_label: | ||
│ ─┬ | ||
│ ╰── Error occurred here. | ||
───╯ | ||
Tree: | ||
- (YulStatement): # "foo_label:\n" (0..11) | ||
- (variant꞉ YulExpression) ► (variant꞉ YulPath): # "foo_label" (0..9) | ||
- (item꞉ YulIdentifier): "foo_label" # (0..9) | ||
- (UNRECOGNIZED): ":\n" # (9..11) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
foo_label: |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# This file is generated automatically by infrastructure scripts. Please don't edit by hand. | ||
|
||
Source: > | ||
1 │ // Makes sure that `newB:` is not parsed as a label here, and that we continue parsing to get a whole assignment statement. │ 0..123 | ||
2 │ newB: = mload(0x80) │ 124..143 | ||
Errors: [] | ||
|
||
Tree: | ||
- (YulStatement) ► (variant꞉ YulVariableAssignmentStatement): # "// Makes sure that `newB:` is not parsed as a labe..." (0..144) | ||
- (variables꞉ YulPaths): # "// Makes sure that `newB:` is not parsed as a labe..." (0..128) | ||
- (item꞉ YulPath): # "// Makes sure that `newB:` is not parsed as a labe..." (0..128) | ||
- (leading_trivia꞉ SingleLineComment): "// Makes sure that `newB:` is not parsed as a labe..." # (0..123) | ||
- (leading_trivia꞉ EndOfLine): "\n" # (123..124) | ||
- (item꞉ YulIdentifier): "newB" # (124..128) | ||
- (assignment꞉ YulAssignmentOperator) ► (variant꞉ YulColonAndEqual): # ": =" (128..131) | ||
- (colon꞉ Colon): ":" # (128..129) | ||
- (leading_trivia꞉ Whitespace): " " # (129..130) | ||
- (equal꞉ Equal): "=" # (130..131) | ||
- (expression꞉ YulExpression) ► (variant꞉ YulFunctionCallExpression): # " mload(0x80)\n" (131..144) | ||
- (operand꞉ YulExpression) ► (variant꞉ YulBuiltInFunction): # " mload" (131..137) | ||
- (leading_trivia꞉ Whitespace): " " # (131..132) | ||
- (variant꞉ YulMLoadKeyword): "mload" # (132..137) | ||
- (open_paren꞉ OpenParen): "(" # (137..138) | ||
- (arguments꞉ YulArguments): # "0x80" (138..142) | ||
- (item꞉ YulExpression) ► (variant꞉ YulLiteral) ► (variant꞉ YulHexLiteral): "0x80" # (138..142) | ||
- (close_paren꞉ CloseParen): ")" # (142..143) | ||
- (trailing_trivia꞉ EndOfLine): "\n" # (143..144) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# This file is generated automatically by infrastructure scripts. Please don't edit by hand. | ||
|
||
Source: > | ||
1 │ // Makes sure that `newB:` is not parsed as a label here, and that we continue parsing to get a whole assignment statement. │ 0..123 | ||
2 │ newB: = mload(0x80) │ 124..143 | ||
Errors: # 1 total | ||
- > | ||
Error: Expected OpenParen. | ||
╭─[crates/solidity/testing/snapshots/cst_output/YulStatement/var_assign_colon_and_equals/input.sol:2:5] | ||
│ | ||
2 │ newB: = mload(0x80) | ||
│ ────────┬─────── | ||
│ ╰───────── Error occurred here. | ||
───╯ | ||
Tree: | ||
- (YulStatement): # "// Makes sure that `newB:` is not parsed as a labe..." (0..144) | ||
- (variant꞉ YulExpression) ► (variant꞉ YulPath): # "// Makes sure that `newB:` is not parsed as a labe..." (0..128) | ||
- (leading_trivia꞉ SingleLineComment): "// Makes sure that `newB:` is not parsed as a labe..." # (0..123) | ||
- (leading_trivia꞉ EndOfLine): "\n" # (123..124) | ||
- (item꞉ YulIdentifier): "newB" # (124..128) | ||
- (UNRECOGNIZED): ": = mload(0x80)\n" # (128..144) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// Makes sure that `newB:` is not parsed as a label here, and that we continue parsing to get a whole assignment statement. | ||
newB: = mload(0x80) |