diff options
author | A404M <ahmadmahmoudiprogrammer@gmail.com> | 2025-05-18 10:16:09 +0330 |
---|---|---|
committer | A404M <ahmadmahmoudiprogrammer@gmail.com> | 2025-05-18 10:16:09 +0330 |
commit | 0b85ea4a7b64ed583aaf0e323252c5f792c042a2 (patch) | |
tree | 1104f435ec7c93ac3489aa91536789da085c7bae /src/runner/runner.c | |
parent | cfc5418931fa15e6a31583820266bf35d489da88 (diff) |
replaced putc with @putc()
Diffstat (limited to 'src/runner/runner.c')
-rw-r--r-- | src/runner/runner.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/runner/runner.c b/src/runner/runner.c index 67fc02e..e4578ec 100644 --- a/src/runner/runner.c +++ b/src/runner/runner.c @@ -1040,6 +1040,10 @@ AstTree *runAstTreeBuiltin(AstTree *tree, AstTreeScope *scope, } return ret; } + case AST_TREE_TOKEN_BUILTIN_PUTC: { + putchar((u8) * (AstTreeInt *)arguments[0]->metadata); + return copyAstTree(&AST_TREE_VOID_VALUE); + } case AST_TREE_TOKEN_BUILTIN_IMPORT: default: } @@ -1050,17 +1054,6 @@ AstTree *runExpression(AstTree *expr, AstTreeScope *scope, bool *shouldRet, bool isLeft, bool isComptime, u32 *breakCount, bool *shouldContinue) { switch (expr->token) { - case AST_TREE_TOKEN_KEYWORD_PUTC: { - AstTreeSingleChild *metadata = expr->metadata; - AstTree *tree = runExpression(metadata, scope, shouldRet, false, isComptime, - breakCount, shouldContinue); - if (discontinue(*shouldRet, *breakCount)) { - return tree; - } - putchar((u8) * (AstTreeInt *)tree->metadata); - astTreeDelete(tree); - return &AST_TREE_VOID_VALUE; - } case AST_TREE_TOKEN_FUNCTION_CALL: { AstTreeFunctionCall *metadata = expr->metadata; AstTree *function = @@ -1374,6 +1367,7 @@ AstTree *runExpression(AstTree *expr, AstTreeScope *scope, bool *shouldRet, case AST_TREE_TOKEN_BUILTIN_SMALLER: case AST_TREE_TOKEN_BUILTIN_GREATER_OR_EQUAL: case AST_TREE_TOKEN_BUILTIN_SMALLER_OR_EQUAL: + case AST_TREE_TOKEN_BUILTIN_PUTC: return copyAstTree(expr); case AST_TREE_TOKEN_BUILTIN_IS_COMPTIME: { AstTreeBool *metadata = a404m_malloc(sizeof(*metadata)); |