Skip to content

Commit

Permalink
fix(repl): Don't warn about discared values in REPL
Browse files Browse the repository at this point in the history
  • Loading branch information
giann committed Oct 20, 2023
1 parent 1c6a659 commit 79b6a9f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/node.zig
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ pub const ExpressionNode = struct {

try codegen.emitOpCode(node.location, .OP_POP);

if (self.isLoneExpression() and self.expression.type_def.?.def_type != .Placeholder) {
if (codegen.flavor != .Repl and self.isLoneExpression() and self.expression.type_def.?.def_type != .Placeholder) {
const type_def_str = self.expression.type_def.?.toStringAlloc(codegen.gc.allocator) catch unreachable;
defer type_def_str.deinit();

Expand Down
4 changes: 2 additions & 2 deletions src/parser.zig
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ pub const Parser = struct {
const local = self.current.?.locals[i];

// Check discarded locals
if (!local.isReferenced()) {
if (self.flavor != .Repl and !local.isReferenced()) {
const type_def_str = local.type_def.toStringAlloc(self.gc.allocator) catch unreachable;
defer type_def_str.deinit();

Expand Down Expand Up @@ -720,7 +720,7 @@ pub const Parser = struct {
}

// Check discarded locals
if (!local.isReferenced()) {
if (self.flavor != .Repl and !local.isReferenced()) {
const type_def_str = local.type_def.toStringAlloc(self.gc.allocator) catch unreachable;
defer type_def_str.deinit();

Expand Down

0 comments on commit 79b6a9f

Please sign in to comment.