Skip to content

Conversation

Copy link

Copilot AI commented Jan 30, 2026

The OPERATOR case in the content setter was missing a break statement after its nested switch, causing execution to fall through to the FUNCTION case and overwrite operator content.

case NodeType.OPERATOR:
    switch (content) {
        case '+':
            this.#_content = Operator.ADDITION;
            break;
        // ... other operators
        default:
            throw `Attempted to create Operator node with non-operator content. Given: ${content}`;
    }
    break;  // ← Added: prevents fall-through to FUNCTION case
case NodeType.FUNCTION:
    this.#_content = content;
    break;

The default case only catches invalid operators within the nested switch. For valid operators, the nested switch completes successfully and without the outer break, execution continues to line 110.

Changes:

  • Added break statement after OPERATOR case (line 108)
  • Removed unreachable break after throw statement (line 106)

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits January 30, 2026 20:57
Co-authored-by: JoshdRod <128097418+JoshdRod@users.noreply.github.com>
Co-authored-by: JoshdRod <128097418+JoshdRod@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix unreachable code in Node refactor based on feedback Fix missing break statement causing fall-through in Node content setter Jan 30, 2026
Copilot AI requested a review from JoshdRod January 30, 2026 21:00
@JoshdRod
Copy link
Owner

JoshdRod commented Feb 1, 2026

Fixed myself.

@JoshdRod JoshdRod closed this Feb 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants