@samitouri / QOS-React-2 / commits / ed63dba739

[hir] Print MutableRange in lvalue

This is admittedly a little noisy but super valuable when debugging.

Sathya Gunasekaran committed Jan 11, 2023 at 15:08 UTC ed63dba73930fb3ccc6658a497e2c09a6acb0b44
1 file changed +7 -4
compiler/forget/src/HIR/PrintHIR.ts
+7 -4
@@ -327,16 +327,19 @@ function printMutableRange(identifier: Identifier): string {
327 }
328
329 export function printLValue(lval: LValue): string {
330 - let place = printPlace(lval.place);
330 + let lvalue = `${printPlace(lval.place)}${printMutableRange(
331 + lval.place.identifier
332 + )}`;
333 +
334 switch (lval.kind) {
335 case InstructionKind.Let: {
333 - return `Let ${place}`;
336 + return `Let ${lvalue}`;
337 }
338 case InstructionKind.Const: {
336 - return `Const ${place}`;
339 + return `Const ${lvalue}$`;
340 }
341 case InstructionKind.Reassign: {
339 - return `Reassign ${place}`;
342 + return `Reassign ${lvalue}`;
343 }
344 default: {
345 assertExhaustive(lval.kind, `Unexpected lvalue kind '${lval.kind}'`);