Skip to content

Commit

Permalink
fix Yul stack assignments operator (NomicFoundation#1062)
Browse files Browse the repository at this point in the history
This statement uses `=:` and `= :` operators, with no LHS.

More details: https://docs.soliditylang.org/en/v0.4.26/assembly.html

Closes NomicFoundation#1060
  • Loading branch information
OmarTawfik authored and ggiraldez committed Aug 6, 2024
1 parent 9113dad commit a05d7d1
Show file tree
Hide file tree
Showing 29 changed files with 361 additions and 141 deletions.
5 changes: 5 additions & 0 deletions .changeset/itchy-candles-remain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@nomicfoundation/slang": patch
---

fix stack assignments operator `=:`.
36 changes: 28 additions & 8 deletions crates/solidity/inputs/language/src/definition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1906,6 +1906,13 @@ codegen_language_macros::compile!(Language(
name = Equal,
definitions = [TokenDefinition(scanner = Atom("="))]
),
Token(
name = EqualColon,
definitions = [TokenDefinition(
enabled = Till("0.5.0"),
scanner = Atom("=:")
)]
),
Token(
name = EqualEqual,
definitions = [TokenDefinition(scanner = Atom("=="))]
Expand Down Expand Up @@ -4235,25 +4242,38 @@ codegen_language_macros::compile!(Language(
expression = Required(YulExpression)
)
),
Enum(
name = YulAssignmentOperator,
variants = [
EnumVariant(reference = YulColonAndEqual, enabled = Till("0.5.5")),
EnumVariant(reference = ColonEqual)
]
),
Struct(
name = YulColonAndEqual,
enabled = Till("0.5.5"),
fields = (colon = Required(Colon), equal = Required(Equal))
),
Struct(
name = YulStackAssignmentStatement,
enabled = Till("0.5.0"),
fields = (
assignment = Required(YulAssignmentOperator),
expression = Required(YulExpression)
assignment = Required(YulStackAssignmentOperator),
variable = Required(YulIdentifier)
)
),
Enum(
name = YulAssignmentOperator,
name = YulStackAssignmentOperator,
enabled = Till("0.5.0"),
variants = [
EnumVariant(reference = YulColonEqual, enabled = Till("0.5.5")),
EnumVariant(reference = ColonEqual)
EnumVariant(reference = YulEqualAndColon),
EnumVariant(reference = EqualColon)
]
),
Struct(
name = YulColonEqual,
enabled = Till("0.5.5"),
fields = (colon = Required(Colon), equal = Required(Equal))
name = YulEqualAndColon,
enabled = Till("0.5.0"),
fields = (equal = Required(Equal), colon = Required(Colon))
),
Struct(
name = YulIfStatement,
Expand Down

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.

Loading

0 comments on commit a05d7d1

Please sign in to comment.