diff options
author | Jo-Philipp Wich <jo@mein.io> | 2021-05-26 07:40:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-26 07:40:21 +0200 |
commit | daef8b35f421c5481116c27fa5132881549a76a6 (patch) | |
tree | 02084ca6771d425cef509d0a5504a5591dcdb7fd /compiler.c | |
parent | c706eb101934ec05a1aa0fa75ab79f8b1ba405e8 (diff) | |
parent | 9874562545d93582a75bc2e6d58fc772e981a3ba (diff) |
Merge pull request #14 from jow-/refactor
Refactoring & raw code mode support
Diffstat (limited to 'compiler.c')
-rw-r--r-- | compiler.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -60,7 +60,8 @@ uc_compiler_parse_rules[TK_ERROR + 1] = { [TK_NUMBER] = { uc_compiler_compile_constant, NULL, P_NONE }, [TK_DOUBLE] = { uc_compiler_compile_constant, NULL, P_NONE }, [TK_STRING] = { uc_compiler_compile_constant, NULL, P_NONE }, - [TK_BOOL] = { uc_compiler_compile_constant, NULL, P_NONE }, + [TK_TRUE] = { uc_compiler_compile_constant, NULL, P_NONE }, + [TK_FALSE] = { uc_compiler_compile_constant, NULL, P_NONE }, [TK_NULL] = { uc_compiler_compile_constant, NULL, P_NONE }, [TK_THIS] = { uc_compiler_compile_constant, NULL, P_NONE }, [TK_REGEXP] = { uc_compiler_compile_constant, NULL, P_NONE }, @@ -1455,9 +1456,12 @@ uc_compiler_compile_constant(uc_compiler *compiler, bool assignable) uc_compiler_emit_insn(compiler, compiler->parser->prev.pos, I_LNULL); break; - case TK_BOOL: - uc_compiler_emit_insn(compiler, compiler->parser->prev.pos, - ucv_boolean_get(compiler->parser->prev.uv) ? I_LTRUE : I_LFALSE); + case TK_TRUE: + uc_compiler_emit_insn(compiler, compiler->parser->prev.pos, I_LTRUE); + break; + + case TK_FALSE: + uc_compiler_emit_insn(compiler, compiler->parser->prev.pos, I_LFALSE); break; case TK_STRING: |