From 45ffa5cdabe84348d3894571a96813e5a65d7ec2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= <tseeker@nocternity.net>
Date: Mon, 16 Jan 2023 07:31:54 +0100
Subject: [PATCH] AST - Represent the "super" keyword as a VariableExpr

---
 src/ast.rs    | 2 +-
 src/parser.rs | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

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() {