What's wrong
When a braced-list element's value is null, every generator falls back to designated.Value ?? new VariableReference(string.Empty):
Coder/Languages/StandardLanguageGenerator.cs:610 (C, C++, Go, Rust)
Coder/Languages/CSharpGenerator.cs:450
Coder/Languages/PythonGenerator.cs:241, :268
Coder/Languages/JavaScriptGenerator.cs:235
VariableReference(string) throws on an empty or whitespace name (Coder/Ast/VariableReference.cs:20), so this fallback always throws. A null value is legal: the constructor is MemberInitialiser(string name, Expression? value = null). The graph editor also produces one, because AstSchema.cs:654 accepts a MemberInitialiser as an element and its Value slot starts out empty. Constructor initialisers already guard against null (CppGenerator.cs:252 and CSharpGenerator.cs:680 check if (initialiser.Value is not null)). Only the braced-list paths crash.
Repro
ConstructionExpression pt = new("Point");
pt.Arguments.Add(new MemberInitialiser("x"));
generator.Generate(new VariableDeclaration { Name = "p", Type = "Point", InitialValue = pt });
Observed: all 7 generators throw ArgumentException: Name cannot be null or whitespace (Parameter 'name'). The stack runs from WriteListElement / WriteBracedList into VariableReference..ctor.
Why it matters
A user building a struct literal in the editor gets an exception from the preview as soon as they add a member initialiser, before they have filled in its value. A programmatic caller hits the same exception with a signature the API advertises as valid.
Suggested fix / acceptance criteria
- Handle a null
Value explicitly at each site, the same way the constructor-initialiser paths do. Either emit the member with the language's default value ({ .x = {} }, x = default, x: Default::default(), …) or skip the element.
- Add a test that generates
new MemberInitialiser("x") inside a ConstructionExpression with every generator, without throwing.
What's wrong
When a braced-list element's value is null, every generator falls back to
designated.Value ?? new VariableReference(string.Empty):Coder/Languages/StandardLanguageGenerator.cs:610(C, C++, Go, Rust)Coder/Languages/CSharpGenerator.cs:450Coder/Languages/PythonGenerator.cs:241,:268Coder/Languages/JavaScriptGenerator.cs:235VariableReference(string)throws on an empty or whitespace name (Coder/Ast/VariableReference.cs:20), so this fallback always throws. A null value is legal: the constructor isMemberInitialiser(string name, Expression? value = null). The graph editor also produces one, becauseAstSchema.cs:654accepts aMemberInitialiseras an element and its Value slot starts out empty. Constructor initialisers already guard against null (CppGenerator.cs:252andCSharpGenerator.cs:680checkif (initialiser.Value is not null)). Only the braced-list paths crash.Repro
Observed: all 7 generators throw
ArgumentException: Name cannot be null or whitespace (Parameter 'name'). The stack runs fromWriteListElement/WriteBracedListintoVariableReference..ctor.Why it matters
A user building a struct literal in the editor gets an exception from the preview as soon as they add a member initialiser, before they have filled in its value. A programmatic caller hits the same exception with a signature the API advertises as valid.
Suggested fix / acceptance criteria
Valueexplicitly at each site, the same way the constructor-initialiser paths do. Either emit the member with the language's default value ({ .x = {} },x = default,x: Default::default(), …) or skip the element.new MemberInitialiser("x")inside aConstructionExpressionwith every generator, without throwing.