Skip to content

Commit

Permalink
Test definiens cursors and verify that all identifiers are bound (#1200)
Browse files Browse the repository at this point in the history
Closes #1191 
Closes #1199 

- Add output of definiens cursors in all bindings snapshots
- Check all `Identifier` and `YulIdentifier` nodes are bound to a
reference or definition (except those under `ExperimentalFeature`) in
snapshots
- Fix missing binding for catch clauses: the identifiers there can only
be `Error` or `Panic`, but they are still parsed as identifiers (maybe
it's better to add them as keywords?). Also added them as error
definitions in built-ins.
- Relax modifier definition rules to bind the name identifier even if
failing to parse the body.
  • Loading branch information
ggiraldez authored Dec 23, 2024
1 parent f257eae commit be24831
Show file tree
Hide file tree
Showing 312 changed files with 10,098 additions and 1,876 deletions.
14 changes: 13 additions & 1 deletion crates/solidity/inputs/language/bindings/rules.msgb
Original file line number Diff line number Diff line change
Expand Up @@ -1606,11 +1606,14 @@ inherit .star_extension

@modifier [ModifierDefinition
@name name: [Identifier]
body: [FunctionBody @body [Block]]
] {
attr (@modifier.def) node_definition = @name
attr (@modifier.def) definiens_node = @modifier
}

@modifier [ModifierDefinition
body: [FunctionBody @body [Block]]
] {
edge @body.lexical_scope -> @modifier.lexical_scope

; Special case: bind the place holder statement `_` to the built-in
Expand Down Expand Up @@ -1939,6 +1942,15 @@ inherit .star_extension
attr (@body.lexical_scope -> @catch_params.defs) precedence = 1
}

@stmt [Statement [TryStatement [CatchClauses [CatchClause
[CatchClauseError @name [Identifier]]
]]]] {
node ref
attr (ref) node_reference = @name

edge ref -> @stmt.lexical_scope
}


;;; Revert statements

Expand Down
12 changes: 12 additions & 0 deletions crates/solidity/inputs/language/src/definition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6920,6 +6920,12 @@ codegen_language_macros::compile!(Language(
functions = [],
enabled = From("0.6.2")
),
BuiltInType(
name = "Error",
fields = [BuiltInField(definition = "string reason")],
functions = [],
enabled = From("0.6.0")
),
BuiltInType(
name = "$ErrorType",
fields = [BuiltInField(definition = "bytes4 selector")],
Expand Down Expand Up @@ -6980,6 +6986,12 @@ codegen_language_macros::compile!(Language(
],
functions = []
),
BuiltInType(
name = "Panic",
fields = [BuiltInField(definition = "uint errorCode")],
functions = [],
enabled = From("0.6.0")
),
BuiltInType(
name = "$StringType",
fields = [],
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.

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.

Loading

0 comments on commit be24831

Please sign in to comment.