Skip to content

Commit

Permalink
fix: Mark pure and view as only used since 0.4.16 and add missing…
Browse files Browse the repository at this point in the history
  • Loading branch information
Xanewok committed Mar 12, 2024
1 parent ce5050f commit dff1201
Show file tree
Hide file tree
Showing 41 changed files with 843 additions and 87 deletions.
5 changes: 5 additions & 0 deletions .changeset/pretty-tigers-search.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@nomicfoundation/slang": patch
---

Support view and pure function modifiers only from 0.4.16
5 changes: 5 additions & 0 deletions .changeset/quiet-points-suffer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@nomicfoundation/slang": minor
---

Add support for constant function modifier removed in 0.5.0
30 changes: 22 additions & 8 deletions crates/solidity/inputs/language/src/definition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1269,7 +1269,10 @@ codegen_language_macros::compile!(Language(
Keyword(
name = PureKeyword,
identifier = Identifier,
definitions = [KeywordDefinition(value = Atom("pure"))]
definitions = [KeywordDefinition(
enabled = From("0.4.16"),
value = Atom("pure")
)]
),
Keyword(
name = ReceiveKeyword,
Expand Down Expand Up @@ -1773,7 +1776,10 @@ codegen_language_macros::compile!(Language(
Keyword(
name = ViewKeyword,
identifier = Identifier,
definitions = [KeywordDefinition(value = Atom("view"))]
definitions = [KeywordDefinition(
enabled = From("0.4.16"),
value = Atom("view")
)]
),
Keyword(
name = VirtualKeyword,
Expand Down Expand Up @@ -2326,8 +2332,8 @@ codegen_language_macros::compile!(Language(
EnumVariant(reference = PayableKeyword),
EnumVariant(reference = PrivateKeyword),
EnumVariant(reference = PublicKeyword),
EnumVariant(reference = PureKeyword),
EnumVariant(reference = ViewKeyword),
EnumVariant(reference = PureKeyword, enabled = From("0.4.16")),
EnumVariant(reference = ViewKeyword, enabled = From("0.4.16")),
EnumVariant(reference = VirtualKeyword, enabled = From("0.6.0"))
]
),
Expand Down Expand Up @@ -2425,13 +2431,20 @@ codegen_language_macros::compile!(Language(
variants = [
EnumVariant(reference = ModifierInvocation),
EnumVariant(reference = OverrideSpecifier),
EnumVariant(reference = ConstantKeyword, enabled = Till("0.5.0")),
EnumVariant(reference = ExternalKeyword),
EnumVariant(reference = InternalKeyword, enabled = Till("0.5.0")),
EnumVariant(reference = PayableKeyword),
EnumVariant(reference = PrivateKeyword, enabled = Till("0.5.0")),
EnumVariant(reference = PublicKeyword, enabled = Till("0.5.0")),
EnumVariant(reference = PureKeyword),
EnumVariant(reference = ViewKeyword)
EnumVariant(
reference = PureKeyword,
enabled = Range(from = "0.4.16", till = "0.6.0")
),
EnumVariant(
reference = ViewKeyword,
enabled = Range(from = "0.4.16", till = "0.6.0")
)
]
),
Struct(
Expand Down Expand Up @@ -2683,8 +2696,9 @@ codegen_language_macros::compile!(Language(
EnumVariant(reference = ExternalKeyword),
EnumVariant(reference = PrivateKeyword),
EnumVariant(reference = PublicKeyword),
EnumVariant(reference = PureKeyword),
EnumVariant(reference = ViewKeyword),
EnumVariant(reference = ConstantKeyword, enabled = Till("0.5.0")),
EnumVariant(reference = PureKeyword, enabled = From("0.4.16")),
EnumVariant(reference = ViewKeyword, enabled = From("0.4.16")),
EnumVariant(reference = PayableKeyword)
]
),
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.

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.

16 changes: 10 additions & 6 deletions crates/solidity/outputs/spec/generated/grammar.ebnf

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 dff1201

Please sign in to comment.