diff options
| author | dearblue <[email protected]> | 2020-01-19 21:48:15 +0900 |
|---|---|---|
| committer | dearblue <[email protected]> | 2020-01-19 21:59:47 +0900 |
| commit | 25d9370f97d204524a200594faa2bb0adee0e23a (patch) | |
| tree | f5b22ea6fa19462f11d20fc59941e78a1902c7f0 | |
| parent | 2bab6e197de0d6903e3cb2642af83ff277e133fb (diff) | |
| download | mruby-25d9370f97d204524a200594faa2bb0adee0e23a.tar.gz mruby-25d9370f97d204524a200594faa2bb0adee0e23a.zip | |
Fix take over file scope variable names with `mirb` command
Ref #4931
With this change, the `_` variable is defined after the `-r` switch.
| -rw-r--r-- | mrbgems/mruby-bin-mirb/tools/mirb/mirb.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/mrbgems/mruby-bin-mirb/tools/mirb/mirb.c b/mrbgems/mruby-bin-mirb/tools/mirb/mirb.c index ac6276dc2..e54a520f3 100644 --- a/mrbgems/mruby-bin-mirb/tools/mirb/mirb.c +++ b/mrbgems/mruby-bin-mirb/tools/mirb/mirb.c @@ -491,10 +491,6 @@ main(int argc, char **argv) cxt = mrbc_context_new(mrb); -#ifndef DISABLE_MIRB_UNDERSCORE - decl_lv_underscore(mrb, cxt); -#endif - /* Load libraries */ for (i = 0; i < args.libc; i++) { FILE *lfp = fopen(args.libv[i], "r"); @@ -505,8 +501,13 @@ main(int argc, char **argv) } mrb_load_file_cxt(mrb, lfp, cxt); fclose(lfp); + mrbc_cleanup_local_variables(mrb, cxt); } +#ifndef DISABLE_MIRB_UNDERSCORE + decl_lv_underscore(mrb, cxt); +#endif + cxt->capture_errors = TRUE; cxt->lineno = 1; mrbc_filename(mrb, cxt, "(mirb)"); |
