MCPcopy Create free account
hub / github.com/amber-lang/amber / add_instance

Method add_instance

src/utils/function_cache.rs:53–58  ·  view source on GitHub ↗

Adds a new function instance to the cache

(&mut self, id: usize, mut fun: FunctionInstance)

Source from the content-addressed store, hash-verified

51
52 /// Adds a new function instance to the cache
53 pub fn add_instance(&mut self, id: usize, mut fun: FunctionInstance) -> usize {
54 let functions = self.funs.get_mut(&id).expect("Function not found in cache");
55 fun.variant_id = functions.instances.len();
56 functions.instances.push(fun);
57 functions.instances.len() - 1
58 }
59
60 /// Gets all the function instances of a function declaration
61 pub fn get_instances_cloned(&self, id: usize) -> Option<Vec<FunctionInstance>> {

Callers 2

add_fun_instanceMethod · 0.80

Calls

no outgoing calls

Tested by 1