From d1751891930eb8aff1025dc021759527864ceedc Mon Sep 17 00:00:00 2001 From: mxr <> Date: Wed, 25 Mar 2026 19:35:05 +0800 Subject: [PATCH] =?UTF-8?q?fix(sem)=E4=BF=AE=E6=AD=A3=E4=B8=8A=E4=B8=80?= =?UTF-8?q?=E6=AC=A1=E6=8F=90=E4=BA=A4=E7=9A=84=E8=AF=AD=E6=B3=95=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/sem/SymbolTable.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/sem/SymbolTable.cpp b/src/sem/SymbolTable.cpp index bd33f48..421f9d4 100644 --- a/src/sem/SymbolTable.cpp +++ b/src/sem/SymbolTable.cpp @@ -208,7 +208,7 @@ void SymbolTable::registerBuiltinFunctions() { Symbol getint; getint.name = "getint"; getint.kind = SymbolKind::Function; - getint.type = Type::GetFunctionType(Type::GetInt32Type(), {}); // 无参数 + getint.type = ir::Type::GetFunctionType(ir::Type::GetInt32Type(), {}); // 无参数 getint.param_types = {}; getint.scope_level = 0; getint.is_builtin = true; @@ -218,7 +218,7 @@ void SymbolTable::registerBuiltinFunctions() { Symbol getfloat; getfloat.name = "getfloat"; getfloat.kind = SymbolKind::Function; - getfloat.type = Type::GetFunctionType(Type::GetFloatType(), {}); + getfloat.type = ir::Type::GetFunctionType(ir::Type::GetFloatType(), {}); getfloat.param_types = {}; getfloat.scope_level = 0; getfloat.is_builtin = true; @@ -228,40 +228,40 @@ void SymbolTable::registerBuiltinFunctions() { Symbol getch; getch.name = "getch"; getch.kind = SymbolKind::Function; - getch.type = Type::GetFunctionType(Type::GetInt32Type(), {}); + getch.type = ir::Type::GetFunctionType(ir::Type::GetInt32Type(), {}); getch.param_types = {}; getch.scope_level = 0; getch.is_builtin = true; addSymbol(getch); // 4. putint: void putint(int) - std::vector> putint_params = { Type::GetInt32Type() }; + std::vector> putint_params = { ir::Type::GetInt32Type() }; Symbol putint; putint.name = "putint"; putint.kind = SymbolKind::Function; - putint.type = Type::GetFunctionType(Type::GetVoidType(), putint_params); + putint.type = ir::Type::GetFunctionType(ir::Type::GetVoidType(), putint_params); putint.param_types = putint_params; putint.scope_level = 0; putint.is_builtin = true; addSymbol(putint); // 5. putfloat: void putfloat(float) - std::vector> putfloat_params = { Type::GetFloatType() }; + std::vector> putfloat_params = { ir::Type::GetFloatType() }; Symbol putfloat; putfloat.name = "putfloat"; putfloat.kind = SymbolKind::Function; - putfloat.type = Type::GetFunctionType(Type::GetVoidType(), putfloat_params); + putfloat.type = ir::Type::GetFunctionType(ir::Type::GetVoidType(), putfloat_params); putfloat.param_types = putfloat_params; putfloat.scope_level = 0; putfloat.is_builtin = true; addSymbol(putfloat); // 6. putch: void putch(int) - std::vector> putch_params = { Type::GetInt32Type() }; + std::vector> putch_params = { ir::Type::GetInt32Type() }; Symbol putch; putch.name = "putch"; putch.kind = SymbolKind::Function; - putch.type = Type::GetFunctionType(Type::GetVoidType(), putch_params); + putch.type = ir::Type::GetFunctionType(ir::Type::GetVoidType(), putch_params); putch.param_types = putch_params; putch.scope_level = 0; putch.is_builtin = true; @@ -269,11 +269,11 @@ void SymbolTable::registerBuiltinFunctions() { // 7. getarray: int getarray(int a[]) // 参数类型: int a[] 退化为 int* 即 PtrInt32 - std::vector> getarray_params = { Type::GetPtrInt32Type() }; + std::vector> getarray_params = { ir::Type::GetPtrInt32Type() }; Symbol getarray; getarray.name = "getarray"; getarray.kind = SymbolKind::Function; - getarray.type = Type::GetFunctionType(Type::GetInt32Type(), getarray_params); + getarray.type = ir::Type::GetFunctionType(ir::Type::GetInt32Type(), getarray_params); getarray.param_types = getarray_params; getarray.scope_level = 0; getarray.is_builtin = true; @@ -281,11 +281,11 @@ void SymbolTable::registerBuiltinFunctions() { // 8. putarray: void putarray(int n, int a[]) // 参数: int n, int a[] -> 实际类型: int, int* - std::vector> putarray_params = { Type::GetInt32Type(), Type::GetPtrInt32Type() }; + std::vector> putarray_params = { ir::Type::GetInt32Type(), ir::Type::GetPtrInt32Type() }; Symbol putarray; putarray.name = "putarray"; putarray.kind = SymbolKind::Function; - putarray.type = Type::GetFunctionType(Type::GetVoidType(), putarray_params); + putarray.type = ir::Type::GetFunctionType(ir::Type::GetVoidType(), putarray_params); putarray.param_types = putarray_params; putarray.scope_level = 0; putarray.is_builtin = true;