summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-compiler/core/parse.y
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2021-09-27 10:10:35 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2021-09-27 10:10:35 +0900
commit906f9f2ba752c53162bf4bab6264b78a38f05fd8 (patch)
tree9948443e0ace018b4b0bf35cdd0650810d8f18a6 /mrbgems/mruby-compiler/core/parse.y
parent368e8ce3d5fc117081316aefa25a40b3b1f7a5a9 (diff)
downloadmruby-906f9f2ba752c53162bf4bab6264b78a38f05fd8.tar.gz
mruby-906f9f2ba752c53162bf4bab6264b78a38f05fd8.zip
parse.y: `__ENCODING__` should be determined in run-time; fix #5552
It used to be compiled to the static string in the compiler. But the encoding status actually depends on the runtime configuration. A new method `Kernel#__ENCODING__` is introduced to implement the feature.
Diffstat (limited to 'mrbgems/mruby-compiler/core/parse.y')
-rw-r--r--mrbgems/mruby-compiler/core/parse.y7
1 files changed, 1 insertions, 6 deletions
diff --git a/mrbgems/mruby-compiler/core/parse.y b/mrbgems/mruby-compiler/core/parse.y
index 637b04749..60cfeadae 100644
--- a/mrbgems/mruby-compiler/core/parse.y
+++ b/mrbgems/mruby-compiler/core/parse.y
@@ -3587,12 +3587,7 @@ var_ref : variable
}
| keyword__ENCODING__
{
-#ifdef MRB_UTF8_STRING
- const char *enc = "UTF-8";
-#else
- const char *enc = "ASCII-8BIT";
-#endif
- $$ = new_str(p, enc, strlen(enc));
+ $$ = new_fcall(p, MRB_SYM_2(p->mrb, __ENCODING__), 0);
}
;