Browse Source

LibJS: Disallow standalone super expression

davidot 3 năm trước cách đây
mục cha
commit
4d6502de42
1 tập tin đã thay đổi với 3 bổ sung0 xóa
  1. 3 0
      Userland/Libraries/LibJS/Parser.cpp

+ 3 - 0
Userland/Libraries/LibJS/Parser.cpp

@@ -1297,6 +1297,9 @@ NonnullRefPtr<Expression> Parser::parse_expression(int min_precedence, Associati
         }
     }
 
+    if (is<SuperExpression>(*expression))
+        syntax_error("'super' keyword unexpected here");
+
     check_for_invalid_object_property(expression);
 
     if (match(TokenType::Comma) && min_precedence <= 1) {