Skip to content

Commit

Permalink
Adding link from member to type
Browse files Browse the repository at this point in the history
  • Loading branch information
beta-ziliani committed Dec 19, 2024
1 parent 0a578b3 commit 214fce4
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 2 deletions.
10 changes: 9 additions & 1 deletion crates/solidity/inputs/language/bindings/rules.msgb
Original file line number Diff line number Diff line change
Expand Up @@ -2087,13 +2087,21 @@ inherit .star_extension
edge minmax_replace -> @enum.lexical_scope
}

@enum [EnumDefinition
@enum [EnumDefinition @name name: [Identifier]
members: [EnumMembers @item [Identifier]]
] {
node def
attr (def) node_definition = @item
attr (def) definiens_node = @item

node type_of
attr (type_of) push_symbol = "@typeof"
node type_def
attr (type_def) push_symbol = (source-text @name)
edge def -> type_of
edge type_of -> type_def
edge type_def -> @enum.lexical_scope

edge @enum.members -> def
}

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.

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# This file is generated automatically by infrastructure scripts. Please don't edit by hand.

Parse errors:
Error: Expected ContractKeyword or ImportKeyword or InterfaceKeyword or LibraryKeyword or PragmaKeyword.
╭─[input.sol:1:1]
1 │ ╭─▶ enum Answer {
┆ ┆
17 │ ├─▶ }
│ │
│ ╰─────── Error occurred here.
────╯
References and definitions:
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# This file is generated automatically by infrastructure scripts. Please don't edit by hand.

References and definitions:
╭─[input.sol:1:1]
1 │ enum Answer {
│ ───┬──
│ ╰──── def: 1
2 │ Yes
│ ─┬─
│ ╰─── def: 2
5 │ library Id {
│ ─┬
│ ╰── def: 3
6 │ function id(Answer ans) returns (Answer) {
│ ─┬ ───┬── ─┬─ ───┬──
│ ╰────────────────────────────── def: 4
│ │ │ │
│ ╰───────────────────────── ref: 1
│ │ │
│ ╰──────────────────── def: 5
│ │
│ ╰──── ref: 1
7 │ return ans;
│ ─┬─
│ ╰─── ref: 5
11 │ contract Test {
│ ──┬─
│ ╰─── def: 6
12 │ using Id for Answer;
│ ─┬ ───┬──
│ ╰───────────── ref: 3
│ │
│ ╰──── ref: 1
14 │ function testFunc() returns (Answer) {
│ ────┬─── ───┬──
│ ╰─────────────────────── def: 7
│ │
│ ╰──── ref: 1
15 │ Answer.Yes.id();
│ ───┬── ─┬─ ─┬
│ ╰─────────── ref: 1
│ │ │
│ ╰────── ref: 2
│ │
│ ╰── ref: 4
────╯
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
enum Answer {
Yes
}

library Id {
function id(Answer ans) returns (Answer) {
return ans;
}
}

contract Test {
using Id for Answer;

function testFunc() returns (Answer) {
Answer.Yes.id();
}
}

0 comments on commit 214fce4

Please sign in to comment.