You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[major] Model visibility, constants and entry points in the AST
Closes three gaps where the AST could not say something every target
language can spell.
Visibility (#25) becomes an enumeration — Public, Protected, Internal,
Private, and Unspecified for "however the language would write it
anyway" — carried by ClassDeclaration, FunctionDeclaration and
VariableDeclaration through IHasVisibility. It replaces the free-text
AccessModifier that ClassDeclaration and VariableDeclaration carried,
which could only ever be right for whichever language it was typed for.
Each generator spells it its own way: C# writes the keyword, C++ groups
members under access labels, JavaScript gives a private member the #
prefix that is its own private syntax, and Python writes nothing at all,
because its leading-underscore convention renames the declaration and
would leave every reference to it naming something that no longer
exists. Documents written with accessModifier still load.
Constants (#26) are a VariableDeclaration marked IsConstant with a
literal value, and now come out right wherever they sit: C++ writes
static constexpr for a class member rather than a per-instance const,
JavaScript writes static for one rather than a const that is a syntax
error in a class body, and the palette offers a constant already holding
a literal.
EntryPoint (#27) is a node of its own rather than a function named main,
since only some languages spell the entry point as a function at all. It
carries the two things that vary — whether the program reads its
arguments and whether it returns an exit code — and each generator
writes what its language looks for: C#'s static Main, C++'s free int
main, Python's main with the __main__ guard and the import its arguments
need, and JavaScript's main with the call that runs it.
The schema, the inspector, the palette and the YAML round trip carry all
three, with 41 tests over the four generators and both directions of
serialization.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FMNNvzNnuLErq96R4NjYUi
0 commit comments