authorgravatar for noam@pixelhero.devNoam Preil <noam@pixelhero.dev> 2020-10-07 02:36:04-04:00
committergravatar for noam@pixelhero.devNoam Preil <noam@pixelhero.dev> 2020-10-07 02:36:04-04:00
log7d69e1d84e272251e6aead39c551154797c2b1a4
treefca28f88b85955c9f55e4328dabf5dd495dc0d4d
parentde093879ccc46263c3c6a87173bcf5089d48b4b7
signaturelock-open Commit is signed but in an unrecognized format.

Rename variables in resolvePeerTypes for clarity


1 files changed, 22 insertions(+), 22 deletions(-)

src/Module.zig+22-22
......@@ -2629,52 +2629,52 @@ pub fn resolvePeerTypes(self: *Module, scope: *Scope, instructions: []*Inst) !Ty
26292629 if (instructions.len == 1)
26302630 return instructions[0].ty;
26312631
2632 var prev_inst = instructions[0];
2633 for (instructions[1..]) |next_inst| {
2634 if (next_inst.ty.eql(prev_inst.ty))
2632 var chosen = instructions[0];
2633 for (instructions[1..]) |candidate| {
2634 if (candidate.ty.eql(chosen.ty))
26352635 continue;
2636 if (next_inst.ty.zigTypeTag() == .NoReturn)
2636 if (candidate.ty.zigTypeTag() == .NoReturn)
26372637 continue;
2638 if (prev_inst.ty.zigTypeTag() == .NoReturn) {
2639 prev_inst = next_inst;
2638 if (chosen.ty.zigTypeTag() == .NoReturn) {
2639 chosen = candidate;
26402640 continue;
26412641 }
2642 if (next_inst.ty.zigTypeTag() == .Undefined)
2642 if (candidate.ty.zigTypeTag() == .Undefined)
26432643 continue;
2644 if (prev_inst.ty.zigTypeTag() == .Undefined) {
2645 prev_inst = next_inst;
2644 if (chosen.ty.zigTypeTag() == .Undefined) {
2645 chosen = candidate;
26462646 continue;
26472647 }
2648 if (prev_inst.ty.isInt() and
2649 next_inst.ty.isInt() and
2650 prev_inst.ty.isSignedInt() == next_inst.ty.isSignedInt())
2648 if (chosen.ty.isInt() and
2649 candidate.ty.isInt() and
2650 chosen.ty.isSignedInt() == candidate.ty.isSignedInt())
26512651 {
2652 if (prev_inst.ty.intInfo(self.getTarget()).bits < next_inst.ty.intInfo(self.getTarget()).bits) {
2653 prev_inst = next_inst;
2652 if (chosen.ty.intInfo(self.getTarget()).bits < candidate.ty.intInfo(self.getTarget()).bits) {
2653 chosen = candidate;
26542654 }
26552655 continue;
26562656 }
2657 if (prev_inst.ty.isFloat() and next_inst.ty.isFloat()) {
2658 if (prev_inst.ty.floatBits(self.getTarget()) < next_inst.ty.floatBits(self.getTarget())) {
2659 prev_inst = next_inst;
2657 if (chosen.ty.isFloat() and candidate.ty.isFloat()) {
2658 if (chosen.ty.floatBits(self.getTarget()) < candidate.ty.floatBits(self.getTarget())) {
2659 chosen = candidate;
26602660 }
26612661 continue;
26622662 }
26632663
2664 if (prev_inst.ty.zigTypeTag() == .ComptimeInt and next_inst.ty.isInt()) {
2665 prev_inst = next_inst;
2664 if (chosen.ty.zigTypeTag() == .ComptimeInt and candidate.ty.isInt()) {
2665 chosen = candidate;
26662666 continue;
26672667 }
26682668
2669 if (prev_inst.ty.isInt() and next_inst.ty.zigTypeTag() == .ComptimeInt) {
2669 if (chosen.ty.isInt() and candidate.ty.zigTypeTag() == .ComptimeInt) {
26702670 continue;
26712671 }
26722672
26732673 // TODO error notes pointing out each type
2674 return self.fail(scope, next_inst.src, "incompatible types: '{}' and '{}'", .{ prev_inst.ty, next_inst.ty });
2674 return self.fail(scope, candidate.src, "incompatible types: '{}' and '{}'", .{ chosen.ty, candidate.ty });
26752675 }
26762676
2677 return prev_inst.ty;
2677 return chosen.ty;
26782678}
26792679
26802680pub fn coerce(self: *Module, scope: *Scope, dest_type: Type, inst: *Inst) !*Inst {