Skip to content

Commit 80679fd

Browse files
committed
Fix resolving typedef type_exprs
1 parent bf52ec4 commit 80679fd

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

codegen/metac_codegen.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,6 +1163,7 @@ static void MetaCCodegen_doArrowExpr(metac_bytecode_ctx_t* ctx,
11631163
offsetVal = imm32(field->Offset);
11641164

11651165
assert(e1Value.vType == BCValueType_StackValue
1166+
|| e1Value.vType == BCValueType_Parameter
11661167
|| e1Value.vType == BCValueType_HeapValue
11671168
|| e1Value.vType == BCValueType_External);
11681169
gen.Add3(c, &addr, &e1Value, &offsetVal);

printer/metac_printer.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1516,6 +1516,17 @@ static inline void PrintSemaType(metac_printer_t* self,
15161516
PrintSemaType(self, sema, elementType);
15171517
PrintString(self, "*", sizeof("*") - 1);
15181518
} break;
1519+
case type_index_typedef:
1520+
{
1521+
uint32_t typedefTypeIdx = TYPE_INDEX_INDEX(typeIndex);
1522+
metac_type_typedef_t* typedefType =
1523+
TypedefPtr(sema, typedefTypeIdx);
1524+
metac_identifier_ptr_t nullIdPtr = {};
1525+
PrintString(self, "typedef ", sizeof("typedef ") - 1);
1526+
PrintSemaType(self, sema, typedefType->Type);
1527+
PrintString(self, " ", sizeof(" ") - 1);
1528+
PrintIdentifier(self, typedefType->Identifier);
1529+
} break;
15191530
case type_index_functiontype:
15201531
{
15211532
uint32_t funcTypeIdx = TYPE_INDEX_INDEX(typeIndex);

0 commit comments

Comments
 (0)