@barefootjs/go-template 0.35.1 → 0.35.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapter/emit-context.d.ts +16 -11
- package/dist/adapter/emit-context.d.ts.map +1 -1
- package/dist/adapter/go-template-adapter.d.ts +55 -22
- package/dist/adapter/go-template-adapter.d.ts.map +1 -1
- package/dist/adapter/index.js +45 -45
- package/dist/adapter/value/value-lowering.d.ts.map +1 -1
- package/dist/index.js +45 -45
- package/dist/vite.js +45 -45
- package/package.json +5 -5
- package/src/__tests__/go-template-adapter.test.ts +2 -2
- package/src/adapter/emit-context.ts +14 -12
- package/src/adapter/go-template-adapter.ts +156 -70
- package/src/adapter/value/value-lowering.ts +6 -7
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* Keep this surface minimal: add a member only when an extracted module
|
|
14
14
|
* genuinely needs it, so the seam documents the real cross-module coupling.
|
|
15
15
|
*/
|
|
16
|
-
import type { ParsedExpr } from '@barefootjs/jsx';
|
|
16
|
+
import type { ParsedExpr, TypeInfo } from '@barefootjs/jsx';
|
|
17
17
|
import type { CompileState } from './lib/compile-state.ts';
|
|
18
18
|
export interface GoEmitContext {
|
|
19
19
|
/** Per-compile mutable state (signals, consts, type tables, errors, …). */
|
|
@@ -72,16 +72,21 @@ export interface GoEmitContext {
|
|
|
72
72
|
*/
|
|
73
73
|
resolveModuleStringConst(name: string): string | null;
|
|
74
74
|
/**
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
75
|
+
* Resolve a bare identifier naming a plain module-level const (`const
|
|
76
|
+
* TRACK = 8`, `const OPEN = true`, `const INITIAL: Row[] = [...]`) to its
|
|
77
|
+
* Go literal, dispatched structurally off the const's `ConstantInfo.parsed`
|
|
78
|
+
* — or null when the name is not such a const (loop vars and outer-loop
|
|
79
|
+
* params are excluded, same as `resolveModuleStringConst`). `target.kind
|
|
80
|
+
* === 'go-source'` may bake a composite (array/object) literal against
|
|
81
|
+
* `target.bakeType`; `target.kind === 'template-action'` only resolves a
|
|
82
|
+
* scalar, since a `{{...}}` splice has no valid Go template spelling for a
|
|
83
|
+
* composite literal.
|
|
78
84
|
*/
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
resolveModuleBooleanConst(name: string): string | null;
|
|
85
|
+
resolveModuleConstAsGo(name: string, target: {
|
|
86
|
+
kind: 'template-action';
|
|
87
|
+
} | {
|
|
88
|
+
kind: 'go-source';
|
|
89
|
+
bakeType: TypeInfo;
|
|
90
|
+
}): string | null;
|
|
86
91
|
}
|
|
87
92
|
//# sourceMappingURL=emit-context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emit-context.d.ts","sourceRoot":"","sources":["../../src/adapter/emit-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"emit-context.d.ts","sourceRoot":"","sources":["../../src/adapter/emit-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAE3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAE1D,MAAM,WAAW,aAAa;IAC5B,2EAA2E;IAC3E,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAA;IAE5B;;;OAGG;IACH,qBAAqB,CACnB,MAAM,EAAE,MAAM,EACd,GAAG,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,UAAU,CAAA;KAAE,EAC7B,SAAS,CAAC,EAAE,UAAU,GACrB,MAAM,CAAA;IAET;;;OAGG;IACH,oBAAoB,CAClB,WAAW,EAAE,MAAM,EACnB,SAAS,CAAC,EAAE,UAAU,GACrB;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAA;IAE1C;;;;OAIG;IACH,+BAA+B,CAAC,YAAY,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,IAAI,CAAA;IAE5F;;;;;OAKG;IACH,mBAAmB,CACjB,YAAY,EAAE,MAAM,EACpB,SAAS,CAAC,EAAE,UAAU,GACrB;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAA;IAElD;;;;;;;;;OASG;IACH,0BAA0B,CACxB,MAAM,EAAE,UAAU,GAAG,SAAS,GAC7B;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAA;IAErF;;;;OAIG;IACH,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAA;IAErD;;;;;;;;;;OAUG;IACH,sBAAsB,CACpB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE;QAAE,IAAI,EAAE,iBAAiB,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,WAAW,CAAC;QAAC,QAAQ,EAAE,QAAQ,CAAA;KAAE,GAC9E,MAAM,GAAG,IAAI,CAAA;CACjB"}
|
|
@@ -1061,6 +1061,28 @@ export declare class GoTemplateAdapter extends BaseAdapter implements ParsedExpr
|
|
|
1061
1061
|
* rebinds. Outside any loop the root *is* the dot, so we emit `.Field`.
|
|
1062
1062
|
*/
|
|
1063
1063
|
private rootFieldRef;
|
|
1064
|
+
/**
|
|
1065
|
+
* #2813 / #2788: `name` may be a bare local-const alias of a signal/memo
|
|
1066
|
+
* getter (`const items__alias = items`) or a bare-props-form body
|
|
1067
|
+
* destructure's renamed prop (`const { children: kids } = props`) —
|
|
1068
|
+
* resolve it to the ALIASED entity's own name, so a caller that needs to
|
|
1069
|
+
* build its own prefixed field reference (e.g. `renderFilterExprNode`,
|
|
1070
|
+
* which must hardcode `$.` regardless of `rootFieldRef`'s
|
|
1071
|
+
* `this.inLoop`-conditional prefix — #2857) still lands on the field that
|
|
1072
|
+
* entity itself seeds (`.Items`, `.Children`) instead of a never-populated
|
|
1073
|
+
* field under the local alias (`.Items__alias`, `.Kids`). `rootFieldRef`
|
|
1074
|
+
* itself is built on top of this so there is exactly one resolution.
|
|
1075
|
+
*/
|
|
1076
|
+
private resolveRootFieldAlias;
|
|
1077
|
+
/**
|
|
1078
|
+
* Root-scope field reference from INSIDE a `.filter()`/`.find()` predicate
|
|
1079
|
+
* (#2857, #2879). Same registration + alias resolution as `rootFieldRef`,
|
|
1080
|
+
* but the `$.` prefix is unconditional: a filter predicate's `{{if}}`
|
|
1081
|
+
* always sits inside its loop's own `{{range}}` (`renderLoop` restores
|
|
1082
|
+
* `this.inLoop` before rendering it), so a bare `.Field` would resolve
|
|
1083
|
+
* against the current row's type instead of root.
|
|
1084
|
+
*/
|
|
1085
|
+
private filterRootFieldRef;
|
|
1064
1086
|
/**
|
|
1065
1087
|
* When `name` is a local binding of the `searchParams()` env signal, resolve
|
|
1066
1088
|
* it to the canonical `.SearchParams` field — not `.<Capitalized name>` — so
|
|
@@ -1090,31 +1112,42 @@ export declare class GoTemplateAdapter extends BaseAdapter implements ParsedExpr
|
|
|
1090
1112
|
*/
|
|
1091
1113
|
private resolveModuleStringConst;
|
|
1092
1114
|
/**
|
|
1093
|
-
* The single module-const lookup shared by `
|
|
1094
|
-
*
|
|
1095
|
-
*
|
|
1096
|
-
*
|
|
1097
|
-
* would grow `binding-scope-ratchet.test.ts`'s shrink-only floor for this
|
|
1098
|
-
* file (already at 5) for a shape variance the callers can express
|
|
1099
|
-
* themselves instead.
|
|
1115
|
+
* The single module-const lookup shared by `resolveModuleConstAsGo` —
|
|
1116
|
+
* kept as its own method (rather than inlined) so a second `.find(` isn't
|
|
1117
|
+
* added elsewhere, growing `binding-scope-ratchet.test.ts`'s shrink-only
|
|
1118
|
+
* floor for this file (already at 5).
|
|
1100
1119
|
*/
|
|
1101
1120
|
private findModuleConst;
|
|
1102
1121
|
/**
|
|
1103
|
-
*
|
|
1104
|
-
*
|
|
1105
|
-
*
|
|
1106
|
-
*
|
|
1107
|
-
*
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
*
|
|
1112
|
-
*
|
|
1113
|
-
*
|
|
1114
|
-
*
|
|
1115
|
-
* `
|
|
1122
|
+
* Resolve a bare identifier naming a plain module-level const (`const
|
|
1123
|
+
* TRACK = 8`, `const OPEN = true`, `const INITIAL: Row[] = [...]`, #2794 /
|
|
1124
|
+
* #2815 / #2862) to its value's Go literal — dispatched STRUCTURALLY off
|
|
1125
|
+
* `ConstantInfo.parsed`, through the same `parsedLiteralToGo` door an
|
|
1126
|
+
* inline `createSignal([...])`/`createSignal({...})` seed already takes,
|
|
1127
|
+
* rather than a separate per-type text-matching resolver for each literal
|
|
1128
|
+
* shape (the numeric/boolean resolvers this replaces, and the array/
|
|
1129
|
+
* object-literal gap #2862 tracked, were exactly that repeated pattern).
|
|
1130
|
+
* `resolveModuleStringConst` stays separate: its fixed-point text
|
|
1131
|
+
* resolution also covers a COMPOSED template-literal const (`` `${A}-${B}`
|
|
1132
|
+
* ``) that has no single structural literal to bake.
|
|
1133
|
+
*
|
|
1134
|
+
* `target` names the emission position, which constrains what can resolve
|
|
1135
|
+
* there:
|
|
1136
|
+
* - `go-source` (the `New<Component>Props` constructor) may bake a
|
|
1137
|
+
* composite (array/object) literal against `bakeType` — falling back
|
|
1138
|
+
* to the const's OWN declared type when the consumer's type is
|
|
1139
|
+
* `unknown` (the analyzer's inference is text-shaped and never chases
|
|
1140
|
+
* a bare `createSignal(INITIAL)` seed to its declaration).
|
|
1141
|
+
* - `template-action` (a bare `{{...}}` splice, e.g. a className
|
|
1142
|
+
* expression) has no valid Go template spelling for a composite
|
|
1143
|
+
* literal, so only a scalar (or unary-minus number) resolves there —
|
|
1144
|
+
* the same restriction the numeric/boolean resolvers already had.
|
|
1145
|
+
*
|
|
1146
|
+
* Scoped to module consts and guarded against loop vars so a range
|
|
1147
|
+
* variable that shadows a const name still wins (same guards the
|
|
1148
|
+
* resolvers this replaces already had).
|
|
1116
1149
|
*/
|
|
1117
|
-
private
|
|
1150
|
+
private resolveModuleConstAsGo;
|
|
1118
1151
|
literal(value: string | number | boolean | null, literalType: LiteralType): string;
|
|
1119
1152
|
call(callee: ParsedExpr, args: ParsedExpr[], emit: (e: ParsedExpr) => string): string;
|
|
1120
1153
|
member(object: ParsedExpr, property: string, _computed: boolean, optional: boolean, emit: (e: ParsedExpr) => string): string;
|
|
@@ -1343,7 +1376,7 @@ export declare class GoTemplateAdapter extends BaseAdapter implements ParsedExpr
|
|
|
1343
1376
|
* `loopVarRefCount` — so both are still consulted. Shared by the
|
|
1344
1377
|
* string-keyed fast paths (#2236, #2242 Copilot review) that resolve raw
|
|
1345
1378
|
* `jsExpr` text before `identifier()`'s own guards can see it. Mirrors the
|
|
1346
|
-
* checks in `resolveModuleStringConst` / `
|
|
1379
|
+
* checks in `resolveModuleStringConst` / `resolveModuleConstAsGo`.
|
|
1347
1380
|
*/
|
|
1348
1381
|
private isLoopShadowedName;
|
|
1349
1382
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"go-template-adapter.d.ts","sourceRoot":"","sources":["../../src/adapter/go-template-adapter.ts"],"names":[],"mappings":"AAAA,oEAAoE;AAIpE,OAAO,KAAK,EACV,WAAW,EACX,MAAM,EACN,SAAS,EACT,MAAM,EACN,YAAY,EACZ,aAAa,EACb,MAAM,EAEN,WAAW,EACX,UAAU,EACV,MAAM,EAMN,aAAa,EAEb,UAAU,EACV,qBAAqB,EAGrB,SAAS,EACT,YAAY,EACZ,aAAa,EACb,UAAU,EACV,OAAO,EAEP,yBAAyB,EAI1B,MAAM,iBAAiB,CAAA;AACxB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AAqB;IAiB7B,OAAO,CAAC,cAAc;IAWtB,OAAO,CAAC,UAAU;IAMT,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAM1C;IAED;;;;;;;;OAQG;IACH,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CA8LlC;IAED;;;;;;;OAOG;IACH,OAAO,CAAC,mBAAmB;IA0B3B,OAAO,CAAC,gBAAgB;IAiCxB;;;;;;OAMG;IACH,OAAO,CAAC,0BAA0B;IAqDlC;;;;;;OAMG;IACH,OAAO,CAAC,cAAc;IAStB,OAAO,CAAC,0BAA0B;IAyClC,iBAAiB,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM,CAKjD;IAED,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEvC;IAED,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEvC;IAED,OAAO,CAAC,kBAAkB;CAmB3B;AAED,eAAO,MAAM,iBAAiB,mBAA0B,CAAA"}
|
|
1
|
+
{"version":3,"file":"go-template-adapter.d.ts","sourceRoot":"","sources":["../../src/adapter/go-template-adapter.ts"],"names":[],"mappings":"AAAA,oEAAoE;AAIpE,OAAO,KAAK,EACV,WAAW,EACX,MAAM,EACN,SAAS,EACT,MAAM,EACN,YAAY,EACZ,aAAa,EACb,MAAM,EAEN,WAAW,EACX,UAAU,EACV,MAAM,EAMN,aAAa,EAEb,UAAU,EACV,qBAAqB,EAGrB,SAAS,EACT,YAAY,EACZ,aAAa,EACb,UAAU,EACV,OAAO,EAEP,yBAAyB,EAI1B,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,WAAW,EACX,KAAK,aAAa,EAClB,KAAK,sBAAsB,EAE3B,KAAK,iBAAiB,EAEtB,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,UAAU,EAqChB,MAAM,iBAAiB,CAAA;AA8BxB,OAAO,KAAK,EACV,WAAW,EAOX,wBAAwB,EACzB,MAAM,gB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C,kBAAkB,CA8LlC;IAED;;;;;;;OAOG;IACH,OAAO,CAAC,mBAAmB;IA0B3B,OAAO,CAAC,gBAAgB;IAiCxB;;;;;;OAMG;IACH,OAAO,CAAC,0BAA0B;IAqDlC;;;;;;OAMG;IACH,OAAO,CAAC,cAAc;IAStB,OAAO,CAAC,0BAA0B;IAyClC,iBAAiB,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM,CAKjD;IAED,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEvC;IAED,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEvC;IAED,OAAO,CAAC,kBAAkB;CAmB3B;AAED,eAAO,MAAM,iBAAiB,mBAA0B,CAAA"}
|
package/dist/adapter/index.js
CHANGED
|
@@ -1225,12 +1225,9 @@ function convertInitialValue(ctx, value, _typeInfo, propsParams, preParsed) {
|
|
|
1225
1225
|
const inlinedStr = ctx.resolveModuleStringConst(value);
|
|
1226
1226
|
if (inlinedStr !== null)
|
|
1227
1227
|
return inlinedStr;
|
|
1228
|
-
const
|
|
1229
|
-
if (
|
|
1230
|
-
return
|
|
1231
|
-
const inlinedBool = ctx.resolveModuleBooleanConst(value);
|
|
1232
|
-
if (inlinedBool !== null)
|
|
1233
|
-
return inlinedBool;
|
|
1228
|
+
const inlinedConst = ctx.resolveModuleConstAsGo(value, { kind: "go-source", bakeType: typeInfo });
|
|
1229
|
+
if (inlinedConst !== null)
|
|
1230
|
+
return inlinedConst;
|
|
1234
1231
|
}
|
|
1235
1232
|
const propName = ctx.extractPropNameFromInitialValue(value, preParsed);
|
|
1236
1233
|
const param = propName ? propsParams?.find((p) => p.name === propName) : undefined;
|
|
@@ -2952,8 +2949,7 @@ class GoTemplateAdapter extends BaseAdapter {
|
|
|
2952
2949
|
extractPropFallback: (initialValue, preParsed) => this.extractPropFallback(initialValue, preParsed),
|
|
2953
2950
|
extractCollisionDerivation: (parsed) => this.extractCollisionDerivation(parsed),
|
|
2954
2951
|
resolveModuleStringConst: (name) => this.resolveModuleStringConst(name),
|
|
2955
|
-
|
|
2956
|
-
resolveModuleBooleanConst: (name) => this.resolveModuleBooleanConst(name)
|
|
2952
|
+
resolveModuleConstAsGo: (name, target) => this.resolveModuleConstAsGo(name, target)
|
|
2957
2953
|
};
|
|
2958
2954
|
get errors() {
|
|
2959
2955
|
return this.state.errors;
|
|
@@ -5151,9 +5147,9 @@ ${goFields.join(`
|
|
|
5151
5147
|
const inlined = this.resolveModuleStringConst(name);
|
|
5152
5148
|
if (inlined !== null)
|
|
5153
5149
|
return inlined;
|
|
5154
|
-
const
|
|
5155
|
-
if (
|
|
5156
|
-
return
|
|
5150
|
+
const inlinedScalar = this.resolveModuleConstAsGo(name, { kind: "template-action" });
|
|
5151
|
+
if (inlinedScalar !== null)
|
|
5152
|
+
return inlinedScalar;
|
|
5157
5153
|
if (this.isCurrentLoopItem(name))
|
|
5158
5154
|
return ".";
|
|
5159
5155
|
if (this.isOuterLoopParam(name))
|
|
@@ -5230,11 +5226,18 @@ ${goFields.join(`
|
|
|
5230
5226
|
return hit !== null && hit.depth > 0 && hit.binding.source === "item";
|
|
5231
5227
|
}
|
|
5232
5228
|
rootFieldRef(name) {
|
|
5233
|
-
const resolved = this.
|
|
5229
|
+
const resolved = this.resolveRootFieldAlias(name);
|
|
5234
5230
|
this.state.templateReadRootFields.add(resolved);
|
|
5235
5231
|
const prefix = this.inLoop ? "$." : ".";
|
|
5236
5232
|
return `${prefix}${capitalizeFieldName(resolved)}`;
|
|
5237
5233
|
}
|
|
5234
|
+
resolveRootFieldAlias(name) {
|
|
5235
|
+
return this.state.getterAliases.get(name) ?? this.state.propDestructureAliases.get(name) ?? name;
|
|
5236
|
+
}
|
|
5237
|
+
filterRootFieldRef(name) {
|
|
5238
|
+
this.rootFieldRef(name);
|
|
5239
|
+
return `$.${capitalizeFieldName(this.resolveRootFieldAlias(name))}`;
|
|
5240
|
+
}
|
|
5238
5241
|
searchParamsFieldRef(name) {
|
|
5239
5242
|
return this.state.searchParamsLocals.has(name) ? this.rootFieldRef("searchParams") : null;
|
|
5240
5243
|
}
|
|
@@ -5256,7 +5259,7 @@ ${goFields.join(`
|
|
|
5256
5259
|
findModuleConst(name) {
|
|
5257
5260
|
return this.state.localConstants.find((k) => k.name === name && k.isModule && !k.containsArrow);
|
|
5258
5261
|
}
|
|
5259
|
-
|
|
5262
|
+
resolveModuleConstAsGo(name, target) {
|
|
5260
5263
|
if (this.isCurrentLoopItem(name))
|
|
5261
5264
|
return null;
|
|
5262
5265
|
if (this.loopVarRefCount.has(name))
|
|
@@ -5264,23 +5267,13 @@ ${goFields.join(`
|
|
|
5264
5267
|
if (this.isOuterLoopParam(name))
|
|
5265
5268
|
return null;
|
|
5266
5269
|
const c = this.findModuleConst(name);
|
|
5267
|
-
if (!c
|
|
5268
|
-
return null;
|
|
5269
|
-
const v = c.value.trim().replace(/(?<=\d)_(?=\d)/g, "");
|
|
5270
|
-
return /^-?\d+(\.\d+)?$/.test(v) ? v : null;
|
|
5271
|
-
}
|
|
5272
|
-
resolveModuleBooleanConst(name) {
|
|
5273
|
-
if (this.isCurrentLoopItem(name))
|
|
5274
|
-
return null;
|
|
5275
|
-
if (this.loopVarRefCount.has(name))
|
|
5270
|
+
if (!c?.parsed)
|
|
5276
5271
|
return null;
|
|
5277
|
-
if (
|
|
5278
|
-
return null;
|
|
5279
|
-
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
const v = c.value.trim();
|
|
5283
|
-
return v === "true" || v === "false" ? v : null;
|
|
5272
|
+
if (target.kind === "template-action") {
|
|
5273
|
+
return c.parsed.kind === "literal" || c.parsed.kind === "unary" ? parsedLiteralToGo(this.emitCtx, c.parsed) : null;
|
|
5274
|
+
}
|
|
5275
|
+
const bakeType = target.bakeType.kind !== "unknown" ? target.bakeType : c.type ?? undefined;
|
|
5276
|
+
return parsedLiteralToGo(this.emitCtx, c.parsed, bakeType);
|
|
5284
5277
|
}
|
|
5285
5278
|
literal(value, literalType) {
|
|
5286
5279
|
if (literalType === "string")
|
|
@@ -5929,11 +5922,9 @@ ${goFields.join(`
|
|
|
5929
5922
|
}
|
|
5930
5923
|
const signal = localVarMap.get(expr.name);
|
|
5931
5924
|
if (signal) {
|
|
5932
|
-
this.
|
|
5933
|
-
return `$.${capitalizeFieldName(signal)}`;
|
|
5925
|
+
return this.filterRootFieldRef(signal);
|
|
5934
5926
|
}
|
|
5935
|
-
this.
|
|
5936
|
-
return `.${capitalizeFieldName(expr.name)}`;
|
|
5927
|
+
return this.filterRootFieldRef(expr.name);
|
|
5937
5928
|
}
|
|
5938
5929
|
case "literal":
|
|
5939
5930
|
if (expr.literalType === "string") {
|
|
@@ -5947,6 +5938,9 @@ ${goFields.join(`
|
|
|
5947
5938
|
if (expr.object.kind === "identifier" && expr.object.name === param) {
|
|
5948
5939
|
return `${paramPrefix}.${capitalizeFieldName(expr.property)}`;
|
|
5949
5940
|
}
|
|
5941
|
+
if (expr.object.kind === "identifier" && this.state.propsObjectName && expr.object.name === this.state.propsObjectName) {
|
|
5942
|
+
return this.filterRootFieldRef(expr.property);
|
|
5943
|
+
}
|
|
5950
5944
|
if (expr.property === "length") {
|
|
5951
5945
|
const innerHO = this.higherOrderShapeOf(expr.object);
|
|
5952
5946
|
if (innerHO && innerHO.method === "filter") {
|
|
@@ -5965,8 +5959,7 @@ ${goFields.join(`
|
|
|
5965
5959
|
return `${paramPrefix}.${capitalizeFieldName(expr.callee.property)}`;
|
|
5966
5960
|
}
|
|
5967
5961
|
if (expr.callee.kind === "identifier" && expr.args.length === 0) {
|
|
5968
|
-
this.
|
|
5969
|
-
return `$.${capitalizeFieldName(expr.callee.name)}`;
|
|
5962
|
+
return this.filterRootFieldRef(expr.callee.name);
|
|
5970
5963
|
}
|
|
5971
5964
|
if (asCallbackMethodCall4(expr) !== null) {
|
|
5972
5965
|
return this.refuseFilterExprNode(expr);
|
|
@@ -5996,29 +5989,33 @@ ${goFields.join(`
|
|
|
5996
5989
|
const right = this.renderFilterExpr(expr.right, param, localVarMap, datumField);
|
|
5997
5990
|
if (this.filterExprUnsupported)
|
|
5998
5991
|
return "false";
|
|
5992
|
+
const wl = wrapIfMultiToken(left);
|
|
5993
|
+
const wr = wrapIfMultiToken(right);
|
|
5999
5994
|
switch (expr.op) {
|
|
6000
5995
|
case "===":
|
|
6001
5996
|
case "==":
|
|
6002
|
-
return `eq ${
|
|
5997
|
+
return `eq ${wl} ${wr}`;
|
|
6003
5998
|
case "!==":
|
|
6004
5999
|
case "!=":
|
|
6005
|
-
return `ne ${
|
|
6000
|
+
return `ne ${wl} ${wr}`;
|
|
6006
6001
|
case ">":
|
|
6007
|
-
return `gt ${
|
|
6002
|
+
return `gt ${wl} ${wr}`;
|
|
6008
6003
|
case "<":
|
|
6009
|
-
return `lt ${
|
|
6004
|
+
return `lt ${wl} ${wr}`;
|
|
6010
6005
|
case ">=":
|
|
6011
|
-
return `ge ${
|
|
6006
|
+
return `ge ${wl} ${wr}`;
|
|
6012
6007
|
case "<=":
|
|
6013
|
-
return `le ${
|
|
6008
|
+
return `le ${wl} ${wr}`;
|
|
6014
6009
|
case "+":
|
|
6015
|
-
return this._emitPlus(expr.left, expr.right,
|
|
6010
|
+
return this._emitPlus(expr.left, expr.right, wl, wr);
|
|
6016
6011
|
case "-":
|
|
6017
|
-
return `bf_sub ${
|
|
6012
|
+
return `bf_sub ${wl} ${wr}`;
|
|
6018
6013
|
case "*":
|
|
6019
|
-
return `bf_mul ${
|
|
6014
|
+
return `bf_mul ${wl} ${wr}`;
|
|
6020
6015
|
case "/":
|
|
6021
|
-
return `bf_div ${
|
|
6016
|
+
return `bf_div ${wl} ${wr}`;
|
|
6017
|
+
case "%":
|
|
6018
|
+
return `bf_mod ${wl} ${wr}`;
|
|
6022
6019
|
default:
|
|
6023
6020
|
return `${left} ${expr.op} ${right}`;
|
|
6024
6021
|
}
|
|
@@ -6469,6 +6466,9 @@ ${goFields.join(`
|
|
|
6469
6466
|
case "/":
|
|
6470
6467
|
result = `bf_div ${left} ${right}`;
|
|
6471
6468
|
break;
|
|
6469
|
+
case "%":
|
|
6470
|
+
result = `bf_mod ${left} ${right}`;
|
|
6471
|
+
break;
|
|
6472
6472
|
default:
|
|
6473
6473
|
result = `${left} ${expr.op} ${right}`;
|
|
6474
6474
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"value-lowering.d.ts","sourceRoot":"","sources":["../../../src/adapter/value/value-lowering.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAQ3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAyDtD;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,aAAa,EAClB,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,QAAQ,EACnB,WAAW,CAAC,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,EACrD,SAAS,CAAC,EAAE,UAAU,GACrB,MAAM,
|
|
1
|
+
{"version":3,"file":"value-lowering.d.ts","sourceRoot":"","sources":["../../../src/adapter/value/value-lowering.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAQ3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAyDtD;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,aAAa,EAClB,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,QAAQ,EACnB,WAAW,CAAC,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,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AM,CAAC;IAAC,IAAI,CAAC,EAAE,QAAQ,CAAC;IAAC,MAAM,CAAC,EAAE,UAAU,CAAA;CAAE,EAAE,EACzF,WAAW,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,EACpD,gBAAgB,EAAE,WAAW,CAAC,MAAM,EAAE,eAAe,CAAC,GACrD,MAAM,GAAG,IAAI,CAiBf"}
|
package/dist/index.js
CHANGED
|
@@ -1225,12 +1225,9 @@ function convertInitialValue(ctx, value, _typeInfo, propsParams, preParsed) {
|
|
|
1225
1225
|
const inlinedStr = ctx.resolveModuleStringConst(value);
|
|
1226
1226
|
if (inlinedStr !== null)
|
|
1227
1227
|
return inlinedStr;
|
|
1228
|
-
const
|
|
1229
|
-
if (
|
|
1230
|
-
return
|
|
1231
|
-
const inlinedBool = ctx.resolveModuleBooleanConst(value);
|
|
1232
|
-
if (inlinedBool !== null)
|
|
1233
|
-
return inlinedBool;
|
|
1228
|
+
const inlinedConst = ctx.resolveModuleConstAsGo(value, { kind: "go-source", bakeType: typeInfo });
|
|
1229
|
+
if (inlinedConst !== null)
|
|
1230
|
+
return inlinedConst;
|
|
1234
1231
|
}
|
|
1235
1232
|
const propName = ctx.extractPropNameFromInitialValue(value, preParsed);
|
|
1236
1233
|
const param = propName ? propsParams?.find((p) => p.name === propName) : undefined;
|
|
@@ -2952,8 +2949,7 @@ class GoTemplateAdapter extends BaseAdapter {
|
|
|
2952
2949
|
extractPropFallback: (initialValue, preParsed) => this.extractPropFallback(initialValue, preParsed),
|
|
2953
2950
|
extractCollisionDerivation: (parsed) => this.extractCollisionDerivation(parsed),
|
|
2954
2951
|
resolveModuleStringConst: (name) => this.resolveModuleStringConst(name),
|
|
2955
|
-
|
|
2956
|
-
resolveModuleBooleanConst: (name) => this.resolveModuleBooleanConst(name)
|
|
2952
|
+
resolveModuleConstAsGo: (name, target) => this.resolveModuleConstAsGo(name, target)
|
|
2957
2953
|
};
|
|
2958
2954
|
get errors() {
|
|
2959
2955
|
return this.state.errors;
|
|
@@ -5151,9 +5147,9 @@ ${goFields.join(`
|
|
|
5151
5147
|
const inlined = this.resolveModuleStringConst(name);
|
|
5152
5148
|
if (inlined !== null)
|
|
5153
5149
|
return inlined;
|
|
5154
|
-
const
|
|
5155
|
-
if (
|
|
5156
|
-
return
|
|
5150
|
+
const inlinedScalar = this.resolveModuleConstAsGo(name, { kind: "template-action" });
|
|
5151
|
+
if (inlinedScalar !== null)
|
|
5152
|
+
return inlinedScalar;
|
|
5157
5153
|
if (this.isCurrentLoopItem(name))
|
|
5158
5154
|
return ".";
|
|
5159
5155
|
if (this.isOuterLoopParam(name))
|
|
@@ -5230,11 +5226,18 @@ ${goFields.join(`
|
|
|
5230
5226
|
return hit !== null && hit.depth > 0 && hit.binding.source === "item";
|
|
5231
5227
|
}
|
|
5232
5228
|
rootFieldRef(name) {
|
|
5233
|
-
const resolved = this.
|
|
5229
|
+
const resolved = this.resolveRootFieldAlias(name);
|
|
5234
5230
|
this.state.templateReadRootFields.add(resolved);
|
|
5235
5231
|
const prefix = this.inLoop ? "$." : ".";
|
|
5236
5232
|
return `${prefix}${capitalizeFieldName(resolved)}`;
|
|
5237
5233
|
}
|
|
5234
|
+
resolveRootFieldAlias(name) {
|
|
5235
|
+
return this.state.getterAliases.get(name) ?? this.state.propDestructureAliases.get(name) ?? name;
|
|
5236
|
+
}
|
|
5237
|
+
filterRootFieldRef(name) {
|
|
5238
|
+
this.rootFieldRef(name);
|
|
5239
|
+
return `$.${capitalizeFieldName(this.resolveRootFieldAlias(name))}`;
|
|
5240
|
+
}
|
|
5238
5241
|
searchParamsFieldRef(name) {
|
|
5239
5242
|
return this.state.searchParamsLocals.has(name) ? this.rootFieldRef("searchParams") : null;
|
|
5240
5243
|
}
|
|
@@ -5256,7 +5259,7 @@ ${goFields.join(`
|
|
|
5256
5259
|
findModuleConst(name) {
|
|
5257
5260
|
return this.state.localConstants.find((k) => k.name === name && k.isModule && !k.containsArrow);
|
|
5258
5261
|
}
|
|
5259
|
-
|
|
5262
|
+
resolveModuleConstAsGo(name, target) {
|
|
5260
5263
|
if (this.isCurrentLoopItem(name))
|
|
5261
5264
|
return null;
|
|
5262
5265
|
if (this.loopVarRefCount.has(name))
|
|
@@ -5264,23 +5267,13 @@ ${goFields.join(`
|
|
|
5264
5267
|
if (this.isOuterLoopParam(name))
|
|
5265
5268
|
return null;
|
|
5266
5269
|
const c = this.findModuleConst(name);
|
|
5267
|
-
if (!c
|
|
5268
|
-
return null;
|
|
5269
|
-
const v = c.value.trim().replace(/(?<=\d)_(?=\d)/g, "");
|
|
5270
|
-
return /^-?\d+(\.\d+)?$/.test(v) ? v : null;
|
|
5271
|
-
}
|
|
5272
|
-
resolveModuleBooleanConst(name) {
|
|
5273
|
-
if (this.isCurrentLoopItem(name))
|
|
5274
|
-
return null;
|
|
5275
|
-
if (this.loopVarRefCount.has(name))
|
|
5270
|
+
if (!c?.parsed)
|
|
5276
5271
|
return null;
|
|
5277
|
-
if (
|
|
5278
|
-
return null;
|
|
5279
|
-
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
const v = c.value.trim();
|
|
5283
|
-
return v === "true" || v === "false" ? v : null;
|
|
5272
|
+
if (target.kind === "template-action") {
|
|
5273
|
+
return c.parsed.kind === "literal" || c.parsed.kind === "unary" ? parsedLiteralToGo(this.emitCtx, c.parsed) : null;
|
|
5274
|
+
}
|
|
5275
|
+
const bakeType = target.bakeType.kind !== "unknown" ? target.bakeType : c.type ?? undefined;
|
|
5276
|
+
return parsedLiteralToGo(this.emitCtx, c.parsed, bakeType);
|
|
5284
5277
|
}
|
|
5285
5278
|
literal(value, literalType) {
|
|
5286
5279
|
if (literalType === "string")
|
|
@@ -5929,11 +5922,9 @@ ${goFields.join(`
|
|
|
5929
5922
|
}
|
|
5930
5923
|
const signal = localVarMap.get(expr.name);
|
|
5931
5924
|
if (signal) {
|
|
5932
|
-
this.
|
|
5933
|
-
return `$.${capitalizeFieldName(signal)}`;
|
|
5925
|
+
return this.filterRootFieldRef(signal);
|
|
5934
5926
|
}
|
|
5935
|
-
this.
|
|
5936
|
-
return `.${capitalizeFieldName(expr.name)}`;
|
|
5927
|
+
return this.filterRootFieldRef(expr.name);
|
|
5937
5928
|
}
|
|
5938
5929
|
case "literal":
|
|
5939
5930
|
if (expr.literalType === "string") {
|
|
@@ -5947,6 +5938,9 @@ ${goFields.join(`
|
|
|
5947
5938
|
if (expr.object.kind === "identifier" && expr.object.name === param) {
|
|
5948
5939
|
return `${paramPrefix}.${capitalizeFieldName(expr.property)}`;
|
|
5949
5940
|
}
|
|
5941
|
+
if (expr.object.kind === "identifier" && this.state.propsObjectName && expr.object.name === this.state.propsObjectName) {
|
|
5942
|
+
return this.filterRootFieldRef(expr.property);
|
|
5943
|
+
}
|
|
5950
5944
|
if (expr.property === "length") {
|
|
5951
5945
|
const innerHO = this.higherOrderShapeOf(expr.object);
|
|
5952
5946
|
if (innerHO && innerHO.method === "filter") {
|
|
@@ -5965,8 +5959,7 @@ ${goFields.join(`
|
|
|
5965
5959
|
return `${paramPrefix}.${capitalizeFieldName(expr.callee.property)}`;
|
|
5966
5960
|
}
|
|
5967
5961
|
if (expr.callee.kind === "identifier" && expr.args.length === 0) {
|
|
5968
|
-
this.
|
|
5969
|
-
return `$.${capitalizeFieldName(expr.callee.name)}`;
|
|
5962
|
+
return this.filterRootFieldRef(expr.callee.name);
|
|
5970
5963
|
}
|
|
5971
5964
|
if (asCallbackMethodCall4(expr) !== null) {
|
|
5972
5965
|
return this.refuseFilterExprNode(expr);
|
|
@@ -5996,29 +5989,33 @@ ${goFields.join(`
|
|
|
5996
5989
|
const right = this.renderFilterExpr(expr.right, param, localVarMap, datumField);
|
|
5997
5990
|
if (this.filterExprUnsupported)
|
|
5998
5991
|
return "false";
|
|
5992
|
+
const wl = wrapIfMultiToken(left);
|
|
5993
|
+
const wr = wrapIfMultiToken(right);
|
|
5999
5994
|
switch (expr.op) {
|
|
6000
5995
|
case "===":
|
|
6001
5996
|
case "==":
|
|
6002
|
-
return `eq ${
|
|
5997
|
+
return `eq ${wl} ${wr}`;
|
|
6003
5998
|
case "!==":
|
|
6004
5999
|
case "!=":
|
|
6005
|
-
return `ne ${
|
|
6000
|
+
return `ne ${wl} ${wr}`;
|
|
6006
6001
|
case ">":
|
|
6007
|
-
return `gt ${
|
|
6002
|
+
return `gt ${wl} ${wr}`;
|
|
6008
6003
|
case "<":
|
|
6009
|
-
return `lt ${
|
|
6004
|
+
return `lt ${wl} ${wr}`;
|
|
6010
6005
|
case ">=":
|
|
6011
|
-
return `ge ${
|
|
6006
|
+
return `ge ${wl} ${wr}`;
|
|
6012
6007
|
case "<=":
|
|
6013
|
-
return `le ${
|
|
6008
|
+
return `le ${wl} ${wr}`;
|
|
6014
6009
|
case "+":
|
|
6015
|
-
return this._emitPlus(expr.left, expr.right,
|
|
6010
|
+
return this._emitPlus(expr.left, expr.right, wl, wr);
|
|
6016
6011
|
case "-":
|
|
6017
|
-
return `bf_sub ${
|
|
6012
|
+
return `bf_sub ${wl} ${wr}`;
|
|
6018
6013
|
case "*":
|
|
6019
|
-
return `bf_mul ${
|
|
6014
|
+
return `bf_mul ${wl} ${wr}`;
|
|
6020
6015
|
case "/":
|
|
6021
|
-
return `bf_div ${
|
|
6016
|
+
return `bf_div ${wl} ${wr}`;
|
|
6017
|
+
case "%":
|
|
6018
|
+
return `bf_mod ${wl} ${wr}`;
|
|
6022
6019
|
default:
|
|
6023
6020
|
return `${left} ${expr.op} ${right}`;
|
|
6024
6021
|
}
|
|
@@ -6469,6 +6466,9 @@ ${goFields.join(`
|
|
|
6469
6466
|
case "/":
|
|
6470
6467
|
result = `bf_div ${left} ${right}`;
|
|
6471
6468
|
break;
|
|
6469
|
+
case "%":
|
|
6470
|
+
result = `bf_mod ${left} ${right}`;
|
|
6471
|
+
break;
|
|
6472
6472
|
default:
|
|
6473
6473
|
result = `${left} ${expr.op} ${right}`;
|
|
6474
6474
|
}
|
package/dist/vite.js
CHANGED
|
@@ -6524,12 +6524,9 @@ function convertInitialValue(ctx, value, _typeInfo, propsParams, preParsed) {
|
|
|
6524
6524
|
const inlinedStr = ctx.resolveModuleStringConst(value);
|
|
6525
6525
|
if (inlinedStr !== null)
|
|
6526
6526
|
return inlinedStr;
|
|
6527
|
-
const
|
|
6528
|
-
if (
|
|
6529
|
-
return
|
|
6530
|
-
const inlinedBool = ctx.resolveModuleBooleanConst(value);
|
|
6531
|
-
if (inlinedBool !== null)
|
|
6532
|
-
return inlinedBool;
|
|
6527
|
+
const inlinedConst = ctx.resolveModuleConstAsGo(value, { kind: "go-source", bakeType: typeInfo });
|
|
6528
|
+
if (inlinedConst !== null)
|
|
6529
|
+
return inlinedConst;
|
|
6533
6530
|
}
|
|
6534
6531
|
const propName = ctx.extractPropNameFromInitialValue(value, preParsed);
|
|
6535
6532
|
const param = propName ? propsParams?.find((p) => p.name === propName) : undefined;
|
|
@@ -8238,8 +8235,7 @@ class GoTemplateAdapter extends BaseAdapter {
|
|
|
8238
8235
|
extractPropFallback: (initialValue, preParsed) => this.extractPropFallback(initialValue, preParsed),
|
|
8239
8236
|
extractCollisionDerivation: (parsed) => this.extractCollisionDerivation(parsed),
|
|
8240
8237
|
resolveModuleStringConst: (name) => this.resolveModuleStringConst(name),
|
|
8241
|
-
|
|
8242
|
-
resolveModuleBooleanConst: (name) => this.resolveModuleBooleanConst(name)
|
|
8238
|
+
resolveModuleConstAsGo: (name, target) => this.resolveModuleConstAsGo(name, target)
|
|
8243
8239
|
};
|
|
8244
8240
|
get errors() {
|
|
8245
8241
|
return this.state.errors;
|
|
@@ -10437,9 +10433,9 @@ ${goFields.join(`
|
|
|
10437
10433
|
const inlined = this.resolveModuleStringConst(name);
|
|
10438
10434
|
if (inlined !== null)
|
|
10439
10435
|
return inlined;
|
|
10440
|
-
const
|
|
10441
|
-
if (
|
|
10442
|
-
return
|
|
10436
|
+
const inlinedScalar = this.resolveModuleConstAsGo(name, { kind: "template-action" });
|
|
10437
|
+
if (inlinedScalar !== null)
|
|
10438
|
+
return inlinedScalar;
|
|
10443
10439
|
if (this.isCurrentLoopItem(name))
|
|
10444
10440
|
return ".";
|
|
10445
10441
|
if (this.isOuterLoopParam(name))
|
|
@@ -10516,11 +10512,18 @@ ${goFields.join(`
|
|
|
10516
10512
|
return hit !== null && hit.depth > 0 && hit.binding.source === "item";
|
|
10517
10513
|
}
|
|
10518
10514
|
rootFieldRef(name) {
|
|
10519
|
-
const resolved = this.
|
|
10515
|
+
const resolved = this.resolveRootFieldAlias(name);
|
|
10520
10516
|
this.state.templateReadRootFields.add(resolved);
|
|
10521
10517
|
const prefix = this.inLoop ? "$." : ".";
|
|
10522
10518
|
return `${prefix}${capitalizeFieldName(resolved)}`;
|
|
10523
10519
|
}
|
|
10520
|
+
resolveRootFieldAlias(name) {
|
|
10521
|
+
return this.state.getterAliases.get(name) ?? this.state.propDestructureAliases.get(name) ?? name;
|
|
10522
|
+
}
|
|
10523
|
+
filterRootFieldRef(name) {
|
|
10524
|
+
this.rootFieldRef(name);
|
|
10525
|
+
return `$.${capitalizeFieldName(this.resolveRootFieldAlias(name))}`;
|
|
10526
|
+
}
|
|
10524
10527
|
searchParamsFieldRef(name) {
|
|
10525
10528
|
return this.state.searchParamsLocals.has(name) ? this.rootFieldRef("searchParams") : null;
|
|
10526
10529
|
}
|
|
@@ -10542,7 +10545,7 @@ ${goFields.join(`
|
|
|
10542
10545
|
findModuleConst(name) {
|
|
10543
10546
|
return this.state.localConstants.find((k) => k.name === name && k.isModule && !k.containsArrow);
|
|
10544
10547
|
}
|
|
10545
|
-
|
|
10548
|
+
resolveModuleConstAsGo(name, target) {
|
|
10546
10549
|
if (this.isCurrentLoopItem(name))
|
|
10547
10550
|
return null;
|
|
10548
10551
|
if (this.loopVarRefCount.has(name))
|
|
@@ -10550,23 +10553,13 @@ ${goFields.join(`
|
|
|
10550
10553
|
if (this.isOuterLoopParam(name))
|
|
10551
10554
|
return null;
|
|
10552
10555
|
const c = this.findModuleConst(name);
|
|
10553
|
-
if (!c
|
|
10554
|
-
return null;
|
|
10555
|
-
const v = c.value.trim().replace(/(?<=\d)_(?=\d)/g, "");
|
|
10556
|
-
return /^-?\d+(\.\d+)?$/.test(v) ? v : null;
|
|
10557
|
-
}
|
|
10558
|
-
resolveModuleBooleanConst(name) {
|
|
10559
|
-
if (this.isCurrentLoopItem(name))
|
|
10560
|
-
return null;
|
|
10561
|
-
if (this.loopVarRefCount.has(name))
|
|
10556
|
+
if (!c?.parsed)
|
|
10562
10557
|
return null;
|
|
10563
|
-
if (
|
|
10564
|
-
return null;
|
|
10565
|
-
|
|
10566
|
-
|
|
10567
|
-
|
|
10568
|
-
const v = c.value.trim();
|
|
10569
|
-
return v === "true" || v === "false" ? v : null;
|
|
10558
|
+
if (target.kind === "template-action") {
|
|
10559
|
+
return c.parsed.kind === "literal" || c.parsed.kind === "unary" ? parsedLiteralToGo(this.emitCtx, c.parsed) : null;
|
|
10560
|
+
}
|
|
10561
|
+
const bakeType = target.bakeType.kind !== "unknown" ? target.bakeType : c.type ?? undefined;
|
|
10562
|
+
return parsedLiteralToGo(this.emitCtx, c.parsed, bakeType);
|
|
10570
10563
|
}
|
|
10571
10564
|
literal(value, literalType) {
|
|
10572
10565
|
if (literalType === "string")
|
|
@@ -11215,11 +11208,9 @@ ${goFields.join(`
|
|
|
11215
11208
|
}
|
|
11216
11209
|
const signal = localVarMap.get(expr.name);
|
|
11217
11210
|
if (signal) {
|
|
11218
|
-
this.
|
|
11219
|
-
return `$.${capitalizeFieldName(signal)}`;
|
|
11211
|
+
return this.filterRootFieldRef(signal);
|
|
11220
11212
|
}
|
|
11221
|
-
this.
|
|
11222
|
-
return `.${capitalizeFieldName(expr.name)}`;
|
|
11213
|
+
return this.filterRootFieldRef(expr.name);
|
|
11223
11214
|
}
|
|
11224
11215
|
case "literal":
|
|
11225
11216
|
if (expr.literalType === "string") {
|
|
@@ -11233,6 +11224,9 @@ ${goFields.join(`
|
|
|
11233
11224
|
if (expr.object.kind === "identifier" && expr.object.name === param) {
|
|
11234
11225
|
return `${paramPrefix}.${capitalizeFieldName(expr.property)}`;
|
|
11235
11226
|
}
|
|
11227
|
+
if (expr.object.kind === "identifier" && this.state.propsObjectName && expr.object.name === this.state.propsObjectName) {
|
|
11228
|
+
return this.filterRootFieldRef(expr.property);
|
|
11229
|
+
}
|
|
11236
11230
|
if (expr.property === "length") {
|
|
11237
11231
|
const innerHO = this.higherOrderShapeOf(expr.object);
|
|
11238
11232
|
if (innerHO && innerHO.method === "filter") {
|
|
@@ -11251,8 +11245,7 @@ ${goFields.join(`
|
|
|
11251
11245
|
return `${paramPrefix}.${capitalizeFieldName(expr.callee.property)}`;
|
|
11252
11246
|
}
|
|
11253
11247
|
if (expr.callee.kind === "identifier" && expr.args.length === 0) {
|
|
11254
|
-
this.
|
|
11255
|
-
return `$.${capitalizeFieldName(expr.callee.name)}`;
|
|
11248
|
+
return this.filterRootFieldRef(expr.callee.name);
|
|
11256
11249
|
}
|
|
11257
11250
|
if (asCallbackMethodCall(expr) !== null) {
|
|
11258
11251
|
return this.refuseFilterExprNode(expr);
|
|
@@ -11282,29 +11275,33 @@ ${goFields.join(`
|
|
|
11282
11275
|
const right = this.renderFilterExpr(expr.right, param, localVarMap, datumField);
|
|
11283
11276
|
if (this.filterExprUnsupported)
|
|
11284
11277
|
return "false";
|
|
11278
|
+
const wl = wrapIfMultiToken(left);
|
|
11279
|
+
const wr = wrapIfMultiToken(right);
|
|
11285
11280
|
switch (expr.op) {
|
|
11286
11281
|
case "===":
|
|
11287
11282
|
case "==":
|
|
11288
|
-
return `eq ${
|
|
11283
|
+
return `eq ${wl} ${wr}`;
|
|
11289
11284
|
case "!==":
|
|
11290
11285
|
case "!=":
|
|
11291
|
-
return `ne ${
|
|
11286
|
+
return `ne ${wl} ${wr}`;
|
|
11292
11287
|
case ">":
|
|
11293
|
-
return `gt ${
|
|
11288
|
+
return `gt ${wl} ${wr}`;
|
|
11294
11289
|
case "<":
|
|
11295
|
-
return `lt ${
|
|
11290
|
+
return `lt ${wl} ${wr}`;
|
|
11296
11291
|
case ">=":
|
|
11297
|
-
return `ge ${
|
|
11292
|
+
return `ge ${wl} ${wr}`;
|
|
11298
11293
|
case "<=":
|
|
11299
|
-
return `le ${
|
|
11294
|
+
return `le ${wl} ${wr}`;
|
|
11300
11295
|
case "+":
|
|
11301
|
-
return this._emitPlus(expr.left, expr.right,
|
|
11296
|
+
return this._emitPlus(expr.left, expr.right, wl, wr);
|
|
11302
11297
|
case "-":
|
|
11303
|
-
return `bf_sub ${
|
|
11298
|
+
return `bf_sub ${wl} ${wr}`;
|
|
11304
11299
|
case "*":
|
|
11305
|
-
return `bf_mul ${
|
|
11300
|
+
return `bf_mul ${wl} ${wr}`;
|
|
11306
11301
|
case "/":
|
|
11307
|
-
return `bf_div ${
|
|
11302
|
+
return `bf_div ${wl} ${wr}`;
|
|
11303
|
+
case "%":
|
|
11304
|
+
return `bf_mod ${wl} ${wr}`;
|
|
11308
11305
|
default:
|
|
11309
11306
|
return `${left} ${expr.op} ${right}`;
|
|
11310
11307
|
}
|
|
@@ -11755,6 +11752,9 @@ ${goFields.join(`
|
|
|
11755
11752
|
case "/":
|
|
11756
11753
|
result = `bf_div ${left} ${right}`;
|
|
11757
11754
|
break;
|
|
11755
|
+
case "%":
|
|
11756
|
+
result = `bf_mod ${left} ${right}`;
|
|
11757
|
+
break;
|
|
11758
11758
|
default:
|
|
11759
11759
|
result = `${left} ${expr.op} ${right}`;
|
|
11760
11760
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@barefootjs/go-template",
|
|
3
|
-
"version": "0.35.
|
|
3
|
+
"version": "0.35.2",
|
|
4
4
|
"description": "Go html/template adapter for BarefootJS - generates Go template files from IR",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"directory": "packages/adapter-go-template"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@barefootjs/shared": "0.35.
|
|
52
|
+
"@barefootjs/shared": "0.35.2"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"@barefootjs/jsx": ">=0.2.0",
|
|
@@ -67,9 +67,9 @@
|
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"@barefootjs/adapter-tests": "0.1.0",
|
|
70
|
-
"@barefootjs/client": "0.35.
|
|
71
|
-
"@barefootjs/jsx": "0.35.
|
|
72
|
-
"@barefootjs/vite": "0.35.
|
|
70
|
+
"@barefootjs/client": "0.35.2",
|
|
71
|
+
"@barefootjs/jsx": "0.35.2",
|
|
72
|
+
"@barefootjs/vite": "0.35.2",
|
|
73
73
|
"vite": "^6.0.0"
|
|
74
74
|
}
|
|
75
75
|
}
|
|
@@ -1641,7 +1641,7 @@ export function Widget(props: P) {
|
|
|
1641
1641
|
// to `nil` — the analyzer types it `unknown` since it never chases an
|
|
1642
1642
|
// identifier to its declaration, so none of convertInitialValue's typed
|
|
1643
1643
|
// branches saw it (#2794). Now resolved via the same
|
|
1644
|
-
// resolveModuleStringConst/
|
|
1644
|
+
// resolveModuleStringConst/resolveModuleConstAsGo the adapter
|
|
1645
1645
|
// already used for live template expressions (template-interp.ts).
|
|
1646
1646
|
test('signal seeded from a module-level const bakes its literal value, not nil', () => {
|
|
1647
1647
|
const adapter = new GoTemplateAdapter()
|
|
@@ -6208,7 +6208,7 @@ export function Nested({ groups }: { groups: { label: string }[][] }) {
|
|
|
6208
6208
|
// goes through `identifier()` (the `ParsedExprEmitter` method), which
|
|
6209
6209
|
// already carries the loop-shadow guards (`loopParamStack` /
|
|
6210
6210
|
// `isOuterLoopParam`, mirrored from `resolveModuleStringConst` /
|
|
6211
|
-
// `
|
|
6211
|
+
// `resolveModuleConstAsGo`). So a `.map((count) => ...)` callback param
|
|
6212
6212
|
// that shadows an outer `const count = 7` got the OUTER literal inlined at
|
|
6213
6213
|
// the `data-key` position even though the text position (which DOES go
|
|
6214
6214
|
// through `identifier()`) correctly resolved to the per-item value.
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* genuinely needs it, so the seam documents the real cross-module coupling.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import type { ParsedExpr } from '@barefootjs/jsx'
|
|
17
|
+
import type { ParsedExpr, TypeInfo } from '@barefootjs/jsx'
|
|
18
18
|
|
|
19
19
|
import type { CompileState } from './lib/compile-state.ts'
|
|
20
20
|
|
|
@@ -81,16 +81,18 @@ export interface GoEmitContext {
|
|
|
81
81
|
resolveModuleStringConst(name: string): string | null
|
|
82
82
|
|
|
83
83
|
/**
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
84
|
+
* Resolve a bare identifier naming a plain module-level const (`const
|
|
85
|
+
* TRACK = 8`, `const OPEN = true`, `const INITIAL: Row[] = [...]`) to its
|
|
86
|
+
* Go literal, dispatched structurally off the const's `ConstantInfo.parsed`
|
|
87
|
+
* — or null when the name is not such a const (loop vars and outer-loop
|
|
88
|
+
* params are excluded, same as `resolveModuleStringConst`). `target.kind
|
|
89
|
+
* === 'go-source'` may bake a composite (array/object) literal against
|
|
90
|
+
* `target.bakeType`; `target.kind === 'template-action'` only resolves a
|
|
91
|
+
* scalar, since a `{{...}}` splice has no valid Go template spelling for a
|
|
92
|
+
* composite literal.
|
|
87
93
|
*/
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
* (`true`/`false`), or null when the name is not such a const (same
|
|
93
|
-
* exclusions as `resolveModuleNumericConst`).
|
|
94
|
-
*/
|
|
95
|
-
resolveModuleBooleanConst(name: string): string | null
|
|
94
|
+
resolveModuleConstAsGo(
|
|
95
|
+
name: string,
|
|
96
|
+
target: { kind: 'template-action' } | { kind: 'go-source'; bakeType: TypeInfo },
|
|
97
|
+
): string | null
|
|
96
98
|
}
|
|
@@ -262,8 +262,7 @@ export class GoTemplateAdapter extends BaseAdapter implements ParsedExprEmitter,
|
|
|
262
262
|
extractPropFallback: (initialValue, preParsed) => this.extractPropFallback(initialValue, preParsed),
|
|
263
263
|
extractCollisionDerivation: (parsed) => this.extractCollisionDerivation(parsed),
|
|
264
264
|
resolveModuleStringConst: (name) => this.resolveModuleStringConst(name),
|
|
265
|
-
|
|
266
|
-
resolveModuleBooleanConst: (name) => this.resolveModuleBooleanConst(name),
|
|
265
|
+
resolveModuleConstAsGo: (name, target) => this.resolveModuleConstAsGo(name, target),
|
|
267
266
|
}
|
|
268
267
|
|
|
269
268
|
/** Diagnostics from the current compile (backed by `CompileState`); `generate()` also merges these into `ir.errors`. */
|
|
@@ -4726,11 +4725,12 @@ export class GoTemplateAdapter extends BaseAdapter implements ParsedExprEmitter,
|
|
|
4726
4725
|
}
|
|
4727
4726
|
const inlined = this.resolveModuleStringConst(name)
|
|
4728
4727
|
if (inlined !== null) return inlined
|
|
4729
|
-
// Module
|
|
4730
|
-
// inline the literal value rather than emit
|
|
4731
|
-
// field that never exists. Mirrors the
|
|
4732
|
-
const
|
|
4733
|
-
|
|
4728
|
+
// Module scalar const (e.g. `const TRACK = 8` used in a width expression,
|
|
4729
|
+
// or `const OPEN = true`): inline the literal value rather than emit
|
|
4730
|
+
// `{{.TRACK}}` against a Props field that never exists. Mirrors the
|
|
4731
|
+
// string-const inlining above.
|
|
4732
|
+
const inlinedScalar = this.resolveModuleConstAsGo(name, { kind: 'template-action' })
|
|
4733
|
+
if (inlinedScalar !== null) return inlinedScalar
|
|
4734
4734
|
if (this.isCurrentLoopItem(name)) return '.'
|
|
4735
4735
|
// An *outer* loop's value variable (we're in a nested loop) is in scope as
|
|
4736
4736
|
// the Go range variable `$name` declared by that loop's `{{range … := …}}`;
|
|
@@ -4866,19 +4866,41 @@ export class GoTemplateAdapter extends BaseAdapter implements ParsedExprEmitter,
|
|
|
4866
4866
|
* rebinds. Outside any loop the root *is* the dot, so we emit `.Field`.
|
|
4867
4867
|
*/
|
|
4868
4868
|
private rootFieldRef(name: string): string {
|
|
4869
|
-
|
|
4870
|
-
// signal/memo getter (`const items__alias = items`) or a bare-props-
|
|
4871
|
-
// form body destructure's renamed prop (`const { children: kids } =
|
|
4872
|
-
// props`) — resolve it to the ALIASED entity's own name FIRST, so the
|
|
4873
|
-
// emitted field matches what that entity itself seeds (`.Items`,
|
|
4874
|
-
// `.Children`) instead of registering a second, never-populated field
|
|
4875
|
-
// under the local alias (`.Items__alias`, `.Kids`).
|
|
4876
|
-
const resolved = this.state.getterAliases.get(name) ?? this.state.propDestructureAliases.get(name) ?? name
|
|
4869
|
+
const resolved = this.resolveRootFieldAlias(name)
|
|
4877
4870
|
this.state.templateReadRootFields.add(resolved)
|
|
4878
4871
|
const prefix = this.inLoop ? '$.' : '.'
|
|
4879
4872
|
return `${prefix}${capitalizeFieldName(resolved)}`
|
|
4880
4873
|
}
|
|
4881
4874
|
|
|
4875
|
+
/**
|
|
4876
|
+
* #2813 / #2788: `name` may be a bare local-const alias of a signal/memo
|
|
4877
|
+
* getter (`const items__alias = items`) or a bare-props-form body
|
|
4878
|
+
* destructure's renamed prop (`const { children: kids } = props`) —
|
|
4879
|
+
* resolve it to the ALIASED entity's own name, so a caller that needs to
|
|
4880
|
+
* build its own prefixed field reference (e.g. `renderFilterExprNode`,
|
|
4881
|
+
* which must hardcode `$.` regardless of `rootFieldRef`'s
|
|
4882
|
+
* `this.inLoop`-conditional prefix — #2857) still lands on the field that
|
|
4883
|
+
* entity itself seeds (`.Items`, `.Children`) instead of a never-populated
|
|
4884
|
+
* field under the local alias (`.Items__alias`, `.Kids`). `rootFieldRef`
|
|
4885
|
+
* itself is built on top of this so there is exactly one resolution.
|
|
4886
|
+
*/
|
|
4887
|
+
private resolveRootFieldAlias(name: string): string {
|
|
4888
|
+
return this.state.getterAliases.get(name) ?? this.state.propDestructureAliases.get(name) ?? name
|
|
4889
|
+
}
|
|
4890
|
+
|
|
4891
|
+
/**
|
|
4892
|
+
* Root-scope field reference from INSIDE a `.filter()`/`.find()` predicate
|
|
4893
|
+
* (#2857, #2879). Same registration + alias resolution as `rootFieldRef`,
|
|
4894
|
+
* but the `$.` prefix is unconditional: a filter predicate's `{{if}}`
|
|
4895
|
+
* always sits inside its loop's own `{{range}}` (`renderLoop` restores
|
|
4896
|
+
* `this.inLoop` before rendering it), so a bare `.Field` would resolve
|
|
4897
|
+
* against the current row's type instead of root.
|
|
4898
|
+
*/
|
|
4899
|
+
private filterRootFieldRef(name: string): string {
|
|
4900
|
+
this.rootFieldRef(name)
|
|
4901
|
+
return `$.${capitalizeFieldName(this.resolveRootFieldAlias(name))}`
|
|
4902
|
+
}
|
|
4903
|
+
|
|
4882
4904
|
/**
|
|
4883
4905
|
* When `name` is a local binding of the `searchParams()` env signal, resolve
|
|
4884
4906
|
* it to the canonical `.SearchParams` field — not `.<Capitalized name>` — so
|
|
@@ -4926,13 +4948,10 @@ export class GoTemplateAdapter extends BaseAdapter implements ParsedExprEmitter,
|
|
|
4926
4948
|
}
|
|
4927
4949
|
|
|
4928
4950
|
/**
|
|
4929
|
-
* The single module-const lookup shared by `
|
|
4930
|
-
*
|
|
4931
|
-
*
|
|
4932
|
-
*
|
|
4933
|
-
* would grow `binding-scope-ratchet.test.ts`'s shrink-only floor for this
|
|
4934
|
-
* file (already at 5) for a shape variance the callers can express
|
|
4935
|
-
* themselves instead.
|
|
4951
|
+
* The single module-const lookup shared by `resolveModuleConstAsGo` —
|
|
4952
|
+
* kept as its own method (rather than inlined) so a second `.find(` isn't
|
|
4953
|
+
* added elsewhere, growing `binding-scope-ratchet.test.ts`'s shrink-only
|
|
4954
|
+
* floor for this file (already at 5).
|
|
4936
4955
|
*/
|
|
4937
4956
|
private findModuleConst(name: string): ConstantInfo | undefined {
|
|
4938
4957
|
return this.state.localConstants.find(
|
|
@@ -4941,40 +4960,50 @@ export class GoTemplateAdapter extends BaseAdapter implements ParsedExprEmitter,
|
|
|
4941
4960
|
}
|
|
4942
4961
|
|
|
4943
4962
|
/**
|
|
4944
|
-
*
|
|
4945
|
-
*
|
|
4946
|
-
*
|
|
4947
|
-
*
|
|
4948
|
-
*
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
*
|
|
4965
|
-
*
|
|
4966
|
-
*
|
|
4967
|
-
*
|
|
4968
|
-
*
|
|
4963
|
+
* Resolve a bare identifier naming a plain module-level const (`const
|
|
4964
|
+
* TRACK = 8`, `const OPEN = true`, `const INITIAL: Row[] = [...]`, #2794 /
|
|
4965
|
+
* #2815 / #2862) to its value's Go literal — dispatched STRUCTURALLY off
|
|
4966
|
+
* `ConstantInfo.parsed`, through the same `parsedLiteralToGo` door an
|
|
4967
|
+
* inline `createSignal([...])`/`createSignal({...})` seed already takes,
|
|
4968
|
+
* rather than a separate per-type text-matching resolver for each literal
|
|
4969
|
+
* shape (the numeric/boolean resolvers this replaces, and the array/
|
|
4970
|
+
* object-literal gap #2862 tracked, were exactly that repeated pattern).
|
|
4971
|
+
* `resolveModuleStringConst` stays separate: its fixed-point text
|
|
4972
|
+
* resolution also covers a COMPOSED template-literal const (`` `${A}-${B}`
|
|
4973
|
+
* ``) that has no single structural literal to bake.
|
|
4974
|
+
*
|
|
4975
|
+
* `target` names the emission position, which constrains what can resolve
|
|
4976
|
+
* there:
|
|
4977
|
+
* - `go-source` (the `New<Component>Props` constructor) may bake a
|
|
4978
|
+
* composite (array/object) literal against `bakeType` — falling back
|
|
4979
|
+
* to the const's OWN declared type when the consumer's type is
|
|
4980
|
+
* `unknown` (the analyzer's inference is text-shaped and never chases
|
|
4981
|
+
* a bare `createSignal(INITIAL)` seed to its declaration).
|
|
4982
|
+
* - `template-action` (a bare `{{...}}` splice, e.g. a className
|
|
4983
|
+
* expression) has no valid Go template spelling for a composite
|
|
4984
|
+
* literal, so only a scalar (or unary-minus number) resolves there —
|
|
4985
|
+
* the same restriction the numeric/boolean resolvers already had.
|
|
4986
|
+
*
|
|
4987
|
+
* Scoped to module consts and guarded against loop vars so a range
|
|
4988
|
+
* variable that shadows a const name still wins (same guards the
|
|
4989
|
+
* resolvers this replaces already had).
|
|
4969
4990
|
*/
|
|
4970
|
-
private
|
|
4991
|
+
private resolveModuleConstAsGo(
|
|
4992
|
+
name: string,
|
|
4993
|
+
target: { kind: 'template-action' } | { kind: 'go-source'; bakeType: TypeInfo },
|
|
4994
|
+
): string | null {
|
|
4971
4995
|
if (this.isCurrentLoopItem(name)) return null
|
|
4972
4996
|
if (this.loopVarRefCount.has(name)) return null
|
|
4973
4997
|
if (this.isOuterLoopParam(name)) return null
|
|
4974
4998
|
const c = this.findModuleConst(name)
|
|
4975
|
-
if (!c
|
|
4976
|
-
|
|
4977
|
-
|
|
4999
|
+
if (!c?.parsed) return null
|
|
5000
|
+
if (target.kind === 'template-action') {
|
|
5001
|
+
return c.parsed.kind === 'literal' || c.parsed.kind === 'unary'
|
|
5002
|
+
? parsedLiteralToGo(this.emitCtx, c.parsed)
|
|
5003
|
+
: null
|
|
5004
|
+
}
|
|
5005
|
+
const bakeType = target.bakeType.kind !== 'unknown' ? target.bakeType : (c.type ?? undefined)
|
|
5006
|
+
return parsedLiteralToGo(this.emitCtx, c.parsed, bakeType)
|
|
4978
5007
|
}
|
|
4979
5008
|
|
|
4980
5009
|
literal(value: string | number | boolean | null, literalType: LiteralType): string {
|
|
@@ -6212,12 +6241,28 @@ export class GoTemplateAdapter extends BaseAdapter implements ParsedExprEmitter,
|
|
|
6212
6241
|
// prefix because a filter predicate must always escape back to
|
|
6213
6242
|
// root regardless of loop nesting; call it only for its
|
|
6214
6243
|
// registration side effect and keep the prefix here (pullfrog
|
|
6215
|
-
// review, PR #2818).
|
|
6216
|
-
|
|
6217
|
-
|
|
6244
|
+
// review, PR #2818). The field name itself DOES go through
|
|
6245
|
+
// `resolveRootFieldAlias` (#2857) so a getter-alias local
|
|
6246
|
+
// (`const items__alias = items`) still emits the field the
|
|
6247
|
+
// signal itself seeds instead of a phantom `.Items__alias`.
|
|
6248
|
+
return this.filterRootFieldRef(signal)
|
|
6218
6249
|
}
|
|
6219
|
-
|
|
6220
|
-
|
|
6250
|
+
// Any other identifier reaching here is ALSO a root-scope
|
|
6251
|
+
// reference (a memo, a plain derived const, or — #2857 — a
|
|
6252
|
+
// bare-props-form destructured/renamed prop) rather than the
|
|
6253
|
+
// loop's own param, so it needs the same unconditional `$.`
|
|
6254
|
+
// escape as the signal branch above, for the same reason: a
|
|
6255
|
+
// `.filter().map()` JSX loop's `{{if}}` gate (built from
|
|
6256
|
+
// `loop.filterPredicate` a few hundred lines below, via
|
|
6257
|
+
// `renderPredicateCondition` → this method) always sits inside
|
|
6258
|
+
// that loop's own `{{range}}`, never at the template's un-rebound
|
|
6259
|
+
// root, so `rootFieldRef`'s own `this.inLoop`-conditional prefix
|
|
6260
|
+
// would be wrong here even without the alias bug — a bare
|
|
6261
|
+
// `.Field` resolves against the CURRENT LOOP ITEM's type, not
|
|
6262
|
+
// root, and `html/template` panics at execute time (`can't
|
|
6263
|
+
// evaluate field ... in type ...`) the first time such a
|
|
6264
|
+
// reference is exercised.
|
|
6265
|
+
return this.filterRootFieldRef(expr.name)
|
|
6221
6266
|
}
|
|
6222
6267
|
|
|
6223
6268
|
case 'literal':
|
|
@@ -6234,6 +6279,18 @@ export class GoTemplateAdapter extends BaseAdapter implements ParsedExprEmitter,
|
|
|
6234
6279
|
if (expr.object.kind === 'identifier' && expr.object.name === param) {
|
|
6235
6280
|
return `${paramPrefix}.${capitalizeFieldName(expr.property)}`
|
|
6236
6281
|
}
|
|
6282
|
+
// props.x on a bare-props-form component (#2879): props are
|
|
6283
|
+
// flattened onto the root struct, so this is a root-scope read
|
|
6284
|
+
// (`$.X`), not `.Props.X`. Mirrors `renderConditionExpr`'s own
|
|
6285
|
+
// `propsObjectName` branch; `props.a.b` still reaches root through
|
|
6286
|
+
// the generic recursion below.
|
|
6287
|
+
if (
|
|
6288
|
+
expr.object.kind === 'identifier' &&
|
|
6289
|
+
this.state.propsObjectName &&
|
|
6290
|
+
expr.object.name === this.state.propsObjectName
|
|
6291
|
+
) {
|
|
6292
|
+
return this.filterRootFieldRef(expr.property)
|
|
6293
|
+
}
|
|
6237
6294
|
// `.length` on a higher-order filter result (e.g.
|
|
6238
6295
|
// `x.tags.filter(t => t.active).length > 0`). Reuse
|
|
6239
6296
|
// `renderFilterLengthExpr` so the inner filter lowers to
|
|
@@ -6262,11 +6319,11 @@ export class GoTemplateAdapter extends BaseAdapter implements ParsedExprEmitter,
|
|
|
6262
6319
|
return `${paramPrefix}.${capitalizeFieldName(expr.callee.property)}`
|
|
6263
6320
|
}
|
|
6264
6321
|
// Signal calls: `filter()` -> `$.Filter`. Same registration-only
|
|
6265
|
-
// `rootFieldRef` call
|
|
6322
|
+
// `rootFieldRef` call — and the same `resolveRootFieldAlias` field
|
|
6323
|
+
// resolution (#2857) — as the `identifier` case above, for the same
|
|
6266
6324
|
// reason (#2700's BF101 gate; pullfrog review, PR #2818).
|
|
6267
6325
|
if (expr.callee.kind === 'identifier' && expr.args.length === 0) {
|
|
6268
|
-
this.
|
|
6269
|
-
return `$.${capitalizeFieldName(expr.callee.name)}`
|
|
6326
|
+
return this.filterRootFieldRef(expr.callee.name)
|
|
6270
6327
|
}
|
|
6271
6328
|
// A nested callback method call (`other.some(r => …)`) reaching this
|
|
6272
6329
|
// arm has no Go template form in filter context — the fallthrough
|
|
@@ -6302,30 +6359,50 @@ export class GoTemplateAdapter extends BaseAdapter implements ParsedExprEmitter,
|
|
|
6302
6359
|
if (this.filterExprUnsupported) return 'false'
|
|
6303
6360
|
const right = this.renderFilterExpr(expr.right, param, localVarMap, datumField)
|
|
6304
6361
|
if (this.filterExprUnsupported) return 'false'
|
|
6362
|
+
// #2873 (pullfrog review, PR #2882): every case below is a prefix
|
|
6363
|
+
// function call (`bf_mod a b`, `eq a b`, …), so a COMPOUND operand —
|
|
6364
|
+
// itself a nested binary result like `bf_mod .N 2` — must be
|
|
6365
|
+
// parenthesised or the template parser folds its tokens into the
|
|
6366
|
+
// outer call's argument list (`eq bf_mod .N 2 0` hands `eq` four
|
|
6367
|
+
// args, and a bare func-name argument like `bf_mod` there is called
|
|
6368
|
+
// with ZERO args instead of nested: `wrong number of args for
|
|
6369
|
+
// bf_mod: want 2 got 0`). Mirrors the general (non-filter) binary
|
|
6370
|
+
// emitter's `wl`/`wr` wrapping (`wrapIfMultiToken`, above) — this
|
|
6371
|
+
// switch had never applied it, so `-`/`*`/`/` had the identical
|
|
6372
|
+
// pre-existing gap for a nested compound operand.
|
|
6373
|
+
const wl = wrapIfMultiToken(left)
|
|
6374
|
+
const wr = wrapIfMultiToken(right)
|
|
6305
6375
|
|
|
6306
6376
|
switch (expr.op) {
|
|
6307
6377
|
case '===':
|
|
6308
6378
|
case '==':
|
|
6309
|
-
return `eq ${
|
|
6379
|
+
return `eq ${wl} ${wr}`
|
|
6310
6380
|
case '!==':
|
|
6311
6381
|
case '!=':
|
|
6312
|
-
return `ne ${
|
|
6382
|
+
return `ne ${wl} ${wr}`
|
|
6313
6383
|
case '>':
|
|
6314
|
-
return `gt ${
|
|
6384
|
+
return `gt ${wl} ${wr}`
|
|
6315
6385
|
case '<':
|
|
6316
|
-
return `lt ${
|
|
6386
|
+
return `lt ${wl} ${wr}`
|
|
6317
6387
|
case '>=':
|
|
6318
|
-
return `ge ${
|
|
6388
|
+
return `ge ${wl} ${wr}`
|
|
6319
6389
|
case '<=':
|
|
6320
|
-
return `le ${
|
|
6390
|
+
return `le ${wl} ${wr}`
|
|
6321
6391
|
case '+':
|
|
6322
|
-
return this._emitPlus(expr.left, expr.right,
|
|
6392
|
+
return this._emitPlus(expr.left, expr.right, wl, wr)
|
|
6323
6393
|
case '-':
|
|
6324
|
-
return `bf_sub ${
|
|
6394
|
+
return `bf_sub ${wl} ${wr}`
|
|
6325
6395
|
case '*':
|
|
6326
|
-
return `bf_mul ${
|
|
6396
|
+
return `bf_mul ${wl} ${wr}`
|
|
6327
6397
|
case '/':
|
|
6328
|
-
return `bf_div ${
|
|
6398
|
+
return `bf_div ${wl} ${wr}`
|
|
6399
|
+
case '%':
|
|
6400
|
+
// #2873: mirrors the general binary emitter's `%` case (below,
|
|
6401
|
+
// `bf_mod`) — this switch previously had no `%` case, so the
|
|
6402
|
+
// `default` arm emitted a literal ` % ` into the template text,
|
|
6403
|
+
// which `html/template` can't parse (`unexpected "%" in
|
|
6404
|
+
// operand`).
|
|
6405
|
+
return `bf_mod ${wl} ${wr}`
|
|
6329
6406
|
default:
|
|
6330
6407
|
return `${left} ${expr.op} ${right}`
|
|
6331
6408
|
}
|
|
@@ -6571,7 +6648,7 @@ export class GoTemplateAdapter extends BaseAdapter implements ParsedExprEmitter,
|
|
|
6571
6648
|
* `loopVarRefCount` — so both are still consulted. Shared by the
|
|
6572
6649
|
* string-keyed fast paths (#2236, #2242 Copilot review) that resolve raw
|
|
6573
6650
|
* `jsExpr` text before `identifier()`'s own guards can see it. Mirrors the
|
|
6574
|
-
* checks in `resolveModuleStringConst` / `
|
|
6651
|
+
* checks in `resolveModuleStringConst` / `resolveModuleConstAsGo`.
|
|
6575
6652
|
*/
|
|
6576
6653
|
private isLoopShadowedName(name: string): boolean {
|
|
6577
6654
|
return this.scope.isBound(name) || this.loopVarRefCount.has(name)
|
|
@@ -7127,6 +7204,15 @@ export class GoTemplateAdapter extends BaseAdapter implements ParsedExprEmitter,
|
|
|
7127
7204
|
result = `bf_mul ${left} ${right}`; break
|
|
7128
7205
|
case '/':
|
|
7129
7206
|
result = `bf_div ${left} ${right}`; break
|
|
7207
|
+
case '%':
|
|
7208
|
+
// #2873: this switch had no `%` case even though
|
|
7209
|
+
// `needsParensInGoTemplate` (above) already treats `%` as an
|
|
7210
|
+
// arithmetic operator needing parens — so the `default` arm
|
|
7211
|
+
// below emitted a literal ` % ` into a ternary/condition's
|
|
7212
|
+
// template text, which `html/template` can't parse
|
|
7213
|
+
// (`unexpected "%" in operand`). Mirrors the general binary
|
|
7214
|
+
// emitter's `%` case (`bf_mod`, outside condition position).
|
|
7215
|
+
result = `bf_mod ${left} ${right}`; break
|
|
7130
7216
|
default:
|
|
7131
7217
|
result = `${left} ${expr.op} ${right}`
|
|
7132
7218
|
}
|
|
@@ -94,9 +94,10 @@ export function convertInitialValue(
|
|
|
94
94
|
if (param) {
|
|
95
95
|
return propRef(param)
|
|
96
96
|
}
|
|
97
|
-
// Module-const seed (#2794): a signal seeded from a bare
|
|
98
|
-
// that refers to a module-level const (`const PAYLOAD = 'x';
|
|
99
|
-
// createSignal(PAYLOAD)
|
|
97
|
+
// Module-const seed (#2794/#2815/#2862): a signal seeded from a bare
|
|
98
|
+
// identifier that refers to a module-level const (`const PAYLOAD = 'x';
|
|
99
|
+
// createSignal(PAYLOAD)`, or `const INITIAL: Row[] = [...];
|
|
100
|
+
// createSignal(INITIAL)`) types `unknown` — the analyzer's type
|
|
100
101
|
// inference is text-shaped and never chases an identifier to its
|
|
101
102
|
// declaration — so none of the typed branches below ever see it and
|
|
102
103
|
// this used to fall through to the final `nil`. Checked AFTER the
|
|
@@ -107,10 +108,8 @@ export function convertInitialValue(
|
|
|
107
108
|
// leaving that case on the pre-existing `nil` path unchanged.
|
|
108
109
|
const inlinedStr = ctx.resolveModuleStringConst(value)
|
|
109
110
|
if (inlinedStr !== null) return inlinedStr
|
|
110
|
-
const
|
|
111
|
-
if (
|
|
112
|
-
const inlinedBool = ctx.resolveModuleBooleanConst(value)
|
|
113
|
-
if (inlinedBool !== null) return inlinedBool
|
|
111
|
+
const inlinedConst = ctx.resolveModuleConstAsGo(value, { kind: 'go-source', bakeType: typeInfo })
|
|
112
|
+
if (inlinedConst !== null) return inlinedConst
|
|
114
113
|
}
|
|
115
114
|
|
|
116
115
|
const propName = ctx.extractPropNameFromInitialValue(value, preParsed)
|