AST - Represent the "super" keyword as a VariableExpr
This commit is contained in:
parent
1a39e40325
commit
45ffa5cdab
2 changed files with 5 additions and 2 deletions
|
@ -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,
|
||||
}
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Reference in a new issue