Repository navigation
Clone a variable reference that has no name yet [patch] - #199
Merged
Merged
Conversation
VariableReference.Clone() went through the validating constructor, which throws on the empty name a new AssignmentStatement's target or a YAML node with no name holds. C, C++, Rust and Go clone the whole class before writing it, so any class with a property and an unfilled assignment threw out of generation, and crashed the editor's preview. Clone through the parameterless constructor instead, and check every node type clones from its parameterless constructor. Fixes #161 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ACXyQBPWSqFJuF51Mx6FNh
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Fixes #161
What changed
VariableReference.Clone()used to call the validatingVariableReference(string)constructor, which throws on an empty name. An empty name is a normal state:new AssignmentStatement()starts with an unnamed target, and the YAML reader produces one when the name is missing. C, C++, Rust and Go clone the whole class before they write it, so a class with a property and an unfilled assignment threwArgumentExceptionout of generation. In the editor's preview pane, that took the application down. The clone now goes through the parameterless constructor and assignsName.UnfilledNodeCloneTests:AstNodetype with its parameterless constructor and clones itnew AssignmentStatement()in a method) generated for C, C++, Rust and GoNot in this PR
The issue lists two optional items, which I left out to keep this PR to the root cause:
Validate()flagging an emptyVariableReferenceCoderEditorApp.RegeneratecatchingArgumentException/InvalidOperationExceptionVerification
Coder.Testsuite: 1106 passed, 0 failed.🤖 Generated with Claude Code
https://claude.ai/code/session_01ACXyQBPWSqFJuF51Mx6FNh
Generated by Claude Code