From 89f591485b91780c213f459f840111a99adca9d0 Mon Sep 17 00:00:00 2001 From: KOBAYASHI Shuji Date: Wed, 11 Nov 2020 23:59:45 +0900 Subject: Change name and usage of presym macros To be also able to build mruby without presym in the future. However, `MRB_QSYM` has been removed and changed as follows: ### Example | Type | Symbol | Previous Style | New Style | |---------------------------|--------|------------------|----------------| | Operator | & | MRB_QSYM(and) | MRB_OPSYM(and) | | Class Variable | @@foo | MRB_QSYM(00_foo) | MRB_CVSYM(foo) | | Instance Variable | @foo | MRB_QSYM(0_foo) | MRB_IVSYM(foo) | | Method with Bang | foo! | MRB_QSYM(foo_b) | MRB_SYM_B(foo) | | Method with Question mark | foo? | MRB_QSYM(foo_p) | MRB_SYM_Q(foo) | | Mmethod with Equal | foo= | MRB_QSYM(foo_e) | MRB_SYM_E(foo) | This change makes it possible to define, for example, `MRB_IVSYM(foo)` as `mrb_intern_lit(mrb, "@" "foo")`, which is useful if we support building without presym in the future. --- mrbgems/mruby-compiler/core/codegen.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'mrbgems/mruby-compiler/core/codegen.c') diff --git a/mrbgems/mruby-compiler/core/codegen.c b/mrbgems/mruby-compiler/core/codegen.c index be5231162..34ccb6f86 100644 --- a/mrbgems/mruby-compiler/core/codegen.c +++ b/mrbgems/mruby-compiler/core/codegen.c @@ -1649,7 +1649,7 @@ codegen(codegen_scope *s, node *tree, int val) { node *n = tree->car->cdr; mrb_sym mid = nsym(n->cdr->car); - mrb_sym mnil = MRB_QSYM(nil_p); + mrb_sym mnil = MRB_SYM_Q(nil); if (mid == mnil && n->cdr->cdr->car == NULL) { nil_p = TRUE; codegen(s, n->car, VAL); @@ -1788,7 +1788,7 @@ codegen(codegen_scope *s, node *tree, int val) genop_3(s, OP_SEND, cursp(), new_sym(s, MRB_SYM(__case_eqq)), 1); } else { - genop_3(s, OP_SEND, cursp(), new_sym(s, MRB_QSYM(eqq)), 1); + genop_3(s, OP_SEND, cursp(), new_sym(s, MRB_OPSYM(eqq)), 1); } } else { @@ -2576,7 +2576,7 @@ codegen(codegen_scope *s, node *tree, int val) default: if (val) { - int sym = new_sym(s, MRB_QSYM(minus)); + int sym = new_sym(s, MRB_OPSYM(minus)); codegen(s, tree, VAL); pop(); genop_3(s, OP_SEND, cursp(), sym, 0); @@ -2668,7 +2668,7 @@ codegen(codegen_scope *s, node *tree, int val) } push(); /* for block */ pop_n(3); - sym = new_sym(s, MRB_QSYM(tick)); /* ` */ + sym = new_sym(s, MRB_OPSYM(tick)); /* ` */ genop_3(s, OP_SEND, cursp(), sym, 1); if (val) push(); mrb_gc_arena_restore(s->mrb, ai); @@ -2688,7 +2688,7 @@ codegen(codegen_scope *s, node *tree, int val) genop_bs(s, OP_STRING, cursp(), off); push(); push(); pop_n(3); - sym = new_sym(s, MRB_QSYM(tick)); /* ` */ + sym = new_sym(s, MRB_OPSYM(tick)); /* ` */ genop_3(s, OP_SEND, cursp(), sym, 1); if (val) push(); mrb_gc_arena_restore(s->mrb, ai); -- cgit v1.2.3