diff --git a/src/ast.rs b/src/ast.rs index ec75403..14faee3 100644 --- a/src/ast.rs +++ b/src/ast.rs @@ -138,7 +138,7 @@ pub struct VariableExpr { #[derive(Debug, Clone)] pub struct SuperExpr { /// The 'super' token itself - pub keyword: Token, + pub keyword: VariableExpr, /// The identifier that contains the method name pub method: Token, } diff --git a/src/parser.rs b/src/parser.rs index 44caba7..143101f 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -753,7 +753,10 @@ impl Parser { self.consume(&TokenType::Dot, "expected '.' after 'super'")?; let identifier = self.consume_identifier("expected method name")?; Ok(ExprNode::Super(SuperExpr { - keyword: super_token, + keyword: VariableExpr { + token: super_token, + id: self.make_id(), + }, method: identifier, })) } else if self.expect(&[TokenType::Fun]).is_some() {