feat: const 编译期常量 — const N = 42;

Token(77): +TOK_CONST, AST_LET_STMT 新增 is_const, Symbol 新增 const_value
sema: 字面量初始化自动折叠为编译期常量值

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-06-07 14:26:59 +08:00
parent f7710ede9d
commit 0a0667776a
8 changed files with 19 additions and 8 deletions
+1
View File
@@ -67,6 +67,7 @@ AstNode* ast_make_let(void* alloc, const char* name, TypeKind annot_type, bool h
NEW(alloc, AST_LET_STMT);
n->as.let_stmt.name = name; n->as.let_stmt.annot_type = annot_type;
n->as.let_stmt.has_type_annot = has_type_annot; n->as.let_stmt.is_mut = is_mut;
n->as.let_stmt.is_const = false;
n->as.let_stmt.init = init;
n->as.let_stmt.struct_type_name = struct_type_name;
n->as.let_stmt.annot_element_type = annot_elem_type;