@@ -3540,17 +3540,14 @@ fn fnDecl(
3540
3540
3541
3541
var ret_gz = decl_gz .makeSubBlock (params_scope );
3542
3542
defer ret_gz .unstack ();
3543
- const ret_ref : Zir.Inst.Ref = switch (nodePrimitive (tree , fn_proto .ast .return_type )) {
3544
- .none = > inst : {
3545
- const inst = try expr (& ret_gz , params_scope , coerced_type_rl , fn_proto .ast .return_type );
3546
- if (ret_gz .instructionsSlice ().len == 0 ) {
3547
- // In this case we will send a len=0 body which can be encoded more efficiently.
3548
- break :inst inst ;
3549
- }
3550
- _ = try ret_gz .addBreak (.break_inline , 0 , inst );
3543
+ const ret_ref : Zir.Inst.Ref = inst : {
3544
+ const inst = try expr (& ret_gz , params_scope , coerced_type_rl , fn_proto .ast .return_type );
3545
+ if (ret_gz .instructionsSlice ().len == 0 ) {
3546
+ // In this case we will send a len=0 body which can be encoded more efficiently.
3551
3547
break :inst inst ;
3552
- },
3553
- else = > | p | p ,
3548
+ }
3549
+ _ = try ret_gz .addBreak (.break_inline , 0 , inst );
3550
+ break :inst inst ;
3554
3551
};
3555
3552
3556
3553
const func_inst : Zir.Inst.Ref = if (body_node == 0 ) func : {
@@ -9003,31 +9000,6 @@ fn nodeImpliesComptimeOnly(tree: *const Ast, start_node: Ast.Node.Index) bool {
9003
9000
}
9004
9001
}
9005
9002
9006
- fn nodePrimitive (tree : * const Ast , start_node : Ast.Node.Index ) Zir.Inst.Ref {
9007
- const node_tags = tree .nodes .items (.tag );
9008
- const node_datas = tree .nodes .items (.data );
9009
-
9010
- var node = start_node ;
9011
- while (true ) {
9012
- switch (node_tags [node ]) {
9013
- // Forward the question to the LHS sub-expression.
9014
- .grouped_expression = > node = node_datas [node ].lhs ,
9015
-
9016
- .identifier = > {
9017
- const main_tokens = tree .nodes .items (.main_token );
9018
- const ident_bytes = tree .tokenSlice (main_tokens [node ]);
9019
- if (primitives .get (ident_bytes )) | primitive | {
9020
- return primitive ;
9021
- } else {
9022
- return .none ;
9023
- }
9024
- },
9025
-
9026
- else = > return .none ,
9027
- }
9028
- }
9029
- }
9030
-
9031
9003
/// Applies `rl` semantics to `result`. Expressions which do not do their own handling of
9032
9004
/// result locations must call this function on their result.
9033
9005
/// As an example, if the `ResultLoc` is `ptr`, it will write the result to the pointer.
0 commit comments