summaryrefslogtreecommitdiff
path: root/src/parser/parser_stmt.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/parser/parser_stmt.c')
-rw-r--r--src/parser/parser_stmt.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/parser/parser_stmt.c b/src/parser/parser_stmt.c
index 6441161..0c3885a 100644
--- a/src/parser/parser_stmt.c
+++ b/src/parser/parser_stmt.c
@@ -1282,6 +1282,10 @@ ASTNode *parse_for(ParserContext *ctx, Lexer *l)
{
init = parse_var_decl(ctx, l);
}
+ else if (lexer_peek(l).type == TOK_IDENT && strncmp(lexer_peek(l).start, "var", 3) == 0)
+ {
+ zpanic_at(lexer_peek(l), "'var' is deprecated. Use 'let' instead.");
+ }
else
{
init = parse_expression(ctx, l);
@@ -2068,6 +2072,11 @@ ASTNode *parse_statement(ParserContext *ctx, Lexer *l)
return parse_var_decl(ctx, l);
}
+ if (strncmp(tk.start, "var", 3) == 0 && tk.len == 3)
+ {
+ zpanic_at(tk, "'var' is deprecated. Use 'let' instead.");
+ }
+
// Static local variable: static let x = 0;
if (strncmp(tk.start, "static", 6) == 0 && tk.len == 6)
{