| ... | ... | @@ -267,6 +267,8 @@ pub fn expr(mod: *Module, scope: *Scope, rl: ResultLoc, node: ast.Node.Index) In |
| 267 | 267 | const node_tags = tree.nodes.items(.tag); |
| 268 | 268 | const token_starts = tree.tokens.items(.start); |
| 269 | 269 | |
| 270 | const gz = scope.getGenZir(); |
| 271 | |
| 270 | 272 | switch (node_tags[node]) { |
| 271 | 273 | .root => unreachable, // Top-level declaration. |
| 272 | 274 | .@"usingnamespace" => unreachable, // Top-level declaration. |
| ... | ... | @@ -443,56 +445,29 @@ pub fn expr(mod: *Module, scope: *Scope, rl: ResultLoc, node: ast.Node.Index) In |
| 443 | 445 | .slice_sentinel => return sliceExpr(mod, scope, rl, tree.sliceSentinel(node)), |
| 444 | 446 | |
| 445 | 447 | .deref => { |
| 446 | | if (true) @panic("TODO update for zir-memory-layout"); |
| 447 | 448 | const lhs = try expr(mod, scope, .none, node_datas[node].lhs); |
| 448 | | const src = token_starts[main_tokens[node]]; |
| 449 | | const result = try addZIRUnOp(mod, scope, src, .deref, lhs); |
| 450 | | return rvalue(mod, scope, rl, result); |
| 449 | const result = try gz.addUnNode(.deref_node, lhs, node); |
| 450 | return rvalue(mod, scope, rl, result, node); |
| 451 | 451 | }, |
| 452 | 452 | .address_of => { |
| 453 | | if (true) @panic("TODO update for zir-memory-layout"); |
| 454 | 453 | const result = try expr(mod, scope, .ref, node_datas[node].lhs); |
| 455 | | return rvalue(mod, scope, rl, result); |
| 454 | return rvalue(mod, scope, rl, result, node); |
| 456 | 455 | }, |
| 457 | 456 | .undefined_literal => { |
| 458 | | if (true) @panic("TODO update for zir-memory-layout"); |
| 459 | | const main_token = main_tokens[node]; |
| 460 | | const src = token_starts[main_token]; |
| 461 | | const result = try addZIRInstConst(mod, scope, src, .{ |
| 462 | | .ty = Type.initTag(.@"undefined"), |
| 463 | | .val = Value.initTag(.undef), |
| 464 | | }); |
| 465 | | return rvalue(mod, scope, rl, result); |
| 457 | const result = @enumToInt(zir.Const.undef); |
| 458 | return rvalue(mod, scope, rl, result, node); |
| 466 | 459 | }, |
| 467 | 460 | .true_literal => { |
| 468 | | if (true) @panic("TODO update for zir-memory-layout"); |
| 469 | | const main_token = main_tokens[node]; |
| 470 | | const src = token_starts[main_token]; |
| 471 | | const result = try addZIRInstConst(mod, scope, src, .{ |
| 472 | | .ty = Type.initTag(.bool), |
| 473 | | .val = Value.initTag(.bool_true), |
| 474 | | }); |
| 475 | | return rvalue(mod, scope, rl, result); |
| 461 | const result = @enumToInt(zir.Const.bool_true); |
| 462 | return rvalue(mod, scope, rl, result, node); |
| 476 | 463 | }, |
| 477 | 464 | .false_literal => { |
| 478 | | if (true) @panic("TODO update for zir-memory-layout"); |
| 479 | | const main_token = main_tokens[node]; |
| 480 | | const src = token_starts[main_token]; |
| 481 | | const result = try addZIRInstConst(mod, scope, src, .{ |
| 482 | | .ty = Type.initTag(.bool), |
| 483 | | .val = Value.initTag(.bool_false), |
| 484 | | }); |
| 485 | | return rvalue(mod, scope, rl, result); |
| 465 | const result = @enumToInt(zir.Const.bool_false); |
| 466 | return rvalue(mod, scope, rl, result, node); |
| 486 | 467 | }, |
| 487 | 468 | .null_literal => { |
| 488 | | if (true) @panic("TODO update for zir-memory-layout"); |
| 489 | | const main_token = main_tokens[node]; |
| 490 | | const src = token_starts[main_token]; |
| 491 | | const result = try addZIRInstConst(mod, scope, src, .{ |
| 492 | | .ty = Type.initTag(.@"null"), |
| 493 | | .val = Value.initTag(.null_value), |
| 494 | | }); |
| 495 | | return rvalue(mod, scope, rl, result); |
| 469 | const result = @enumToInt(zir.Const.null_value); |
| 470 | return rvalue(mod, scope, rl, result, node); |
| 496 | 471 | }, |
| 497 | 472 | .optional_type => { |
| 498 | 473 | if (true) @panic("TODO update for zir-memory-layout"); |