MCPcopy Create free account
hub / github.com/ForLoveOfCats/fae / generate_function

Function generate_function

src/codegen/codegen.rs:115–161  ·  view source on GitHub ↗
(
	messages: &mut Messages<'a>,
	lang_items: &LangItems,
	type_store: &mut TypeStore<'a>,
	function_store: &FunctionStore<'a>,
	generator: &mut G,
	shape: ReadGuard<FunctionShape<'a>>,
	function_id: F

Source from the content-addressed store, hash-verified

113}
114
115pub fn generate_function<'a, G: Generator>(
116 messages: &mut Messages<'a>,
117 lang_items: &LangItems,
118 type_store: &mut TypeStore<'a>,
119 function_store: &FunctionStore<'a>,
120 generator: &mut G,
121 shape: ReadGuard<FunctionShape<'a>>,
122 function_id: FunctionId,
123) {
124 if shape.trait_method_marker.is_some() {
125 return;
126 }
127
128 let specialization = &shape.specializations[function_id.specialization_index];
129
130 for &type_argument in &specialization.type_arguments.ids {
131 let entry = type_store.type_entries.get(type_argument.item);
132 if entry.generic_poisoned {
133 return;
134 }
135 }
136
137 generator.start_function(type_store, specialization, function_id);
138
139 let module_path = shape.module_path;
140 let type_arguments = specialization.type_arguments.clone();
141 let Some(block) = shape.block.clone() else {
142 unreachable!("{:?}", *shape);
143 };
144
145 drop(shape);
146
147 let mut context = Context {
148 messages,
149 lang_items,
150 type_store,
151 function_store,
152 module_path,
153 function_type_arguments: &type_arguments,
154 function_id,
155 defer_stack: Vec::new(),
156 loop_stack: Vec::new(),
157 yield_target_stack: Vec::new(),
158 };
159
160 generate_block(&mut context, generator, block.as_ref());
161}
162
163pub fn generate_block<'a, 'b, G: Generator>(
164 context: &mut Context<'a, 'b>,

Callers 1

generateFunction · 0.85

Calls 5

generate_blockFunction · 0.85
start_functionMethod · 0.80
as_refMethod · 0.80
getMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected