Skip to content

Commit

Permalink
fix(parser): Don't break when callee is not callable
Browse files Browse the repository at this point in the history
  • Loading branch information
giann committed May 14, 2024
1 parent cb93e69 commit 4cb8734
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Parser.zig
Original file line number Diff line number Diff line change
Expand Up @@ -3521,6 +3521,8 @@ fn call(self: *Self, _: bool, callee: Ast.Node.Index) Error!Ast.Node.Index {
self.ast.tokens.get(self.ast.nodes.items(.location)[callee]),
"Can't be called",
);

type_def = self.gc.type_registry.void_type;
} else {
const placeholder_resolved_type: obj.ObjTypeDef.TypeUnion = .{
.Placeholder = obj.PlaceholderDef.init(self.gc.allocator, start_location),
Expand Down Expand Up @@ -3552,7 +3554,11 @@ fn call(self: *Self, _: bool, callee: Ast.Node.Index) Error!Ast.Node.Index {
.is_async = false,
.callee = callee,
// We do this because the callee type will change in the dot.call usecase
.callee_type_def = self.ast.nodes.items(.type_def)[callee].?,
.callee_type_def = self.ast.nodes.items(.type_def)[callee] orelse callee_td: {
std.debug.assert(self.reporter.had_error);

break :callee_td self.gc.type_registry.void_type;
},
.arguments = arguments,
.catch_default = catch_default,
},
Expand Down

0 comments on commit 4cb8734

Please sign in to comment.