summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-compiler/core
diff options
context:
space:
mode:
authordearblue <[email protected]>2020-01-19 21:42:09 +0900
committerdearblue <[email protected]>2020-01-19 21:42:09 +0900
commit893cc2780cbf866a28a74a98128ffe8eefb20d03 (patch)
treec2e0d9031b09b6754f9faa26ea0a0b8fb98185b4 /mrbgems/mruby-compiler/core
parentf7abda14370e6341dad180da3d04f8f2f4ff0cf0 (diff)
downloadmruby-893cc2780cbf866a28a74a98128ffe8eefb20d03.tar.gz
mruby-893cc2780cbf866a28a74a98128ffe8eefb20d03.zip
Add `mrbc_cleanup_local_variables()` with `mrbc_context`; ref #4931
Clean up defined local variables.
Diffstat (limited to 'mrbgems/mruby-compiler/core')
-rw-r--r--mrbgems/mruby-compiler/core/parse.y10
1 files changed, 10 insertions, 0 deletions
diff --git a/mrbgems/mruby-compiler/core/parse.y b/mrbgems/mruby-compiler/core/parse.y
index 0a5eb2a7b..c35d9e1be 100644
--- a/mrbgems/mruby-compiler/core/parse.y
+++ b/mrbgems/mruby-compiler/core/parse.y
@@ -6303,6 +6303,16 @@ mrbc_partial_hook(mrb_state *mrb, mrbc_context *c, int (*func)(struct mrb_parser
}
MRB_API void
+mrbc_cleanup_local_variables(mrb_state *mrb, mrbc_context *c)
+{
+ if (c->syms) {
+ mrb_free(mrb, c->syms);
+ c->syms = NULL;
+ c->slen = 0;
+ }
+}
+
+MRB_API void
mrb_parser_set_filename(struct mrb_parser_state *p, const char *f)
{
mrb_sym sym;