aboutsummaryrefslogtreecommitdiff
path: root/crates/libsyntax2
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-09-03 00:01:43 +0100
committerAleksey Kladov <[email protected]>2018-09-03 00:01:43 +0100
commit58480b9190d8851abf7f634820188e33efed286d (patch)
tree61d272628c9689071e4ea6bf5b49d0ed0f5e5789 /crates/libsyntax2
parentfdd282ee0c7c627120bbcd7b78c0c6b7acb3556f (diff)
method call scope
Diffstat (limited to 'crates/libsyntax2')
-rw-r--r--crates/libsyntax2/src/ast/generated.rs10
-rw-r--r--crates/libsyntax2/src/ast/mod.rs6
-rw-r--r--crates/libsyntax2/src/grammar.ron8
3 files changed, 18 insertions, 6 deletions
diff --git a/crates/libsyntax2/src/ast/generated.rs b/crates/libsyntax2/src/ast/generated.rs
index bdee635ae..11306a835 100644
--- a/crates/libsyntax2/src/ast/generated.rs
+++ b/crates/libsyntax2/src/ast/generated.rs
@@ -200,12 +200,10 @@ impl<'a> AstNode<'a> for CallExpr<'a> {
200 fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } 200 fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax }
201} 201}
202 202
203impl<'a> ast::ArgListOwner<'a> for CallExpr<'a> {}
203impl<'a> CallExpr<'a> {pub fn expr(self) -> Option<Expr<'a>> { 204impl<'a> CallExpr<'a> {pub fn expr(self) -> Option<Expr<'a>> {
204 super::child_opt(self) 205 super::child_opt(self)
205 } 206 }
206pub fn arg_list(self) -> Option<ArgList<'a>> {
207 super::child_opt(self)
208 }
209} 207}
210 208
211// CastExpr 209// CastExpr
@@ -934,7 +932,11 @@ impl<'a> AstNode<'a> for MethodCallExpr<'a> {
934 fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } 932 fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax }
935} 933}
936 934
937impl<'a> MethodCallExpr<'a> {} 935impl<'a> ast::ArgListOwner<'a> for MethodCallExpr<'a> {}
936impl<'a> MethodCallExpr<'a> {pub fn expr(self) -> Option<Expr<'a>> {
937 super::child_opt(self)
938 }
939}
938 940
939// Module 941// Module
940#[derive(Debug, Clone, Copy)] 942#[derive(Debug, Clone, Copy)]
diff --git a/crates/libsyntax2/src/ast/mod.rs b/crates/libsyntax2/src/ast/mod.rs
index 49e283f5e..274996171 100644
--- a/crates/libsyntax2/src/ast/mod.rs
+++ b/crates/libsyntax2/src/ast/mod.rs
@@ -26,6 +26,12 @@ pub trait LoopBodyOwner<'a>: AstNode<'a> {
26 } 26 }
27} 27}
28 28
29pub trait ArgListOwner<'a>: AstNode<'a> {
30 fn arg_list(self) -> Option<ArgList<'a>> {
31 child_opt(self)
32 }
33}
34
29pub trait TypeParamsOwner<'a>: AstNode<'a> { 35pub trait TypeParamsOwner<'a>: AstNode<'a> {
30 fn type_param_list(self) -> Option<TypeParamList<'a>> { 36 fn type_param_list(self) -> Option<TypeParamList<'a>> {
31 child_opt(self) 37 child_opt(self)
diff --git a/crates/libsyntax2/src/grammar.ron b/crates/libsyntax2/src/grammar.ron
index 798725f7e..683623a5d 100644
--- a/crates/libsyntax2/src/grammar.ron
+++ b/crates/libsyntax2/src/grammar.ron
@@ -388,10 +388,14 @@ Grammar(
388 "NamedFieldList": (), 388 "NamedFieldList": (),
389 "NamedField": (), 389 "NamedField": (),
390 "CallExpr": ( 390 "CallExpr": (
391 options: [ "Expr", "ArgList" ] 391 traits: ["ArgListOwner"],
392 options: [ "Expr" ],
393 ),
394 "MethodCallExpr": (
395 traits: ["ArgListOwner"],
396 options: [ "Expr" ],
392 ), 397 ),
393 "IndexExpr": (), 398 "IndexExpr": (),
394 "MethodCallExpr": (),
395 "FieldExpr": (), 399 "FieldExpr": (),
396 "TryExpr": (), 400 "TryExpr": (),
397 "CastExpr": (), 401 "CastExpr": (),