Skip to content

Commit

Permalink
Type expressions and local variable types
Browse files Browse the repository at this point in the history
  • Loading branch information
ggiraldez committed Jun 26, 2024
1 parent 140dfe4 commit f7ba1f4
Show file tree
Hide file tree
Showing 22 changed files with 668 additions and 372 deletions.
23 changes: 22 additions & 1 deletion crates/solidity/inputs/language/bindings/rules.msgb
Original file line number Diff line number Diff line change
Expand Up @@ -327,11 +327,26 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i
;;; Declaration Statements introducing variables
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

@stmt [Statement [VariableDeclarationStatement ... @name name: [Identifier] ...]] {
@stmt [Statement [VariableDeclarationStatement
...
[VariableDeclarationType @var_type [TypeName]]
...
@name name: [Identifier]
...
]] {
node def
attr (def) node_definition = @name

edge @stmt.defs -> def
edge @var_type.type -> @stmt.lexical_scope

;; TODO: this '@typeof' path sounds ok, but think we're still missing some
;; parts to make it work
node typeof
attr (typeof) pop_symbol = "@typeof"

edge def -> typeof
edge typeof -> @var_type.type
}

@stmt [Statement [TupleDeconstructionStatement ... [TupleDeconstructionElements
Expand Down Expand Up @@ -588,3 +603,9 @@ attribute symbol_reference = symbol => type = "push_symbol", symbol = symbol, i
@funcall [Expression [FunctionCallExpression ... @args [ArgumentsDeclaration]]] {
edge @args.lexical_scope -> @funcall.lexical_scope
}

;;; Type expressions

@type_expr [Expression [TypeExpression ... @type [TypeName] ...]] {
edge @type.type -> @type_expr.lexical_scope
}

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
Expand Up @@ -83,93 +83,93 @@ def
line 125 column 8`"/]
N20[\"`**Answer** @(2, 1)
@name.def
line 399 column 14`"/]
line 414 column 14`"/]
N20 --> N24
N20 --> N26
N21[\"`**Respuesta** @(6, 1)
@name.def
line 399 column 14`"/]
line 414 column 14`"/]
N21 --> N28
N21 --> N30
N22[\"`**Repondre** @(10, 1)
@name.def
line 399 column 14`"/]
line 414 column 14`"/]
N22 --> N32
N22 --> N34
N23[\"`**ActionChoices** @(12, 1)
@name.def
line 399 column 14`"/]
line 414 column 14`"/]
N23 --> N36
N23 --> N38
N23 --> N40
N23 --> N42
N24[\"`**.** @(2, 1)
member
line 412 column 8`"/]
line 427 column 8`"/]
N24 --> N25
N25[\"`**Yes** @(2, 1)
def
line 416 column 8`"/]
line 431 column 8`"/]
N26[\"`**.** @(2, 1)
member
line 412 column 8`"/]
line 427 column 8`"/]
N26 --> N27
N27[\"`**No** @(2, 1)
def
line 416 column 8`"/]
line 431 column 8`"/]
N28[\"`**.** @(6, 1)
member
line 412 column 8`"/]
line 427 column 8`"/]
N28 --> N29
N29[\"`**Si** @(6, 1)
def
line 416 column 8`"/]
line 431 column 8`"/]
N30[\"`**.** @(6, 1)
member
line 412 column 8`"/]
line 427 column 8`"/]
N30 --> N31
N31[\"`**No** @(6, 1)
def
line 416 column 8`"/]
line 431 column 8`"/]
N32[\"`**.** @(10, 1)
member
line 412 column 8`"/]
line 427 column 8`"/]
N32 --> N33
N33[\"`**Oui** @(10, 1)
def
line 416 column 8`"/]
line 431 column 8`"/]
N34[\"`**.** @(10, 1)
member
line 412 column 8`"/]
line 427 column 8`"/]
N34 --> N35
N35[\"`**Non** @(10, 1)
def
line 416 column 8`"/]
line 431 column 8`"/]
N36[\"`**.** @(12, 1)
member
line 412 column 8`"/]
line 427 column 8`"/]
N36 --> N37
N37[\"`**GoLeft** @(12, 1)
def
line 416 column 8`"/]
line 431 column 8`"/]
N38[\"`**.** @(12, 1)
member
line 412 column 8`"/]
line 427 column 8`"/]
N38 --> N39
N39[\"`**GoRight** @(12, 1)
def
line 416 column 8`"/]
line 431 column 8`"/]
N40[\"`**.** @(12, 1)
member
line 412 column 8`"/]
line 427 column 8`"/]
N40 --> N41
N41[\"`**GoStraight** @(12, 1)
def
line 416 column 8`"/]
line 431 column 8`"/]
N42[\"`**.** @(12, 1)
member
line 412 column 8`"/]
line 427 column 8`"/]
N42 --> N43
N43[\"`**SitStill** @(12, 1)
def
line 416 column 8`"/]
line 431 column 8`"/]
Original file line number Diff line number Diff line change
Expand Up @@ -184,101 +184,101 @@ line 270 column 14`"]
line 271 column 14`"]
N46[\"`**Answer** @(2, 1)
@name.def
line 399 column 14`"/]
line 414 column 14`"/]
N46 --> N47
N46 --> N49
N47[\"`**.** @(2, 1)
member
line 412 column 8`"/]
line 427 column 8`"/]
N47 --> N48
N48[\"`**Yes** @(2, 1)
def
line 416 column 8`"/]
line 431 column 8`"/]
N49[\"`**.** @(2, 1)
member
line 412 column 8`"/]
line 427 column 8`"/]
N49 --> N50
N50[\"`**No** @(2, 1)
def
line 416 column 8`"/]
line 431 column 8`"/]
N51["`**51** @(8, 1)
@expr.lexical_scope
line 486 column 14`"]
line 501 column 14`"]
N51 --> N42
N52["`**52** @(8, 1)
@expr.type
line 488 column 14`"]
line 503 column 14`"]
N53["`**53** @(8, 1)
@expr.lexical_scope
line 486 column 14`"]
line 501 column 14`"]
N53 --> N51
N54["`**54** @(8, 1)
@expr.type
line 488 column 14`"]
line 503 column 14`"]
N54 --> N63
N55["`**55** @(8, 14)
@expr.lexical_scope
line 486 column 14`"]
line 501 column 14`"]
N55 --> N51
N56["`**56** @(8, 14)
@expr.type
line 488 column 14`"]
line 503 column 14`"]
N57["`**57** @(8, 14)
@expr.lexical_scope
line 486 column 14`"]
line 501 column 14`"]
N57 --> N55
N58["`**58** @(8, 14)
@expr.type
line 488 column 14`"]
line 503 column 14`"]
N58 --> N64
N59["`**59** @(12, 15)
@expr.lexical_scope
line 486 column 14`"]
line 501 column 14`"]
N59 --> N44
N60["`**60** @(12, 15)
@expr.type
line 488 column 14`"]
line 503 column 14`"]
N61["`**61** @(12, 15)
@expr.lexical_scope
line 486 column 14`"]
line 501 column 14`"]
N61 --> N59
N62["`**62** @(12, 15)
@expr.type
line 488 column 14`"]
line 503 column 14`"]
N62 --> N65
N63[/"`**ans** @(8, 1)
@name.ref
line 492 column 14`"\]
line 507 column 14`"\]
N63 --> N53
N64[/"`**Answer** @(8, 14)
@name.ref
line 492 column 14`"\]
line 507 column 14`"\]
N64 --> N57
N65[/"`**Answer** @(12, 15)
@name.ref
line 492 column 14`"\]
line 507 column 14`"\]
N65 --> N61
N66["`**66** @(8, 22)
@member.lexical_scope
line 530 column 16`"]
line 545 column 16`"]
N66 --> N70
N67["`**67** @(12, 23)
@member.lexical_scope
line 530 column 16`"]
line 545 column 16`"]
N67 --> N71
N68[/"`**Yes** @(8, 22)
ref
line 534 column 8`"\]
line 549 column 8`"\]
N68 --> N66
N69[/"`**No** @(12, 23)
ref
line 534 column 8`"\]
line 549 column 8`"\]
N69 --> N67
N70[/"`**.** @(8, 14)
member
line 549 column 8`"\]
line 564 column 8`"\]
N70 --> N58
N71[/"`**.** @(12, 15)
member
line 549 column 8`"\]
line 564 column 8`"\]
N71 --> N62
Loading

0 comments on commit f7ba1f4

Please sign in to comment.