refactor: rename helpers to static fields, block-style rendering, sibling insert

Rename isHelper/ToggleHelper to isStatic/ToggleStatic across core, compose,
controller, editor, and generator. Static fields now render with block syntax
(static Type name { return expr } → 0xADDR) and support collapsed/expanded
display. Add "Add Static Field" context menu for sibling nodes. Update
expression span parser, completions, C++ generator comments, and all tests.
This commit is contained in:
IChooseYou
2026-02-28 08:21:00 -07:00
committed by IChooseYou
parent 6a51c904de
commit 95faf027a9
12 changed files with 685 additions and 367 deletions

View File

@@ -173,10 +173,10 @@ static void emitStructBody(GenContext& ctx, uint64_t structId,
QString ind = indent(depth);
QVector<int> allChildren = ctx.childMap.value(structId);
QVector<int> children, helperIdxs;
QVector<int> children, staticIdxs;
for (int ci : allChildren) {
if (tree.nodes[ci].isHelper)
helperIdxs.append(ci);
if (tree.nodes[ci].isStatic)
staticIdxs.append(ci);
else
children.append(ci);
}
@@ -318,12 +318,12 @@ static void emitStructBody(GenContext& ctx, uint64_t structId,
if (!isUnion && cursor < structSize)
emitPadRun(cursor, structSize - cursor);
// Emit helper comments (helpers are runtime-only, not part of struct layout)
for (int hi : helperIdxs) {
const Node& h = tree.nodes[hi];
QString hType = h.structTypeName.isEmpty() ? ctx.cType(h.kind) : h.structTypeName;
ctx.output += ind + QStringLiteral("// helper: %1 %2 @ %3\n")
.arg(hType, sanitizeIdent(h.name), h.offsetExpr);
// Emit static field comments (static fields are runtime-only, not part of struct layout)
for (int si : staticIdxs) {
const Node& sf = tree.nodes[si];
QString sfType = sf.structTypeName.isEmpty() ? ctx.cType(sf.kind) : sf.structTypeName;
ctx.output += ind + QStringLiteral("// static: %1 %2 @ %3\n")
.arg(sfType, sanitizeIdent(sf.name), sf.offsetExpr);
}
}