@@ -23,11 +23,11 @@ pub fn parse_ir_shadow_function_decl(ctx: &mut IRContext, node: Box<ASTTreeNode>
2323 arguments. push ( ( t, k. name . hash ) ) ;
2424 }
2525
26- let func = IRFunction :: create_shadow ( ctx, func_name. val . clone ( ) , & ctx. module , return_type, arguments) ?;
26+ let func = IRFunction :: create_shadow ( ctx, func_name. val . clone ( ) , func_name . hash , & ctx. module , return_type, arguments) ?;
2727
2828 ctx. add_function ( func_name. hash , func) ?;
2929
30- return Ok ( ctx. get_funtion ( func_name. hash ) ?) ;
30+ return Ok ( ctx. get_function ( func_name. hash ) ?) ;
3131 }
3232
3333 return Err ( PositionlessError :: new ( "Cannot parse ir shadow funtion decl as the node is incompatible!" ) ) ;
@@ -51,7 +51,7 @@ pub fn parse_ir_function_decl(ctx: &mut IRContext, node: Box<ASTTreeNode>) -> Po
5151 arguments. push ( ( t, k. name . hash ) ) ;
5252 }
5353
54- let mut func = IRFunction :: create ( ctx, func_name. val , & ctx. module , return_type, arguments) ?;
54+ let mut func = IRFunction :: create ( ctx, func_name. val , func_name . hash , & ctx. module , return_type, arguments) ?;
5555
5656 let mut ind = 0 ;
5757 for argument in & func. args {
@@ -73,7 +73,7 @@ pub fn parse_ir_function_decl(ctx: &mut IRContext, node: Box<ASTTreeNode>) -> Po
7373
7474 ctx. add_function ( func_name. hash , func) ?;
7575
76- return ctx. get_funtion ( func_name. hash ) ;
76+ return ctx. get_function ( func_name. hash ) ;
7777 }
7878
7979 return Err ( PositionlessError :: new ( "Given node in parse_ir_function_decl wasn't a function decl!" ) ) ;
@@ -91,7 +91,7 @@ pub fn parse_ir_body(ctx: &IRContext, func: &mut IRFunction, nodes: Vec<Box<ASTT
9191 return Ok ( true ) ;
9292}
9393
94- pub fn parse_ir_function_call ( ctx : & IRContext , lctx : & IRLocalContext , node : Box < ASTTreeNode > , owner : Option < IRPointer > , grab_result : bool ) -> PositionlessResult < Option < IRValueRef > > {
94+ pub fn parse_ir_function_call ( ctx : & IRContext , f : & IRFunction , node : Box < ASTTreeNode > , owner : Option < IRPointer > , grab_result : bool ) -> PositionlessResult < Option < IRValueRef > > {
9595 if let ASTTreeNode :: FunctionCall { func, args } = * node {
9696 let mut arguments = vec ! [ ] ;
9797
@@ -100,10 +100,10 @@ pub fn parse_ir_function_call(ctx: &IRContext, lctx: &IRLocalContext, node: Box<
100100 }
101101
102102 for v in args {
103- arguments. push ( parse_ir_value ( Some ( lctx ) , ctx, v, None , false ) ?) ;
103+ arguments. push ( parse_ir_value ( Some ( & f ) , ctx, v, None , false ) ?) ;
104104 }
105105
106- let func = ctx. get_funtion ( func. hash ) ?;
106+ let func = ctx. get_function ( func. hash ) ?;
107107
108108 let ret = func. call ( ctx, arguments, grab_result) ?;
109109
@@ -128,7 +128,7 @@ pub fn parse_ir_function_body_member(ctx: &IRContext, func: &mut IRFunction, nod
128128 println ! ( "Var name: {}" , var_name. val. clone( ) ) ;
129129
130130 let initial = if let Some ( v) = value {
131- Some ( parse_ir_value ( Some ( & func. lctx ) , ctx, v, None , true ) ?)
131+ Some ( parse_ir_value ( Some ( & func) , ctx, v, None , true ) ?)
132132 } else {
133133 None
134134 } ;
@@ -143,19 +143,19 @@ pub fn parse_ir_function_body_member(ctx: &IRContext, func: &mut IRFunction, nod
143143 } ,
144144
145145 ASTTreeNode :: StructLRFunction { .. } => {
146- parse_ir_value ( Some ( & func. lctx ) , ctx, node, None , false ) ?;
146+ parse_ir_value ( Some ( & func) , ctx, node, None , false ) ?;
147147
148148 return Ok ( true )
149149 } ,
150150
151151 ASTTreeNode :: StructLRVariable { .. } => {
152- parse_ir_value ( Some ( & func. lctx ) , ctx, node, None , false ) ?;
152+ parse_ir_value ( Some ( & func) , ctx, node, None , false ) ?;
153153
154154 return Ok ( true )
155155 } ,
156156
157157 ASTTreeNode :: FunctionCall { .. } => {
158- parse_ir_function_call ( ctx, & func. lctx , node, None , false ) ?;
158+ parse_ir_function_call ( ctx, & func, node, None , false ) ?;
159159
160160 return Ok ( true )
161161 } ,
@@ -167,7 +167,7 @@ pub fn parse_ir_function_body_member(ctx: &IRContext, func: &mut IRFunction, nod
167167 return Ok ( true ) ;
168168 }
169169
170- let val = parse_ir_value ( Some ( & func. lctx ) , ctx, val. unwrap ( ) , None , true ) ?;
170+ let val = parse_ir_value ( Some ( & func) , ctx, val. unwrap ( ) , None , true ) ?;
171171
172172 ctx. builder . build_return ( Some ( & val. obtain ( ctx) ?. obtain ( ) . inner ) ) ;
173173
@@ -187,7 +187,7 @@ pub fn parse_ir_function_body_member(ctx: &IRContext, func: &mut IRFunction, nod
187187 return Err ( PositionlessError :: new ( "Cannot use a math expression in IR body if it is not assignments!" ) )
188188 }
189189
190- parse_ir_value ( Some ( & func. lctx ) , ctx, node, None , false ) ?;
190+ parse_ir_value ( Some ( & func) , ctx, node, None , false ) ?;
191191 return Ok ( true ) ;
192192 }
193193
0 commit comments