@@ -3562,17 +3562,14 @@ fn fnDecl(
3562
3562
3563
3563
var ret_gz = decl_gz .makeSubBlock (params_scope );
3564
3564
defer ret_gz .unstack ();
3565
- const ret_ref : Zir.Inst.Ref = switch (nodePrimitive (tree , fn_proto .ast .return_type )) {
3566
- .none = > inst : {
3567
- const inst = try expr (& ret_gz , params_scope , coerced_type_rl , fn_proto .ast .return_type );
3568
- if (ret_gz .instructionsSlice ().len == 0 ) {
3569
- // In this case we will send a len=0 body which can be encoded more efficiently.
3570
- break :inst inst ;
3571
- }
3572
- _ = try ret_gz .addBreak (.break_inline , 0 , inst );
3565
+ const ret_ref : Zir.Inst.Ref = inst : {
3566
+ const inst = try expr (& ret_gz , params_scope , coerced_type_rl , fn_proto .ast .return_type );
3567
+ if (ret_gz .instructionsSlice ().len == 0 ) {
3568
+ // In this case we will send a len=0 body which can be encoded more efficiently.
3573
3569
break :inst inst ;
3574
- },
3575
- else = > | p | p ,
3570
+ }
3571
+ _ = try ret_gz .addBreak (.break_inline , 0 , inst );
3572
+ break :inst inst ;
3576
3573
};
3577
3574
3578
3575
const func_inst : Zir.Inst.Ref = if (body_node == 0 ) func : {
@@ -9025,31 +9022,6 @@ fn nodeImpliesComptimeOnly(tree: *const Ast, start_node: Ast.Node.Index) bool {
9025
9022
}
9026
9023
}
9027
9024
9028
- fn nodePrimitive (tree : * const Ast , start_node : Ast.Node.Index ) Zir.Inst.Ref {
9029
- const node_tags = tree .nodes .items (.tag );
9030
- const node_datas = tree .nodes .items (.data );
9031
-
9032
- var node = start_node ;
9033
- while (true ) {
9034
- switch (node_tags [node ]) {
9035
- // Forward the question to the LHS sub-expression.
9036
- .grouped_expression = > node = node_datas [node ].lhs ,
9037
-
9038
- .identifier = > {
9039
- const main_tokens = tree .nodes .items (.main_token );
9040
- const ident_bytes = tree .tokenSlice (main_tokens [node ]);
9041
- if (primitives .get (ident_bytes )) | primitive | {
9042
- return primitive ;
9043
- } else {
9044
- return .none ;
9045
- }
9046
- },
9047
-
9048
- else = > return .none ,
9049
- }
9050
- }
9051
- }
9052
-
9053
9025
/// Applies `rl` semantics to `result`. Expressions which do not do their own handling of
9054
9026
/// result locations must call this function on their result.
9055
9027
/// As an example, if the `ResultLoc` is `ptr`, it will write the result to the pointer.
0 commit comments