2#include "internal/array.h"
3#include "internal/eval.h"
5#include "prism_compile.h"
9#include "miniprelude.c"
12prelude_ast_value(
VALUE name,
VALUE code,
int line)
15 VALUE ast_value = rb_parser_compile_string_path(rb_parser_new(), name, code, line);
16 ast = rb_ruby_ast_data_get(ast_value);
17 if (!ast || !ast->body.root) {
18 if (ast) rb_ast_dispose(ast);
27 pm_parse_result_init(result);
28 pm_options_line_set(result->
options, line);
29 VALUE error = pm_parse_string(result, code, name, NULL);
32 pm_parse_result_free(result);
43 VALUE code = rb_builtin_find(feature_name, &name_str, &start_line);
45 rb_fatal(
"builtin_iseq_load: can not find %s; "
46 "probably miniprelude.c is out of date",
52 .inline_const_cache = TRUE,
53 .peephole_optimization = TRUE,
54 .tailcall_optimization = FALSE,
55 .specialized_instruction = TRUE,
56 .operands_unification = TRUE,
57 .instructions_unification = TRUE,
58 .frozen_string_literal = TRUE,
59 .debug_frozen_string_literal = FALSE,
60 .coverage_enabled = FALSE,
64 if (rb_ruby_prism_p()) {
66 pm_prelude_load(&result, name_str, code, start_line);
68 vm->builtin_function_table = table;
70 iseq = pm_iseq_new_with_opt(&result.
node, name_str, name_str,
Qnil, 0, NULL, 0, ISEQ_TYPE_TOP, &optimization, &error_state);
72 vm->builtin_function_table = NULL;
73 pm_parse_result_free(&result);
77 rb_jump_tag(error_state);
81 VALUE ast_value = prelude_ast_value(name_str, code, start_line);
82 rb_ast_t *ast = rb_ruby_ast_data_get(ast_value);
84 vm->builtin_function_table = table;
85 iseq = rb_iseq_new_with_opt(ast_value, name_str, name_str,
Qnil, 0, NULL, 0, ISEQ_TYPE_TOP, &optimization,
Qnil);
87 vm->builtin_function_table = NULL;
92 if (0 && strcmp(
"prelude", feature_name) == 0) {
96 BUILTIN_LOADED(feature_name, iseq);
102rb_load_with_builtin_functions(
const char *feature_name,
const struct rb_builtin_function *table)
104 const rb_iseq_t *iseq = builtin_iseq_load(feature_name, table);
105 rb_iseq_eval(iseq, rb_root_box());
116rb_load_gem_prelude(
VALUE _)
#define RUBY_ASSERT(...)
Asserts that the given expression is truthy if and only if RUBY_DEBUG is truthy.
#define Qnil
Old name of RUBY_Qnil.
#define NIL_P
Old name of RB_NIL_P.
void rb_exc_raise(VALUE mesg)
Raises an exception in the current thread.
VALUE rb_stdout
STDOUT constant.
Defines RBIMPL_HAS_BUILTIN.
#define _(args)
This was a transition path from K&R to ANSI.
pm_scope_node_t node
The resulting scope node that will hold the generated AST.
pm_options_t * options
The options that will be passed to the parser.
uintptr_t VALUE
Type that represents a Ruby object.