diff options
| author | Laurenz <laurmaedje@gmail.com> | 2023-01-28 18:32:58 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2023-01-28 18:32:58 +0100 |
| commit | 406de22ee5cd74dc6f67743bad4710415bb50c41 (patch) | |
| tree | 37536600378cd325956201ea175469bc22db2b1a /src/syntax/ast.rs | |
| parent | 2d56e3c5e245bf8824bf0ea8f1f1a05cb9716dc5 (diff) | |
Remove method call syntax kind
Diffstat (limited to 'src/syntax/ast.rs')
| -rw-r--r-- | src/syntax/ast.rs | 31 |
1 files changed, 2 insertions, 29 deletions
diff --git a/src/syntax/ast.rs b/src/syntax/ast.rs index 5704f171..78d895ff 100644 --- a/src/syntax/ast.rs +++ b/src/syntax/ast.rs @@ -157,10 +157,8 @@ pub enum Expr { Binary(Binary), /// A field access: `properties.age`. FieldAccess(FieldAccess), - /// An invocation of a function: `f(x, y)`. + /// An invocation of a function or method: `f(x, y)`. FuncCall(FuncCall), - /// An invocation of a method: `array.push(v)`. - MethodCall(MethodCall), /// A closure: `(x, y) => z`. Closure(Closure), /// A let binding: `let x = 1`. @@ -239,7 +237,6 @@ impl AstNode for Expr { SyntaxKind::Binary => node.cast().map(Self::Binary), SyntaxKind::FieldAccess => node.cast().map(Self::FieldAccess), SyntaxKind::FuncCall => node.cast().map(Self::FuncCall), - SyntaxKind::MethodCall => node.cast().map(Self::MethodCall), SyntaxKind::Closure => node.cast().map(Self::Closure), SyntaxKind::LetBinding => node.cast().map(Self::Let), SyntaxKind::SetRule => node.cast().map(Self::Set), @@ -299,7 +296,6 @@ impl AstNode for Expr { Self::Binary(v) => v.as_untyped(), Self::FieldAccess(v) => v.as_untyped(), Self::FuncCall(v) => v.as_untyped(), - Self::MethodCall(v) => v.as_untyped(), Self::Closure(v) => v.as_untyped(), Self::Let(v) => v.as_untyped(), Self::Set(v) => v.as_untyped(), @@ -335,7 +331,6 @@ impl Expr { Self::Parenthesized(_) => true, Self::FieldAccess(_) => true, Self::FuncCall(_) => true, - Self::MethodCall(_) => true, Self::Let(_) => true, Self::Set(_) => true, Self::Show(_) => true, @@ -1403,7 +1398,7 @@ impl FieldAccess { } node! { - /// An invocation of a function: `f(x, y)`. + /// An invocation of a function or method: `f(x, y)`. FuncCall } @@ -1420,28 +1415,6 @@ impl FuncCall { } node! { - /// An invocation of a method: `array.push(v)`. - MethodCall -} - -impl MethodCall { - /// The expression to call the method on. - pub fn target(&self) -> Expr { - self.0.cast_first_match().unwrap_or_default() - } - - /// The name of the method. - pub fn method(&self) -> Ident { - self.0.cast_last_match().unwrap_or_default() - } - - /// The arguments to the method. - pub fn args(&self) -> Args { - self.0.cast_last_match().unwrap_or_default() - } -} - -node! { /// A function call's argument list: `(12pt, y)`. Args } |
