diff options
| author | yuri <[email protected]> | 2018-07-10 01:42:33 +0900 |
|---|---|---|
| committer | yuri <[email protected]> | 2018-07-10 01:42:33 +0900 |
| commit | dabb20ddbb51e6dac3bb6a8bac6dfcfd76808ac0 (patch) | |
| tree | 0c2ff85799ce7781324114dc58a6a52b9fe33b4a /mrbgems/mruby-bin-mrbc | |
| parent | 17c9e65603f3e21abc9f383532dbd33666245309 (diff) | |
| download | mruby-dabb20ddbb51e6dac3bb6a8bac6dfcfd76808ac0.tar.gz mruby-dabb20ddbb51e6dac3bb6a8bac6dfcfd76808ac0.zip | |
add mrbc option `--remove-lv`
* refactor: move `irep_remove_lv` from `mruby-bin-strip` gem to src/dump and rename to `mrb_irep_remove_lv`
* add: mrbc option `--remove-lv` to remove LVAR section
Diffstat (limited to 'mrbgems/mruby-bin-mrbc')
| -rw-r--r-- | mrbgems/mruby-bin-mrbc/tools/mrbc/mrbc.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/mrbgems/mruby-bin-mrbc/tools/mrbc/mrbc.c b/mrbgems/mruby-bin-mrbc/tools/mrbc/mrbc.c index 580c2e25b..2fd9da77d 100644 --- a/mrbgems/mruby-bin-mrbc/tools/mrbc/mrbc.c +++ b/mrbgems/mruby-bin-mrbc/tools/mrbc/mrbc.c @@ -18,6 +18,7 @@ struct mrbc_args { const char *initname; mrb_bool check_syntax : 1; mrb_bool verbose : 1; + mrb_bool remove_lv : 1; unsigned int flags : 4; }; @@ -33,6 +34,7 @@ usage(const char *name) "-B<symbol> binary <symbol> output in C language format", "-e generate little endian iseq data", "-E generate big endian iseq data", + "--remove-lv remove local variables", "--verbose run at verbose mode", "--version print the version", "--copyright print the copyright", @@ -142,6 +144,10 @@ parse_args(mrb_state *mrb, int argc, char **argv, struct mrbc_args *args) mrb_show_copyright(mrb); exit(EXIT_SUCCESS); } + else if (strcmp(argv[i] + 2, "remove-lv") == 0) { + args->remove_lv = TRUE; + break; + } return -1; default: return i; @@ -232,6 +238,9 @@ dump_file(mrb_state *mrb, FILE *wfp, const char *outfile, struct RProc *proc, st int n = MRB_DUMP_OK; mrb_irep *irep = proc->body.irep; + if (args->remove_lv) { + mrb_irep_remove_lv(mrb, irep); + } if (args->initname) { n = mrb_dump_irep_cfunc(mrb, irep, args->flags, wfp, args->initname); if (n == MRB_DUMP_INVALID_ARGUMENT) { |
