MCPcopy Index your code
hub / github.com/aiscriptdev/aiscript / compile

Method compile

aiscript-vm/src/vm/mod.rs:135–145  ·  view source on GitHub ↗
(&mut self, source: &'static str)

Source from the content-addressed store, hash-verified

133 }
134
135 pub fn compile(&mut self, source: &'static str) -> Result<(), VmError> {
136 self.arena.mutate_root(|_mc, state| {
137 let context = state.get_context();
138 state.chunks = crate::compiler::compile(context, source)?;
139 builtins::define_builtin_functions(state);
140 // The script function's chunk id is always the highest chunk id.
141 let script_chunk_id = state.chunks.keys().max().copied().unwrap();
142 let function = state.get_chunk(script_chunk_id)?;
143 state.call_function(function, &[])
144 })
145 }
146
147 pub fn eval_function(
148 &mut self,

Callers 6

evalFunction · 0.80
run_fileMethod · 0.80
test_inject_variablesFunction · 0.80
test_inject_instanceFunction · 0.80
execute_codeMethod · 0.80
pollMethod · 0.80

Calls 6

compileFunction · 0.85
define_builtin_functionsFunction · 0.85
mutate_rootMethod · 0.80
get_contextMethod · 0.80
get_chunkMethod · 0.80
call_functionMethod · 0.80

Tested by 2

test_inject_variablesFunction · 0.64
test_inject_instanceFunction · 0.64