diff options
| author | nsfisis <nsfisis@gmail.com> | 2025-05-04 14:22:39 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2025-05-04 14:22:39 +0900 |
| commit | 9a35c86da5a81d9e83f7729f1ada8a5bf5934014 (patch) | |
| tree | 7695d7eed5f776b0a15b8509b4bd5f683cb5fdea /main.c | |
| parent | 8a323fe3f7a964040c085a67cc8868f07b63bb6a (diff) | |
| download | P4Dcc-9a35c86da5a81d9e83f7729f1ada8a5bf5934014.tar.gz P4Dcc-9a35c86da5a81d9e83f7729f1ada8a5bf5934014.tar.zst P4Dcc-9a35c86da5a81d9e83f7729f1ada8a5bf5934014.zip | |
refactor
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -302,7 +302,7 @@ typedef struct AstNode { struct AstNode* expr2; struct AstNode* expr3; int op; - TYPE* var_ty; + TYPE* ty; int var_index; struct AstNode* node1; struct AstNode* node2; @@ -676,7 +676,7 @@ AST* parse_var_decl(PARSER* p) { char* name = parse_ident(p); AST* decl = ast_new(AST_VAR_DECL); expect(p, TK_SEMICOLON); - decl->var_ty = ty; + decl->ty = ty; decl->name = name; if (parse_find_lvar(p, name) != -1) { @@ -749,7 +749,7 @@ AST* parse_param(PARSER* p) { TYPE* ty = parse_type(p); char* name = parse_ident(p); AST* param = ast_new(AST_PARAM); - param->var_ty = ty; + param->ty = ty; param->name = name; return param; } @@ -784,6 +784,7 @@ AST* parse_func_decl_or_def(PARSER* p) { parse_register_params(p, params); AST* body = parse_block_stmt(p); AST* func = ast_new(AST_FUNC_DEF); + func->ty = ty; func->name = name->value; func->func_params = params; func->func_body = body; |
