| ... | @@ -393,11 +393,14 @@ pub fn resolveSourceFileName(self: *Module, decl: *ZigDecl) !IdRef { | ... | @@ -393,11 +393,14 @@ pub fn resolveSourceFileName(self: *Module, decl: *ZigDecl) !IdRef { |
| 393 | /// be emitted at this point. | 393 | /// be emitted at this point. |
| 394 | pub fn resolveType(self: *Module, ty: Type) !Type.Ref { | 394 | pub fn resolveType(self: *Module, ty: Type) !Type.Ref { |
| 395 | const result = try self.type_cache.getOrPut(self.gpa, ty); | 395 | const result = try self.type_cache.getOrPut(self.gpa, ty); |
| | 396 | const index = @intToEnum(Type.Ref, result.index); |
| | 397 | |
| 396 | if (!result.found_existing) { | 398 | if (!result.found_existing) { |
| 397 | result.value_ptr.* = try self.emitType(ty); | 399 | const ref = try self.emitType(ty); |
| | 400 | self.type_cache.values()[result.index] = ref; |
| 398 | } | 401 | } |
| 399 | | 402 | |
| 400 | return @intToEnum(Type.Ref, result.index); | 403 | return index; |
| 401 | } | 404 | } |
| 402 | | 405 | |
| 403 | pub fn resolveTypeId(self: *Module, ty: Type) !IdResultType { | 406 | pub fn resolveTypeId(self: *Module, ty: Type) !IdResultType { |