-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Parsing attribute calls with generic args.
- Loading branch information
Showing
5 changed files
with
235 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
crates/parser/tests/cases/snapshots/cases__parse_ast__expr_call3.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
--- | ||
source: crates/parser/tests/cases/parse_ast.rs | ||
expression: "ast_string(stringify!(expr_call3), expressions::parse_expr,\n \"bing.foo<Bar>(x:3)\")" | ||
|
||
--- | ||
Node( | ||
kind: Call( | ||
func: Node( | ||
kind: Attribute( | ||
value: Node( | ||
kind: Name("bing"), | ||
span: Span( | ||
start: 0, | ||
end: 4, | ||
), | ||
), | ||
attr: Node( | ||
kind: "foo", | ||
span: Span( | ||
start: 5, | ||
end: 8, | ||
), | ||
), | ||
), | ||
span: Span( | ||
start: 0, | ||
end: 8, | ||
), | ||
), | ||
generic_args: Some(Node( | ||
kind: [ | ||
TypeDesc(Node( | ||
kind: Base( | ||
base: "Bar", | ||
), | ||
span: Span( | ||
start: 9, | ||
end: 12, | ||
), | ||
)), | ||
], | ||
span: Span( | ||
start: 8, | ||
end: 13, | ||
), | ||
)), | ||
args: Node( | ||
kind: [ | ||
Node( | ||
kind: CallArg( | ||
label: Some(Node( | ||
kind: "x", | ||
span: Span( | ||
start: 14, | ||
end: 15, | ||
), | ||
)), | ||
value: Node( | ||
kind: Num("3"), | ||
span: Span( | ||
start: 16, | ||
end: 17, | ||
), | ||
), | ||
), | ||
span: Span( | ||
start: 14, | ||
end: 17, | ||
), | ||
), | ||
], | ||
span: Span( | ||
start: 13, | ||
end: 18, | ||
), | ||
), | ||
), | ||
span: Span( | ||
start: 0, | ||
end: 18, | ||
), | ||
) |
116 changes: 116 additions & 0 deletions
116
crates/parser/tests/cases/snapshots/cases__parse_ast__expr_call4.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
--- | ||
source: crates/parser/tests/cases/parse_ast.rs | ||
expression: "ast_string(stringify!(expr_call4), expressions::parse_expr,\n \"bang.bing.foo<Bar, Baz>(26, 42)\")" | ||
|
||
--- | ||
Node( | ||
kind: Call( | ||
func: Node( | ||
kind: Attribute( | ||
value: Node( | ||
kind: Attribute( | ||
value: Node( | ||
kind: Name("bang"), | ||
span: Span( | ||
start: 0, | ||
end: 4, | ||
), | ||
), | ||
attr: Node( | ||
kind: "bing", | ||
span: Span( | ||
start: 5, | ||
end: 9, | ||
), | ||
), | ||
), | ||
span: Span( | ||
start: 0, | ||
end: 9, | ||
), | ||
), | ||
attr: Node( | ||
kind: "foo", | ||
span: Span( | ||
start: 10, | ||
end: 13, | ||
), | ||
), | ||
), | ||
span: Span( | ||
start: 0, | ||
end: 13, | ||
), | ||
), | ||
generic_args: Some(Node( | ||
kind: [ | ||
TypeDesc(Node( | ||
kind: Base( | ||
base: "Bar", | ||
), | ||
span: Span( | ||
start: 14, | ||
end: 17, | ||
), | ||
)), | ||
TypeDesc(Node( | ||
kind: Base( | ||
base: "Baz", | ||
), | ||
span: Span( | ||
start: 19, | ||
end: 22, | ||
), | ||
)), | ||
], | ||
span: Span( | ||
start: 13, | ||
end: 23, | ||
), | ||
)), | ||
args: Node( | ||
kind: [ | ||
Node( | ||
kind: CallArg( | ||
label: None, | ||
value: Node( | ||
kind: Num("26"), | ||
span: Span( | ||
start: 24, | ||
end: 26, | ||
), | ||
), | ||
), | ||
span: Span( | ||
start: 24, | ||
end: 26, | ||
), | ||
), | ||
Node( | ||
kind: CallArg( | ||
label: None, | ||
value: Node( | ||
kind: Num("42"), | ||
span: Span( | ||
start: 28, | ||
end: 30, | ||
), | ||
), | ||
), | ||
span: Span( | ||
start: 28, | ||
end: 30, | ||
), | ||
), | ||
], | ||
span: Span( | ||
start: 23, | ||
end: 31, | ||
), | ||
), | ||
), | ||
span: Span( | ||
start: 0, | ||
end: 31, | ||
), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Added support for parsing of attribute calls with generic arguments (e.g. `foo.bar<Baz>()`). |