summaryrefslogtreecommitdiff
path: root/mini_builtin.c
diff options
context:
space:
mode:
Diffstat (limited to 'mini_builtin.c')
-rw-r--r--mini_builtin.c31
1 files changed, 26 insertions, 5 deletions
diff --git a/mini_builtin.c b/mini_builtin.c
index b9be7c58f8..75ea94d37d 100644
--- a/mini_builtin.c
+++ b/mini_builtin.c
@@ -1,5 +1,6 @@
#include "internal.h"
#include "internal/array.h"
+#include "internal/eval.h"
#include "iseq.h"
#include "vm_core.h"
#include "builtin.h"
@@ -22,7 +23,8 @@ prelude_ast_value(VALUE name, VALUE code, int line)
static void
pm_prelude_load(pm_parse_result_t *result, VALUE name, VALUE code, int line)
{
- pm_options_line_set(&result->options, line);
+ pm_parse_result_init(result);
+ pm_options_line_set(result->options, line);
VALUE error = pm_parse_string(result, code, name, NULL);
if (!NIL_P(error)) {
@@ -58,15 +60,21 @@ builtin_iseq_load(const char *feature_name, const struct rb_builtin_function *ta
.debug_level = 0,
};
- if (*rb_ruby_prism_ptr()) {
- pm_parse_result_t result = { 0 };
+ if (rb_ruby_prism_p()) {
+ pm_parse_result_t result;
pm_prelude_load(&result, name_str, code, start_line);
vm->builtin_function_table = table;
- iseq = pm_iseq_new_with_opt(&result.node, name_str, name_str, Qnil, 0, NULL, 0, ISEQ_TYPE_TOP, &optimization);
+ int error_state;
+ iseq = pm_iseq_new_with_opt(&result.node, name_str, name_str, Qnil, 0, NULL, 0, ISEQ_TYPE_TOP, &optimization, &error_state);
vm->builtin_function_table = NULL;
pm_parse_result_free(&result);
+
+ if (error_state) {
+ RUBY_ASSERT(iseq == NULL);
+ rb_jump_tag(error_state);
+ }
}
else {
VALUE ast_value = prelude_ast_value(name_str, code, start_line);
@@ -93,5 +101,18 @@ void
rb_load_with_builtin_functions(const char *feature_name, const struct rb_builtin_function *table)
{
const rb_iseq_t *iseq = builtin_iseq_load(feature_name, table);
- rb_iseq_eval(iseq);
+ rb_iseq_eval(iseq, rb_root_box());
+}
+
+VALUE
+rb_define_gem_modules(VALUE _a, VALUE _b)
+{
+ // do nothing - moniruby doesn't load gem_prelude.rb.
+ return Qnil;
+}
+
+void
+rb_load_gem_prelude(VALUE _)
+{
+ // do nothing - miniruby doesn't support loading RubyGems.
}