From 5714705aee31a0d561b4cf1b8096bbe19e17a825 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Tue, 18 May 2021 14:18:04 +0200 Subject: syntax: introduce `const` support Introduce support for declaring constant variables through the `const` keyword. Variables declared with `const` follow the same scoping rules as `let` declared ones. In contrast to normal variables, `const` ones may not be assigned to after their declaration. Any attempt to do so will result in a syntax error during compilation. Signed-off-by: Jo-Philipp Wich --- compiler.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'compiler.h') diff --git a/compiler.h b/compiler.h index deec3d5..54f56c2 100644 --- a/compiler.h +++ b/compiler.h @@ -76,12 +76,14 @@ typedef struct { ssize_t depth; size_t from; bool captured; + bool constant; } uc_local; typedef struct { uc_value_t *name; size_t index; bool local; + bool constant; } uc_upval; uc_declare_vector(uc_locals, uc_local); -- cgit v1.2.3