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

Method invoke_from_class

aiscript-vm/src/vm/state.rs:1371–1386  ·  view source on GitHub ↗
(
        &mut self,
        class: GcRefLock<'gc, Class<'gc>>,
        name: InternedString<'gc>,
        arg_count: u8,
        keyword_args_count: u8,
    )

Source from the content-addressed store, hash-verified

1369 }
1370
1371 fn invoke_from_class(
1372 &mut self,
1373 class: GcRefLock<'gc, Class<'gc>>,
1374 name: InternedString<'gc>,
1375 arg_count: u8,
1376 keyword_args_count: u8,
1377 ) -> Result<(), VmError> {
1378 match class.borrow().methods.get(&name) {
1379 Some(Value::Closure(closure)) => self.call(*closure, arg_count, keyword_args_count),
1380 Some(value) if value.is_native_function() => {
1381 // class methods can be a native function
1382 self.call_value(*value, arg_count, keyword_args_count)
1383 }
1384 _ => Err(self.runtime_error(format!("Undefined property '{}'.", name).into())),
1385 }
1386 }
1387
1388 fn invoke(
1389 &mut self,

Callers 2

dispatch_nextMethod · 0.80
invokeMethod · 0.80

Calls 6

is_native_functionMethod · 0.80
call_valueMethod · 0.80
runtime_errorMethod · 0.80
getMethod · 0.45
borrowMethod · 0.45
callMethod · 0.45

Tested by

no test coverage detected