| author | |
| committer | |
| log | 4b9e1dd438827c054adc5316a0ccaf62486ac66c |
| tree | a7bad779a5941ca3ef7cd759e42bc5877d3c7b6f |
| parent | 6db6609df84bedafebc709bc5865e7f18c862cc6 |
2 files changed, 24 insertions(+), 1 deletions(-)
src/analyze.cpp+1-1| ... | ... | @@ -498,7 +498,7 @@ static void resolve_function_proto(CodeGen *g, AstNode *node, FnTableEntry *fn_t |
| 498 | 498 | |
| 499 | 499 | // next, loop over the parameters again and compute debug information |
| 500 | 500 | // and codegen information |
| 501 | bool first_arg_return = handle_is_ptr(return_type); | |
| 501 | bool first_arg_return = !fn_proto->skip && handle_is_ptr(return_type); | |
| 502 | 502 | // +1 for maybe making the first argument the return value |
| 503 | 503 | LLVMTypeRef *gen_param_types = allocate<LLVMTypeRef>(1 + src_param_count); |
| 504 | 504 | // +1 because 0 is the return type and +1 for maybe making first arg ret val |
test/run_tests.cpp+23| ... | ... | @@ -1254,6 +1254,29 @@ pub fn main(args: [][]u8) %void => { |
| 1254 | 1254 | stdout.printf("BAD\n"); |
| 1255 | 1255 | } |
| 1256 | 1256 | stdout.printf("OK\n"); |
| 1257 | } | |
| 1258 | )SOURCE", "OK\n"); | |
| 1259 | ||
| 1260 | add_simple_case("%% binary operator", R"SOURCE( | |
| 1261 | import "std.zig"; | |
| 1262 | error ItBroke; | |
| 1263 | fn g(x: bool) %isize => { | |
| 1264 | if (x) { | |
| 1265 | error.ItBroke | |
| 1266 | } else { | |
| 1267 | 10 | |
| 1268 | } | |
| 1269 | } | |
| 1270 | pub fn main(args: [][]u8) %void => { | |
| 1271 | const a = g(true) %% 3; | |
| 1272 | const b = g(false) %% 3; | |
| 1273 | if (a != 3) { | |
| 1274 | stdout.printf("BAD\n"); | |
| 1275 | } | |
| 1276 | if (b != 10) { | |
| 1277 | stdout.printf("BAD\n"); | |
| 1278 | } | |
| 1279 | stdout.printf("OK\n"); | |
| 1257 | 1280 | } |
| 1258 | 1281 | )SOURCE", "OK\n"); |
| 1259 | 1282 | } |