ember-source 7.1.0-alpha.2 → 7.1.0-alpha.3
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/build-metadata.json +3 -3
- package/dist/dev/packages/@ember/-internals/glimmer/index.js +7 -7
- package/dist/dev/packages/@ember/application/index.js +5 -5
- package/dist/dev/packages/@ember/application/instance.js +4 -4
- package/dist/dev/packages/@ember/component/helper.js +4 -4
- package/dist/dev/packages/@ember/component/index.js +4 -4
- package/dist/dev/packages/@ember/component/template-only.js +2 -2
- package/dist/dev/packages/@ember/engine/index.js +5 -5
- package/dist/dev/packages/@ember/helper/index.js +5 -5
- package/dist/dev/packages/@ember/modifier/index.js +4 -4
- package/dist/dev/packages/@ember/modifier/on.js +2 -2
- package/dist/dev/packages/@ember/renderer/index.js +4 -4
- package/dist/dev/packages/@ember/routing/index.js +4 -4
- package/dist/dev/packages/@ember/template/index.js +4 -4
- package/dist/dev/packages/@ember/template-compiler/lib/compile-options.js +7 -5
- package/dist/dev/packages/@ember/template-compiler/lib/plugins/auto-import-builtins.js +18 -0
- package/dist/dev/packages/@ember/template-compiler/lib/plugins/index.js +1 -1
- package/dist/dev/packages/@ember/template-compiler/lib/plugins/transform-resolutions.js +1 -1
- package/dist/dev/packages/@ember/template-compiler/lib/template.js +2 -2
- package/dist/dev/packages/@ember/template-factory/index.js +1 -1
- package/dist/dev/packages/@glimmer/destroyable/index.js +5 -1
- package/dist/dev/packages/@glimmer/node/index.js +4 -4
- package/dist/dev/packages/@glimmer/opcode-compiler/index.js +2 -2
- package/dist/dev/packages/@glimmer/program/index.js +1 -1
- package/dist/dev/packages/@glimmer/runtime/index.js +5 -5
- package/dist/dev/packages/ember/version.js +1 -1
- package/dist/dev/packages/ember-template-compiler/index.js +3 -3
- package/dist/dev/packages/shared-chunks/{compiler-BenCxenr.js → compiler-D1leQ3Gl.js} +90 -88
- package/dist/dev/packages/shared-chunks/{constants-DKn6zqFX.js → constants-p7AL-pog.js} +1 -1
- package/dist/dev/packages/shared-chunks/{dynamic-Cu9Xpdzc.js → dynamic-BfDKO5NI.js} +6 -7
- package/dist/dev/packages/shared-chunks/{element-builder-Dw_Ic9cD.js → element-builder-DO43ztVP.js} +2 -2
- package/dist/dev/packages/shared-chunks/{index-CtPSmMCE.js → index-BUPd6pkm.js} +15 -17
- package/dist/dev/packages/shared-chunks/{index-AD_RxZjB.js → index-QZstta6s.js} +6 -6
- package/dist/dev/packages/shared-chunks/{invoke-D0D6CvD5.js → invoke-CgfoEtMT.js} +1 -1
- package/dist/dev/packages/shared-chunks/{program-context-yOi1EExe.js → program-context-sJz0oHOA.js} +1 -1
- package/dist/dev/packages/shared-chunks/{rehydrate-builder-CfBtYUkk.js → rehydrate-builder-CEk2KOIk.js} +3 -5
- package/dist/dev/packages/shared-chunks/{render-t-LAXUYI.js → render-C1HzKUcM.js} +4 -4
- package/dist/dev/packages/shared-chunks/{serialize-builder-BUG9CxHC.js → serialize-builder-CPKxdfiH.js} +3 -3
- package/dist/dev/packages/shared-chunks/{setup-registry-CxXWLs26.js → setup-registry-B7-RknRf.js} +6 -6
- package/dist/dev/packages/shared-chunks/{transform-resolutions-fXGQKGsL.js → transform-resolutions-D-YtZ0_g.js} +2 -2
- package/dist/prod/packages/@ember/-internals/glimmer/index.js +9 -9
- package/dist/prod/packages/@ember/-internals/metal/index.js +10 -10
- package/dist/prod/packages/@ember/-internals/routing/index.js +2 -2
- package/dist/prod/packages/@ember/-internals/runtime/lib/mixins/-proxy.js +4 -4
- package/dist/prod/packages/@ember/-internals/runtime/lib/mixins/action_handler.js +2 -2
- package/dist/prod/packages/@ember/-internals/runtime/lib/mixins/target_action_support.js +3 -3
- package/dist/prod/packages/@ember/-internals/views/lib/mixins/action_support.js +2 -2
- package/dist/prod/packages/@ember/-internals/views/lib/system/event_dispatcher.js +3 -3
- package/dist/prod/packages/@ember/-internals/views/lib/views/core_view.js +3 -3
- package/dist/prod/packages/@ember/application/index.js +8 -8
- package/dist/prod/packages/@ember/application/instance.js +8 -8
- package/dist/prod/packages/@ember/application/namespace.js +3 -3
- package/dist/prod/packages/@ember/array/index.js +5 -5
- package/dist/prod/packages/@ember/array/proxy.js +5 -5
- package/dist/prod/packages/@ember/component/helper.js +6 -6
- package/dist/prod/packages/@ember/component/index.js +6 -6
- package/dist/prod/packages/@ember/component/template-only.js +4 -4
- package/dist/prod/packages/@ember/controller/index.js +4 -4
- package/dist/prod/packages/@ember/debug/container-debug-adapter.js +2 -2
- package/dist/prod/packages/@ember/debug/data-adapter.js +2 -2
- package/dist/prod/packages/@ember/engine/index.js +9 -9
- package/dist/prod/packages/@ember/helper/index.js +8 -8
- package/dist/prod/packages/@ember/modifier/index.js +6 -6
- package/dist/prod/packages/@ember/modifier/on.js +4 -4
- package/dist/prod/packages/@ember/object/-internals.js +2 -2
- package/dist/prod/packages/@ember/object/compat.js +2 -2
- package/dist/prod/packages/@ember/object/computed.js +4 -4
- package/dist/prod/packages/@ember/object/core.js +2 -2
- package/dist/prod/packages/@ember/object/evented.js +3 -3
- package/dist/prod/packages/@ember/object/events.js +2 -2
- package/dist/prod/packages/@ember/object/index.js +6 -6
- package/dist/prod/packages/@ember/object/internals.js +2 -2
- package/dist/prod/packages/@ember/object/lib/computed/computed_macros.js +5 -5
- package/dist/prod/packages/@ember/object/lib/computed/reduce_computed_macros.js +3 -3
- package/dist/prod/packages/@ember/object/mixin.js +3 -3
- package/dist/prod/packages/@ember/object/observable.js +5 -5
- package/dist/prod/packages/@ember/object/observers.js +2 -2
- package/dist/prod/packages/@ember/object/promise-proxy-mixin.js +4 -4
- package/dist/prod/packages/@ember/renderer/index.js +6 -6
- package/dist/prod/packages/@ember/routing/index.js +6 -6
- package/dist/prod/packages/@ember/routing/lib/generate_controller.js +2 -2
- package/dist/prod/packages/@ember/routing/lib/routing-service.js +2 -2
- package/dist/prod/packages/@ember/routing/lib/utils.js +2 -2
- package/dist/prod/packages/@ember/routing/route.js +6 -6
- package/dist/prod/packages/@ember/routing/router-service.js +2 -2
- package/dist/prod/packages/@ember/routing/router.js +4 -4
- package/dist/prod/packages/@ember/runloop/index.js +2 -2
- package/dist/prod/packages/@ember/service/index.js +3 -3
- package/dist/prod/packages/@ember/template/index.js +6 -6
- package/dist/prod/packages/@ember/template-compiler/lib/compile-options.js +9 -7
- package/dist/prod/packages/@ember/template-compiler/lib/plugins/auto-import-builtins.js +18 -0
- package/dist/prod/packages/@ember/template-compiler/lib/plugins/index.js +1 -1
- package/dist/prod/packages/@ember/template-compiler/lib/plugins/transform-resolutions.js +1 -1
- package/dist/prod/packages/@ember/template-compiler/lib/template.js +4 -4
- package/dist/prod/packages/@ember/template-factory/index.js +3 -3
- package/dist/prod/packages/@ember/utils/lib/is_empty.js +2 -2
- package/dist/prod/packages/@glimmer/destroyable/index.js +5 -1
- package/dist/prod/packages/@glimmer/manager/index.js +4 -4
- package/dist/prod/packages/@glimmer/node/index.js +6 -6
- package/dist/prod/packages/@glimmer/opcode-compiler/index.js +3 -3
- package/dist/prod/packages/@glimmer/program/index.js +1 -1
- package/dist/prod/packages/@glimmer/runtime/index.js +6 -6
- package/dist/prod/packages/@glimmer/tracking/index.js +3 -3
- package/dist/prod/packages/@glimmer/tracking/primitives/cache/index.js +2 -2
- package/dist/prod/packages/ember/version.js +1 -1
- package/dist/prod/packages/ember-template-compiler/index.js +4 -4
- package/dist/prod/packages/shared-chunks/{alias-BkT-0B1G.js → alias-BLBQkche.js} +3 -3
- package/dist/prod/packages/shared-chunks/{api-Co-k4HVs.js → api-DtWa0ZaF.js} +1 -1
- package/dist/prod/packages/shared-chunks/{array-EwekEvId.js → array-kVQfzrQn.js} +2 -2
- package/dist/prod/packages/shared-chunks/{capabilities-DGmQ_mz4.js → capabilities-DXA-L0iT.js} +1 -1
- package/dist/prod/packages/shared-chunks/{compiler-Rwrmj1ki.js → compiler-Bbki2GT_.js} +53 -92
- package/dist/prod/packages/shared-chunks/{constants-CB3pk7dH.js → constants-2M371WiB.js} +4 -4
- package/dist/prod/packages/shared-chunks/{element-builder-DbktcGKV.js → element-builder-BmLF0C-1.js} +2 -4
- package/dist/prod/packages/shared-chunks/{fragment-EpVz5Xuc.js → fragment-D7nBU9ae.js} +16 -1
- package/dist/prod/packages/shared-chunks/{index-BVy-auLZ.js → index-6pnzcm45.js} +13 -13
- package/dist/prod/packages/shared-chunks/{index-nW__r2nX.js → index-CjaDF9kC.js} +2 -10
- package/dist/prod/packages/shared-chunks/{injected_property-DL3vQoFA.js → injected_property-CTVs5FPh.js} +1 -1
- package/dist/prod/packages/shared-chunks/{invoke-BuwCkcVB.js → invoke-BdJCXD-b.js} +3 -3
- package/dist/prod/packages/shared-chunks/{namespace_search-Aog9nySA.js → namespace_search-Dcdalhj6.js} +1 -1
- package/dist/prod/packages/shared-chunks/{observers-R1ZklwWy.js → observers-tZ2aOzr4.js} +1 -1
- package/dist/prod/packages/shared-chunks/{on-ByzWKBWe.js → on-CLxdmpmk.js} +4 -11
- package/dist/prod/packages/shared-chunks/{program-context-BdUXf-jj.js → program-context-DFiwaPMR.js} +2 -2
- package/dist/prod/packages/shared-chunks/{property_set-O080KTKZ.js → property_set-B2sZxeCw.js} +2 -2
- package/dist/prod/packages/shared-chunks/{rehydrate-builder-M_dh82nR.js → rehydrate-builder-CUefZL4I.js} +3 -7
- package/dist/prod/packages/shared-chunks/{render-DJ-BzvgU.js → render-BlriW61t.js} +4 -6
- package/dist/prod/packages/shared-chunks/{serialize-builder-BpVMgrCr.js → serialize-builder-DgpXSc2Q.js} +5 -5
- package/dist/prod/packages/shared-chunks/{set_properties-CjsDTRey.js → set_properties-C1T46IiN.js} +3 -3
- package/dist/prod/packages/shared-chunks/{setup-registry-KYxkFexK.js → setup-registry-DeObnZ2Z.js} +8 -8
- package/dist/prod/packages/shared-chunks/{tracked-ChVNBE2f.js → tracked-Cl5l4v8b.js} +1 -1
- package/dist/prod/packages/shared-chunks/{transform-resolutions-C7wq_Q_c.js → transform-resolutions-DR4GLmR2.js} +0 -3
- package/docs/data.json +185 -145
- package/package.json +3 -1
- package/types/stable/@glimmer/syntax/lib/source/source.d.ts +2 -1
- package/dist/prod/packages/shared-chunks/assert-CUCJBR2C.js +0 -19
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import './debug-to-string-CFb7h0lY.js';
|
|
2
|
-
import { S as SourceOffset, a as SourceSpan, c as cannotReplaceOrRemoveInKeyHandlerYet, d as cannotRemoveNode, e as cannotReplaceNode, f as SYNTHETIC_LOCATION, i as isVoidTag, E as EntityParser, g as EventedTokenizer, n as namedCharRefs, N as NON_EXISTENT_LOCATION, p as parseWithoutProcessing, h as parse, b as build, v as voidMap, j as STRICT_RESOLUTION, T as Template$1, B as Block, k as NamedBlock$1, l as SourceSlice, A as Args$1, P as PositionalArguments, m as NamedArgument$1, o as NamedArguments$1, H as HtmlAttr, q as SplatAttr$1, C as ComponentArg, r as PathExpression$1, K as KeywordExpression, s as ThisReference, t as ArgReference, F as FreeVarReference, L as LocalVarReference, u as CallExpression$1, I as InterpolateExpression$1, w as LiteralExpression, x as AppendContent, y as ElementModifier, z as NamedBlocks$1, D as InvokeBlock$1, G as SimpleElement$1, J as InvokeComponent$1, M as SpanList, O as LooseModeResolution, Q as COMPONENT_NAMESPACE, R as MODIFIER_NAMESPACE, U as HELPER_NAMESPACE, V as HtmlText, W as HtmlComment, X as GlimmerComment, Y as Printer, Z as node, _ as isLiteral$1, $ as maybeLoc, a0 as loc } from './transform-resolutions-
|
|
2
|
+
import { S as SourceOffset, a as SourceSpan, c as cannotReplaceOrRemoveInKeyHandlerYet, d as cannotRemoveNode, e as cannotReplaceNode, f as SYNTHETIC_LOCATION, i as isVoidTag, E as EntityParser, g as EventedTokenizer, n as namedCharRefs, N as NON_EXISTENT_LOCATION, p as parseWithoutProcessing, h as parse, b as build, v as voidMap, j as STRICT_RESOLUTION, T as Template$1, B as Block, k as NamedBlock$1, l as SourceSlice, A as Args$1, P as PositionalArguments, m as NamedArgument$1, o as NamedArguments$1, H as HtmlAttr, q as SplatAttr$1, C as ComponentArg, r as PathExpression$1, K as KeywordExpression, s as ThisReference, t as ArgReference, F as FreeVarReference, L as LocalVarReference, u as CallExpression$1, I as InterpolateExpression$1, w as LiteralExpression, x as AppendContent, y as ElementModifier, z as NamedBlocks$1, D as InvokeBlock$1, G as SimpleElement$1, J as InvokeComponent$1, M as SpanList, O as LooseModeResolution, Q as COMPONENT_NAMESPACE, R as MODIFIER_NAMESPACE, U as HELPER_NAMESPACE, V as HtmlText, W as HtmlComment, X as GlimmerComment, Y as Printer, Z as node, _ as isLiteral$1, $ as maybeLoc, a0 as loc } from './transform-resolutions-D-YtZ0_g.js';
|
|
3
3
|
import { a as assert } from './assert-CUCJBR2C.js';
|
|
4
4
|
import { s as setLocalDebugType } from './debug-brand-B1TWjOCH.js';
|
|
5
5
|
import { SexpOpcodes as opcodes, WellKnownTagNames, WellKnownAttrNames } from '../@glimmer/wire-format/index.js';
|
|
@@ -52,10 +52,14 @@ class Source {
|
|
|
52
52
|
static from(source, options = {}) {
|
|
53
53
|
return new Source(source, options.meta?.moduleName);
|
|
54
54
|
}
|
|
55
|
+
|
|
56
|
+
/** Char offset of each `\n` in the source. */
|
|
57
|
+
#newlineOffsets;
|
|
55
58
|
constructor(source, module = 'an unknown module') {
|
|
56
59
|
this.source = source;
|
|
57
60
|
this.module = module;
|
|
58
61
|
setLocalDebugType('syntax:source', this);
|
|
62
|
+
this.#newlineOffsets = computeNewlineOffsets(source);
|
|
59
63
|
}
|
|
60
64
|
|
|
61
65
|
/**
|
|
@@ -89,58 +93,59 @@ class Source {
|
|
|
89
93
|
});
|
|
90
94
|
}
|
|
91
95
|
hbsPosFor(offset) {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
99
|
-
while (true) {
|
|
100
|
-
let nextLine = this.source.indexOf('\n', seenChars);
|
|
101
|
-
if (offset <= nextLine || nextLine === -1) {
|
|
102
|
-
return {
|
|
103
|
-
line: seenLines + 1,
|
|
104
|
-
column: offset - seenChars
|
|
105
|
-
};
|
|
106
|
-
} else {
|
|
107
|
-
seenLines += 1;
|
|
108
|
-
seenChars = nextLine + 1;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
96
|
+
if (offset < 0 || offset > this.source.length) return null;
|
|
97
|
+
const lineIdx = lowerBound(this.#newlineOffsets, offset);
|
|
98
|
+
return {
|
|
99
|
+
line: lineIdx + 1,
|
|
100
|
+
column: offset - this.#lineStartFor(lineIdx)
|
|
101
|
+
};
|
|
111
102
|
}
|
|
112
|
-
charPosFor(
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
{
|
|
129
|
-
let roundTrip = this.hbsPosFor(seenChars + column);
|
|
130
|
-
assert(roundTrip.line === line);
|
|
131
|
-
assert(roundTrip.column === column);
|
|
132
|
-
}
|
|
133
|
-
return seenChars + column;
|
|
134
|
-
} else if (nextLine === -1) {
|
|
135
|
-
return 0;
|
|
136
|
-
} else {
|
|
137
|
-
seenLines += 1;
|
|
138
|
-
seenChars = nextLine + 1;
|
|
103
|
+
charPosFor({
|
|
104
|
+
line,
|
|
105
|
+
column
|
|
106
|
+
}) {
|
|
107
|
+
const lineIdx = line - 1;
|
|
108
|
+
// Valid lines are [0, newlineOffsets.length]. Anything else has no offset.
|
|
109
|
+
if (lineIdx < 0 || lineIdx > this.#newlineOffsets.length || column < 0) return null;
|
|
110
|
+
const lineStart = lineIdx === 0 ? 0 : this.#newlineOffsets[lineIdx - 1] + 1;
|
|
111
|
+
const lineEnd = this.#newlineOffsets[lineIdx] ?? this.source.length;
|
|
112
|
+
const target = lineStart + column;
|
|
113
|
+
if (target <= lineEnd) {
|
|
114
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
115
|
+
{
|
|
116
|
+
const roundTrip = this.hbsPosFor(target);
|
|
117
|
+
(!(roundTrip.line === line) && assert(roundTrip.line === line));
|
|
118
|
+
(!(roundTrip.column === column) && assert(roundTrip.column === column));
|
|
139
119
|
}
|
|
120
|
+
return target;
|
|
140
121
|
}
|
|
141
|
-
return
|
|
122
|
+
return lineEnd;
|
|
123
|
+
}
|
|
124
|
+
#lineStartFor(lineIdx) {
|
|
125
|
+
if (lineIdx === 0) return 0;
|
|
126
|
+
const prevNl = this.#newlineOffsets[lineIdx - 1];
|
|
127
|
+
return prevNl === undefined ? 0 : prevNl + 1;
|
|
142
128
|
}
|
|
143
129
|
}
|
|
130
|
+
function computeNewlineOffsets(source) {
|
|
131
|
+
const offsets = [];
|
|
132
|
+
for (let i = source.indexOf('\n'); i !== -1; i = source.indexOf('\n', i + 1)) {
|
|
133
|
+
offsets.push(i);
|
|
134
|
+
}
|
|
135
|
+
return offsets;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/** Lower-bound binary search: smallest i with arr[i] >= target, else arr.length. */
|
|
139
|
+
function lowerBound(arr, target) {
|
|
140
|
+
let lo = 0;
|
|
141
|
+
let hi = arr.length;
|
|
142
|
+
while (lo < hi) {
|
|
143
|
+
const mid = lo + hi >>> 1;
|
|
144
|
+
// mid is in [lo, hi) so always a valid index.
|
|
145
|
+
if (arr[mid] < target) lo = mid + 1;else hi = mid;
|
|
146
|
+
}
|
|
147
|
+
return lo;
|
|
148
|
+
}
|
|
144
149
|
|
|
145
150
|
function generateSyntaxError(message, location) {
|
|
146
151
|
let {
|
|
@@ -253,8 +258,6 @@ function getNodeHandler(visitor, nodeType) {
|
|
|
253
258
|
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
254
259
|
if (visitor.Program) {
|
|
255
260
|
if (nodeType === 'Template' && !visitor.Template || nodeType === 'Block' && !visitor.Block) {
|
|
256
|
-
|
|
257
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
258
261
|
return visitor.Program;
|
|
259
262
|
}
|
|
260
263
|
}
|
|
@@ -504,7 +507,7 @@ function buildBlock(path, params, hash, _defaultBlock, _elseBlock = null, loc, o
|
|
|
504
507
|
defaultBlock = _defaultBlock;
|
|
505
508
|
}
|
|
506
509
|
if (_elseBlock?.type === 'Template') {
|
|
507
|
-
assert(_elseBlock.blockParams.length === 0);
|
|
510
|
+
(!(_elseBlock.blockParams.length === 0) && assert(_elseBlock.blockParams.length === 0));
|
|
508
511
|
elseBlock = b.blockItself({
|
|
509
512
|
params: [],
|
|
510
513
|
body: _elseBlock.body,
|
|
@@ -581,11 +584,11 @@ function buildElement(tag, options = {}) {
|
|
|
581
584
|
}
|
|
582
585
|
} else if ('type' in tag) {
|
|
583
586
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- supports JS users
|
|
584
|
-
assert(tag.type === 'PathExpression', `Invalid tag type ${tag.type}`);
|
|
587
|
+
(!(tag.type === 'PathExpression') && assert(tag.type === 'PathExpression', `Invalid tag type ${tag.type}`));
|
|
585
588
|
path = tag;
|
|
586
589
|
} else if ('path' in tag) {
|
|
587
590
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- supports JS users
|
|
588
|
-
assert(tag.path.type === 'PathExpression', `Invalid tag type ${tag.path.type}`);
|
|
591
|
+
(!(tag.path.type === 'PathExpression') && assert(tag.path.type === 'PathExpression', `Invalid tag type ${tag.path.type}`));
|
|
589
592
|
path = tag.path;
|
|
590
593
|
selfClosing = tag.selfClosing;
|
|
591
594
|
} else {
|
|
@@ -690,7 +693,7 @@ function buildPath(path, loc) {
|
|
|
690
693
|
if ('type' in path) {
|
|
691
694
|
return path;
|
|
692
695
|
} else {
|
|
693
|
-
assert(path.head.indexOf('.') === -1);
|
|
696
|
+
(!(path.head.indexOf('.') === -1) && assert(path.head.indexOf('.') === -1));
|
|
694
697
|
let {
|
|
695
698
|
head,
|
|
696
699
|
tail
|
|
@@ -876,7 +879,8 @@ function buildLegacyPath({
|
|
|
876
879
|
head,
|
|
877
880
|
tail,
|
|
878
881
|
get original() {
|
|
879
|
-
|
|
882
|
+
const head = this.head.original;
|
|
883
|
+
return this.tail.length === 0 ? head : `${head}.${this.tail.join('.')}`;
|
|
880
884
|
},
|
|
881
885
|
set original(value) {
|
|
882
886
|
let [head, ...tail] = asPresentArray(value.split('.'));
|
|
@@ -1236,8 +1240,8 @@ class Builders {
|
|
|
1236
1240
|
return _name;
|
|
1237
1241
|
},
|
|
1238
1242
|
set name(value) {
|
|
1239
|
-
assert(value[0] === '@');
|
|
1240
|
-
assert(value.indexOf('.') === -1);
|
|
1243
|
+
(!(value[0] === '@') && assert(value[0] === '@'));
|
|
1244
|
+
(!(value.indexOf('.') === -1) && assert(value.indexOf('.') === -1));
|
|
1241
1245
|
_name = value;
|
|
1242
1246
|
},
|
|
1243
1247
|
get original() {
|
|
@@ -1264,8 +1268,8 @@ class Builders {
|
|
|
1264
1268
|
return _name;
|
|
1265
1269
|
},
|
|
1266
1270
|
set name(value) {
|
|
1267
|
-
assert(value[0] !== '@');
|
|
1268
|
-
assert(value.indexOf('.') === -1);
|
|
1271
|
+
(!(value[0] !== '@') && assert(value[0] !== '@'));
|
|
1272
|
+
(!(value.indexOf('.') === -1) && assert(value.indexOf('.') === -1));
|
|
1269
1273
|
_name = value;
|
|
1270
1274
|
},
|
|
1271
1275
|
get original() {
|
|
@@ -1354,27 +1358,27 @@ class Parser {
|
|
|
1354
1358
|
}
|
|
1355
1359
|
get currentTag() {
|
|
1356
1360
|
let node = this.currentNode;
|
|
1357
|
-
assert(node && (node.type === 'StartTag' || node.type === 'EndTag'));
|
|
1361
|
+
(!(node && (node.type === 'StartTag' || node.type === 'EndTag')) && assert(node && (node.type === 'StartTag' || node.type === 'EndTag')));
|
|
1358
1362
|
return node;
|
|
1359
1363
|
}
|
|
1360
1364
|
get currentStartTag() {
|
|
1361
1365
|
let node = this.currentNode;
|
|
1362
|
-
assert(node && node.type === 'StartTag');
|
|
1366
|
+
(!(node && node.type === 'StartTag') && assert(node && node.type === 'StartTag'));
|
|
1363
1367
|
return node;
|
|
1364
1368
|
}
|
|
1365
1369
|
get currentEndTag() {
|
|
1366
1370
|
let node = this.currentNode;
|
|
1367
|
-
assert(node && node.type === 'EndTag');
|
|
1371
|
+
(!(node && node.type === 'EndTag') && assert(node && node.type === 'EndTag'));
|
|
1368
1372
|
return node;
|
|
1369
1373
|
}
|
|
1370
1374
|
get currentComment() {
|
|
1371
1375
|
let node = this.currentNode;
|
|
1372
|
-
assert(node && node.type === 'CommentStatement');
|
|
1376
|
+
(!(node && node.type === 'CommentStatement') && assert(node && node.type === 'CommentStatement'));
|
|
1373
1377
|
return node;
|
|
1374
1378
|
}
|
|
1375
1379
|
get currentData() {
|
|
1376
1380
|
let node = this.currentNode;
|
|
1377
|
-
assert(node && node.type === 'TextNode');
|
|
1381
|
+
(!(node && node.type === 'TextNode') && assert(node && node.type === 'TextNode'));
|
|
1378
1382
|
return node;
|
|
1379
1383
|
}
|
|
1380
1384
|
acceptNode(node) {
|
|
@@ -1431,7 +1435,7 @@ class HandlebarsNodeVisitors extends Parser {
|
|
|
1431
1435
|
// the error.
|
|
1432
1436
|
pendingError = null;
|
|
1433
1437
|
parse(program, blockParams) {
|
|
1434
|
-
assert(program.loc);
|
|
1438
|
+
(!(program.loc) && assert(program.loc));
|
|
1435
1439
|
let node = b.template({
|
|
1436
1440
|
body: [],
|
|
1437
1441
|
blockParams,
|
|
@@ -1447,7 +1451,7 @@ class HandlebarsNodeVisitors extends Parser {
|
|
|
1447
1451
|
return template;
|
|
1448
1452
|
}
|
|
1449
1453
|
Program(program, blockParams) {
|
|
1450
|
-
assert(program.loc);
|
|
1454
|
+
(!(program.loc) && assert(program.loc));
|
|
1451
1455
|
let node = b.blockItself({
|
|
1452
1456
|
body: [],
|
|
1453
1457
|
params: blockParams,
|
|
@@ -1475,14 +1479,14 @@ class HandlebarsNodeVisitors extends Parser {
|
|
|
1475
1479
|
if (poppedNode?.type === 'ElementNode') {
|
|
1476
1480
|
throw generateSyntaxError(`Unclosed element \`${poppedNode.tag}\``, poppedNode.loc);
|
|
1477
1481
|
} else {
|
|
1478
|
-
assert(false, `[BUG] mismatched parser elementStack node: ${node.type}`);
|
|
1482
|
+
(assert(false, `[BUG] mismatched parser elementStack node: ${node.type}`));
|
|
1479
1483
|
}
|
|
1480
1484
|
}
|
|
1481
1485
|
return node;
|
|
1482
1486
|
}
|
|
1483
1487
|
BlockStatement(block) {
|
|
1484
1488
|
if (this.tokenizer.state === 'comment') {
|
|
1485
|
-
assert(block.loc);
|
|
1489
|
+
(!(block.loc) && assert(block.loc));
|
|
1486
1490
|
this.appendToCommentData(this.sourceForNode(block));
|
|
1487
1491
|
return;
|
|
1488
1492
|
}
|
|
@@ -2071,7 +2075,7 @@ class TokenizerEventHandlers extends HandlebarsNodeVisitors {
|
|
|
2071
2075
|
}
|
|
2072
2076
|
} else {
|
|
2073
2077
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- exhaustive
|
|
2074
|
-
assert(tag.type === 'EndTag', `Invalid tag type ${tag.type}`);
|
|
2078
|
+
(!(tag.type === 'EndTag') && assert(tag.type === 'EndTag', `Invalid tag type ${tag.type}`));
|
|
2075
2079
|
this.finishEndTag(false);
|
|
2076
2080
|
}
|
|
2077
2081
|
}
|
|
@@ -2126,7 +2130,7 @@ class TokenizerEventHandlers extends HandlebarsNodeVisitors {
|
|
|
2126
2130
|
if (isVoid) {
|
|
2127
2131
|
element.closeTag = null;
|
|
2128
2132
|
} else if (element.selfClosing) {
|
|
2129
|
-
assert(element.closeTag === null);
|
|
2133
|
+
(!(element.closeTag === null) && assert(element.closeTag === null));
|
|
2130
2134
|
} else {
|
|
2131
2135
|
element.closeTag = closeTagStart.until(this.offset());
|
|
2132
2136
|
}
|
|
@@ -2153,9 +2157,7 @@ class TokenizerEventHandlers extends HandlebarsNodeVisitors {
|
|
|
2153
2157
|
if (tag.type === 'StartTag') {
|
|
2154
2158
|
let offset = this.offset();
|
|
2155
2159
|
if (tag.nameStart === null) {
|
|
2156
|
-
assert(tag.nameEnd === null);
|
|
2157
|
-
|
|
2158
|
-
// Note that the tokenizer already consumed the token here
|
|
2160
|
+
(!(tag.nameEnd === null) && assert(tag.nameEnd === null)); // Note that the tokenizer already consumed the token here
|
|
2159
2161
|
tag.nameStart = offset.move(-1);
|
|
2160
2162
|
}
|
|
2161
2163
|
tag.nameEnd = offset;
|
|
@@ -2258,7 +2260,7 @@ class TokenizerEventHandlers extends HandlebarsNodeVisitors {
|
|
|
2258
2260
|
// Based on the ID validation regex in Handlebars.
|
|
2259
2261
|
|
|
2260
2262
|
const ID_INVERSE_PATTERN = /[!"#%&'()*+./;<=>@[\\\]^`{|}~]/u;
|
|
2261
|
-
assert(this.tokenizer.state === ATTRIBUTE_NAME);
|
|
2263
|
+
(!(this.tokenizer.state === ATTRIBUTE_NAME) && assert(this.tokenizer.state === ATTRIBUTE_NAME));
|
|
2262
2264
|
const element = this.currentStartTag;
|
|
2263
2265
|
const as = this.currentAttr;
|
|
2264
2266
|
let state = {
|
|
@@ -2266,7 +2268,7 @@ class TokenizerEventHandlers extends HandlebarsNodeVisitors {
|
|
|
2266
2268
|
};
|
|
2267
2269
|
const handlers = {
|
|
2268
2270
|
PossibleAs: next => {
|
|
2269
|
-
assert(state.state === 'PossibleAs');
|
|
2271
|
+
(!(state.state === 'PossibleAs') && assert(state.state === 'PossibleAs'));
|
|
2270
2272
|
if (isSpace(next)) {
|
|
2271
2273
|
// " as ..."
|
|
2272
2274
|
state = {
|
|
@@ -2287,7 +2289,7 @@ class TokenizerEventHandlers extends HandlebarsNodeVisitors {
|
|
|
2287
2289
|
}
|
|
2288
2290
|
},
|
|
2289
2291
|
BeforeStartPipe: next => {
|
|
2290
|
-
assert(state.state === 'BeforeStartPipe');
|
|
2292
|
+
(!(state.state === 'BeforeStartPipe') && assert(state.state === 'BeforeStartPipe'));
|
|
2291
2293
|
if (isSpace(next)) {
|
|
2292
2294
|
this.tokenizer.consume();
|
|
2293
2295
|
} else if (next === '|') {
|
|
@@ -2305,7 +2307,7 @@ class TokenizerEventHandlers extends HandlebarsNodeVisitors {
|
|
|
2305
2307
|
}
|
|
2306
2308
|
},
|
|
2307
2309
|
BeforeBlockParamName: next => {
|
|
2308
|
-
assert(state.state === 'BeforeBlockParamName');
|
|
2310
|
+
(!(state.state === 'BeforeBlockParamName') && assert(state.state === 'BeforeBlockParamName'));
|
|
2309
2311
|
if (isSpace(next)) {
|
|
2310
2312
|
this.tokenizer.consume();
|
|
2311
2313
|
} else if (next === '') {
|
|
@@ -2345,7 +2347,7 @@ class TokenizerEventHandlers extends HandlebarsNodeVisitors {
|
|
|
2345
2347
|
}
|
|
2346
2348
|
},
|
|
2347
2349
|
BlockParamName: next => {
|
|
2348
|
-
assert(state.state === 'BlockParamName');
|
|
2350
|
+
(!(state.state === 'BlockParamName') && assert(state.state === 'BlockParamName'));
|
|
2349
2351
|
if (next === '') {
|
|
2350
2352
|
// The HTML tokenizer ran out of characters, so we are either
|
|
2351
2353
|
// encountering mustache or <EOF>, HBS side will attach the error
|
|
@@ -2385,7 +2387,7 @@ class TokenizerEventHandlers extends HandlebarsNodeVisitors {
|
|
|
2385
2387
|
}
|
|
2386
2388
|
},
|
|
2387
2389
|
AfterEndPipe: next => {
|
|
2388
|
-
assert(state.state === 'AfterEndPipe');
|
|
2390
|
+
(!(state.state === 'AfterEndPipe') && assert(state.state === 'AfterEndPipe'));
|
|
2389
2391
|
if (isSpace(next)) {
|
|
2390
2392
|
this.tokenizer.consume();
|
|
2391
2393
|
} else if (next === '') {
|
|
@@ -2419,7 +2421,7 @@ class TokenizerEventHandlers extends HandlebarsNodeVisitors {
|
|
|
2419
2421
|
}
|
|
2420
2422
|
},
|
|
2421
2423
|
Error: next => {
|
|
2422
|
-
assert(state.state === 'Error');
|
|
2424
|
+
(!(state.state === 'Error') && assert(state.state === 'Error'));
|
|
2423
2425
|
if (next === '' || next === '/' || next === '>' || isSpace(next)) {
|
|
2424
2426
|
throw generateSyntaxError(state.message, state.start.until(this.offset()));
|
|
2425
2427
|
} else {
|
|
@@ -2435,7 +2437,7 @@ class TokenizerEventHandlers extends HandlebarsNodeVisitors {
|
|
|
2435
2437
|
next = this.tokenizer.peek();
|
|
2436
2438
|
handlers[state.state](next);
|
|
2437
2439
|
} while (state.state !== 'Done' && next !== '');
|
|
2438
|
-
assert(state.state === 'Done');
|
|
2440
|
+
(!(state.state === 'Done') && assert(state.state === 'Done'));
|
|
2439
2441
|
}
|
|
2440
2442
|
reportSyntaxError(message) {
|
|
2441
2443
|
throw generateSyntaxError(message, this.offset().collapsed());
|
|
@@ -2837,7 +2839,7 @@ class Builder {
|
|
|
2837
2839
|
}
|
|
2838
2840
|
at(name, symbol, loc) {
|
|
2839
2841
|
// the `@` should be included so we have a complete source range
|
|
2840
|
-
assert(name[0] === '@');
|
|
2842
|
+
(!(name[0] === '@') && assert(name[0] === '@'));
|
|
2841
2843
|
return new ArgReference({
|
|
2842
2844
|
loc,
|
|
2843
2845
|
name: new SourceSlice({
|
|
@@ -2853,7 +2855,7 @@ class Builder {
|
|
|
2853
2855
|
symbol,
|
|
2854
2856
|
loc
|
|
2855
2857
|
}) {
|
|
2856
|
-
assert(name[0] !== '@');
|
|
2858
|
+
(!(name[0] !== '@') && assert(name[0] !== '@'));
|
|
2857
2859
|
return new FreeVarReference({
|
|
2858
2860
|
name,
|
|
2859
2861
|
resolution: context,
|
|
@@ -2862,7 +2864,7 @@ class Builder {
|
|
|
2862
2864
|
});
|
|
2863
2865
|
}
|
|
2864
2866
|
localVar(name, symbol, isTemplateLocal, loc) {
|
|
2865
|
-
assert(name[0] !== '@');
|
|
2867
|
+
(!(name[0] !== '@') && assert(name[0] !== '@'));
|
|
2866
2868
|
return new LocalVarReference({
|
|
2867
2869
|
loc,
|
|
2868
2870
|
name,
|
|
@@ -3271,7 +3273,7 @@ class ExpressionNormalizer {
|
|
|
3271
3273
|
let paramLoc = SpanList.range(paramList, callee.loc.collapse('end'));
|
|
3272
3274
|
let namedLoc = this.block.loc(hash.loc);
|
|
3273
3275
|
let argsLoc = SpanList.range([paramLoc, namedLoc]);
|
|
3274
|
-
let positional = this.block.builder.positional(
|
|
3276
|
+
let positional = this.block.builder.positional(paramList, paramLoc);
|
|
3275
3277
|
let named = this.block.builder.named(hash.pairs.map(p => this.namedArgument(p)), this.block.loc(hash.loc));
|
|
3276
3278
|
switch (callee.type) {
|
|
3277
3279
|
case 'Literal':
|
|
@@ -3656,7 +3658,7 @@ class ElementNormalizer {
|
|
|
3656
3658
|
}
|
|
3657
3659
|
}
|
|
3658
3660
|
attr(m) {
|
|
3659
|
-
assert(m.name[0] !== '@');
|
|
3661
|
+
(!(m.name[0] !== '@') && assert(m.name[0] !== '@'));
|
|
3660
3662
|
if (m.name === '...attributes') {
|
|
3661
3663
|
return this.ctx.builder.splatAttr(this.ctx.table.allocateBlock('attrs'), this.ctx.loc(m.loc));
|
|
3662
3664
|
}
|
|
@@ -3704,7 +3706,7 @@ class ElementNormalizer {
|
|
|
3704
3706
|
}
|
|
3705
3707
|
}
|
|
3706
3708
|
arg(arg) {
|
|
3707
|
-
assert(arg.name[0] === '@');
|
|
3709
|
+
(!(arg.name[0] === '@') && assert(arg.name[0] === '@'));
|
|
3708
3710
|
this.checkArgCall(arg);
|
|
3709
3711
|
let offsets = this.ctx.loc(arg.loc);
|
|
3710
3712
|
let nameSlice = offsets.sliceStartChars({
|
|
@@ -5860,7 +5862,7 @@ class ExpressionEncoder {
|
|
|
5860
5862
|
tail
|
|
5861
5863
|
}) {
|
|
5862
5864
|
let getOp = EXPR.expr(head);
|
|
5863
|
-
assert(getOp[0] !== opcodes.GetStrictKeyword);
|
|
5865
|
+
(!(getOp[0] !== opcodes.GetStrictKeyword) && assert(getOp[0] !== opcodes.GetStrictKeyword));
|
|
5864
5866
|
return [...getOp, EXPR.Tail(tail)];
|
|
5865
5867
|
}
|
|
5866
5868
|
InterpolateExpression({
|
|
@@ -10,7 +10,7 @@ import './reference-C3TKDRnP.js';
|
|
|
10
10
|
import { c as capabilityFlagsFrom, m as managerHasCapability } from './capabilities-O_xc7Yqk.js';
|
|
11
11
|
import { g as getComponentTemplate } from './template-kM-7TTcc.js';
|
|
12
12
|
import { I as InternalComponentCapabilities } from './flags-B9qxc-pB.js';
|
|
13
|
-
import { t as templateFactory } from './index-
|
|
13
|
+
import { t as templateFactory } from './index-BUPd6pkm.js';
|
|
14
14
|
import { SexpOpcodes as opcodes } from '../@glimmer/wire-format/index.js';
|
|
15
15
|
|
|
16
16
|
function unwrapHandle(handle) {
|
|
@@ -14,7 +14,7 @@ import { createIteratorRef } from '../@glimmer/reference/index.js';
|
|
|
14
14
|
import { s as setLocalDebugType } from './debug-brand-B1TWjOCH.js';
|
|
15
15
|
import { b as EMPTY_STRING_ARRAY, e as enumerate, c as emptyArray } from './array-utils-CZQxrdD3.js';
|
|
16
16
|
import { a as assert } from './assert-CUCJBR2C.js';
|
|
17
|
-
import { a as unwrapTemplate } from './constants-
|
|
17
|
+
import { a as unwrapTemplate } from './constants-p7AL-pog.js';
|
|
18
18
|
import { I as InternalComponentCapabilities } from './flags-B9qxc-pB.js';
|
|
19
19
|
import { a as castToBrowser } from './simple-cast-DCvJLSin.js';
|
|
20
20
|
|
|
@@ -99,10 +99,10 @@ class AppendOpcodes {
|
|
|
99
99
|
evaluate(vm, opcode, type) {
|
|
100
100
|
let operation = unwrap(this.evaluateOpcode[type]);
|
|
101
101
|
if (operation.syscall) {
|
|
102
|
-
assert(!opcode.isMachine, `BUG: Mismatch between operation.syscall (${operation.syscall}) and opcode.isMachine (${opcode.isMachine}) for ${opcode.type}`);
|
|
102
|
+
(!(!opcode.isMachine) && assert(!opcode.isMachine, `BUG: Mismatch between operation.syscall (${operation.syscall}) and opcode.isMachine (${opcode.isMachine}) for ${opcode.type}`));
|
|
103
103
|
operation.evaluate(vm, opcode);
|
|
104
104
|
} else {
|
|
105
|
-
assert(opcode.isMachine, `BUG: Mismatch between operation.syscall (${operation.syscall}) and opcode.isMachine (${opcode.isMachine}) for ${opcode.type}`);
|
|
105
|
+
(!(opcode.isMachine) && assert(opcode.isMachine, `BUG: Mismatch between operation.syscall (${operation.syscall}) and opcode.isMachine (${opcode.isMachine}) for ${opcode.type}`));
|
|
106
106
|
operation.evaluate(vm.lowlevel, opcode);
|
|
107
107
|
}
|
|
108
108
|
}
|
|
@@ -598,7 +598,6 @@ APPEND_OPCODES.add(VM_INVOKE_YIELD_OP, vm => {
|
|
|
598
598
|
let table = check(stack.pop());
|
|
599
599
|
let args = check(stack.pop());
|
|
600
600
|
if (table === null || handle === null) {
|
|
601
|
-
// To balance the pop{Frame,Scope}
|
|
602
601
|
vm.lowlevel.pushFrame();
|
|
603
602
|
vm.pushScope(scope ?? vm.scope());
|
|
604
603
|
return;
|
|
@@ -1195,7 +1194,7 @@ APPEND_OPCODES.add(VM_PREPARE_ARGS_OP, (vm, {
|
|
|
1195
1194
|
definition
|
|
1196
1195
|
} = instance;
|
|
1197
1196
|
if (isCurriedType(definition, CURRIED_COMPONENT)) {
|
|
1198
|
-
assert(!definition.manager);
|
|
1197
|
+
(!(!definition.manager) && assert(!definition.manager));
|
|
1199
1198
|
let constants = vm.constants;
|
|
1200
1199
|
let {
|
|
1201
1200
|
definition: resolvedDefinition,
|
|
@@ -1506,7 +1505,7 @@ APPEND_OPCODES.add(VM_GET_COMPONENT_SELF_OP, (vm, {
|
|
|
1506
1505
|
}
|
|
1507
1506
|
let compilable = definition.compilable;
|
|
1508
1507
|
if (compilable === null) {
|
|
1509
|
-
assert(managerHasCapability(manager, instance.capabilities, InternalComponentCapabilities.dynamicLayout));
|
|
1508
|
+
(!(managerHasCapability(manager, instance.capabilities, InternalComponentCapabilities.dynamicLayout)) && assert(managerHasCapability(manager, instance.capabilities, InternalComponentCapabilities.dynamicLayout)));
|
|
1510
1509
|
let resolver = vm.context.resolver;
|
|
1511
1510
|
compilable = resolver === null ? null : manager.getDynamicLayout(state, resolver);
|
|
1512
1511
|
}
|
|
@@ -1577,7 +1576,7 @@ APPEND_OPCODES.add(VM_GET_COMPONENT_LAYOUT_OP, (vm, {
|
|
|
1577
1576
|
let {
|
|
1578
1577
|
capabilities
|
|
1579
1578
|
} = instance;
|
|
1580
|
-
assert(managerHasCapability(manager, capabilities, InternalComponentCapabilities.dynamicLayout));
|
|
1579
|
+
(!(managerHasCapability(manager, capabilities, InternalComponentCapabilities.dynamicLayout)) && assert(managerHasCapability(manager, capabilities, InternalComponentCapabilities.dynamicLayout)));
|
|
1581
1580
|
let resolver = vm.context.resolver;
|
|
1582
1581
|
compilable = resolver === null ? null : manager.getDynamicLayout(instance.state, resolver);
|
|
1583
1582
|
if (compilable === null) {
|
package/dist/dev/packages/shared-chunks/{element-builder-Dw_Ic9cD.js → element-builder-DO43ztVP.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { G as DOMOperations, b as CursorImpl, C as ConcreteBounds, n as dynamicAttribute, j as clear } from './dynamic-
|
|
1
|
+
import { G as DOMOperations, b as CursorImpl, C as ConcreteBounds, n as dynamicAttribute, j as clear } from './dynamic-BfDKO5NI.js';
|
|
2
2
|
import { a as assert } from './assert-CUCJBR2C.js';
|
|
3
3
|
import { s as setLocalDebugType } from './debug-brand-B1TWjOCH.js';
|
|
4
4
|
import './debug-to-string-CFb7h0lY.js';
|
|
@@ -394,7 +394,7 @@ class AppendingBlockList {
|
|
|
394
394
|
}
|
|
395
395
|
didAppendBounds(_bounds) {}
|
|
396
396
|
finalize(_stack) {
|
|
397
|
-
assert(this.boundList.length > 0);
|
|
397
|
+
(!(this.boundList.length > 0) && assert(this.boundList.length > 0));
|
|
398
398
|
}
|
|
399
399
|
}
|
|
400
400
|
function clientBuilder(env, cursor) {
|
|
@@ -48,10 +48,10 @@ function assertResolverInvariants(meta) {
|
|
|
48
48
|
* <Foo @arg={{true}} />
|
|
49
49
|
*/
|
|
50
50
|
function resolveComponent(resolver, constants, meta, [, expr, then]) {
|
|
51
|
-
assert(isGetFreeComponent(expr));
|
|
51
|
+
(!(isGetFreeComponent(expr)) && assert(isGetFreeComponent(expr)));
|
|
52
52
|
let type = expr[0];
|
|
53
53
|
if (expr[0] === opcodes.GetStrictKeyword) {
|
|
54
|
-
assert(!meta.isStrictMode);
|
|
54
|
+
(!(!meta.isStrictMode) && assert(!meta.isStrictMode));
|
|
55
55
|
throw new Error(`Attempted to resolve a component in a strict mode template, but that value was not in scope: ${
|
|
56
56
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- @fixme
|
|
57
57
|
meta.symbols.upvars[expr[1]] ?? '{unknown variable}'}`);
|
|
@@ -76,7 +76,7 @@ function resolveComponent(resolver, constants, meta, [, expr, then]) {
|
|
|
76
76
|
let name = unwrap(upvars[expr[1]]);
|
|
77
77
|
let definition = resolver?.lookupComponent?.(name, owner) ?? null;
|
|
78
78
|
if ((typeof definition !== 'object' || definition === null)) {
|
|
79
|
-
assert(!meta.isStrictMode);
|
|
79
|
+
(!(!meta.isStrictMode) && assert(!meta.isStrictMode));
|
|
80
80
|
throw new Error(`Attempted to resolve \`${name}\`, which was expected to be a component, but nothing was found.`);
|
|
81
81
|
}
|
|
82
82
|
|
|
@@ -90,7 +90,7 @@ function resolveComponent(resolver, constants, meta, [, expr, then]) {
|
|
|
90
90
|
* (helper arg)
|
|
91
91
|
*/
|
|
92
92
|
function resolveHelper(resolver, constants, meta, [, expr, then]) {
|
|
93
|
-
assert(isGetFreeHelper(expr));
|
|
93
|
+
(!(isGetFreeHelper(expr)) && assert(isGetFreeHelper(expr)));
|
|
94
94
|
let type = expr[0];
|
|
95
95
|
if (type === opcodes.GetLexicalSymbol) {
|
|
96
96
|
let {
|
|
@@ -110,7 +110,7 @@ function resolveHelper(resolver, constants, meta, [, expr, then]) {
|
|
|
110
110
|
let name = unwrap(upvars[expr[1]]);
|
|
111
111
|
let helper = resolver?.lookupHelper?.(name, owner) ?? null;
|
|
112
112
|
if (helper === null) {
|
|
113
|
-
assert(!meta.isStrictMode);
|
|
113
|
+
(!(!meta.isStrictMode) && assert(!meta.isStrictMode));
|
|
114
114
|
throw new Error(`Attempted to resolve \`${name}\`, which was expected to be a helper, but nothing was found.`);
|
|
115
115
|
}
|
|
116
116
|
|
|
@@ -125,7 +125,7 @@ function resolveHelper(resolver, constants, meta, [, expr, then]) {
|
|
|
125
125
|
* <Foo {{modifier}}/>
|
|
126
126
|
*/
|
|
127
127
|
function resolveModifier(resolver, constants, meta, [, expr, then]) {
|
|
128
|
-
assert(isGetFreeModifier(expr));
|
|
128
|
+
(!(isGetFreeModifier(expr)) && assert(isGetFreeModifier(expr)));
|
|
129
129
|
let type = expr[0];
|
|
130
130
|
if (type === opcodes.GetLexicalSymbol) {
|
|
131
131
|
let {
|
|
@@ -145,7 +145,7 @@ function resolveModifier(resolver, constants, meta, [, expr, then]) {
|
|
|
145
145
|
let name = unwrap(upvars[expr[1]]);
|
|
146
146
|
let modifier = resolver?.lookupBuiltInModifier?.(name) ?? null;
|
|
147
147
|
if (modifier === null) {
|
|
148
|
-
assert(!meta.isStrictMode);
|
|
148
|
+
(!(!meta.isStrictMode) && assert(!meta.isStrictMode));
|
|
149
149
|
throw new Error(`Attempted to resolve a modifier in a strict mode template, but it was not in scope: ${name}`);
|
|
150
150
|
}
|
|
151
151
|
|
|
@@ -161,7 +161,7 @@ function resolveModifier(resolver, constants, meta, [, expr, then]) {
|
|
|
161
161
|
let name = unwrap(upvars[expr[1]]);
|
|
162
162
|
let modifier = resolver?.lookupModifier?.(name, owner) ?? null;
|
|
163
163
|
if (modifier === null) {
|
|
164
|
-
assert(!meta.isStrictMode);
|
|
164
|
+
(!(!meta.isStrictMode) && assert(!meta.isStrictMode));
|
|
165
165
|
throw new Error(`Attempted to resolve \`${name}\`, which was expected to be a modifier, but nothing was found.`);
|
|
166
166
|
}
|
|
167
167
|
|
|
@@ -177,7 +177,7 @@ function resolveComponentOrHelper(resolver, constants, meta, [, expr, {
|
|
|
177
177
|
ifComponent,
|
|
178
178
|
ifHelper
|
|
179
179
|
}]) {
|
|
180
|
-
assert(isGetFreeComponentOrHelper(expr));
|
|
180
|
+
(!(isGetFreeComponentOrHelper(expr)) && assert(isGetFreeComponentOrHelper(expr)));
|
|
181
181
|
let type = expr[0];
|
|
182
182
|
if (type === opcodes.GetLexicalSymbol) {
|
|
183
183
|
let {
|
|
@@ -195,7 +195,7 @@ function resolveComponentOrHelper(resolver, constants, meta, [, expr, {
|
|
|
195
195
|
}
|
|
196
196
|
let helper = constants.helper(definition, null, true);
|
|
197
197
|
if (helper === null) {
|
|
198
|
-
assert(!meta.isStrictMode);
|
|
198
|
+
(!(!meta.isStrictMode) && assert(!meta.isStrictMode));
|
|
199
199
|
throw new Error(
|
|
200
200
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- @fixme
|
|
201
201
|
`Attempted to use a value as either a component or helper, but it did not have a component manager or helper manager associated with it. The value was: ${debugToString(definition)}`);
|
|
@@ -217,7 +217,7 @@ function resolveComponentOrHelper(resolver, constants, meta, [, expr, {
|
|
|
217
217
|
} else {
|
|
218
218
|
let helper = resolver?.lookupHelper?.(name, owner) ?? null;
|
|
219
219
|
if (helper === null) {
|
|
220
|
-
assert(!meta.isStrictMode);
|
|
220
|
+
(!(!meta.isStrictMode) && assert(!meta.isStrictMode));
|
|
221
221
|
throw new Error(`Attempted to resolve \`${name}\`, which was expected to be a component or helper, but nothing was found.`);
|
|
222
222
|
}
|
|
223
223
|
|
|
@@ -235,7 +235,7 @@ function resolveOptionalComponentOrHelper(resolver, constants, meta, [, expr, {
|
|
|
235
235
|
ifHelper,
|
|
236
236
|
ifValue
|
|
237
237
|
}]) {
|
|
238
|
-
assert(isGetFreeComponentOrHelper(expr));
|
|
238
|
+
(!(isGetFreeComponentOrHelper(expr)) && assert(isGetFreeComponentOrHelper(expr)));
|
|
239
239
|
let type = expr[0];
|
|
240
240
|
if (type === opcodes.GetLexicalSymbol) {
|
|
241
241
|
let {
|
|
@@ -292,9 +292,7 @@ function lookupBuiltInHelper(expr, resolver, meta, constants, type) {
|
|
|
292
292
|
let name = unwrap(upvars[expr[1]]);
|
|
293
293
|
let helper = resolver?.lookupBuiltInHelper?.(name) ?? null;
|
|
294
294
|
if (helper === null) {
|
|
295
|
-
assert(!meta.isStrictMode);
|
|
296
|
-
|
|
297
|
-
// Keyword helper did not exist, which means that we're attempting to use a
|
|
295
|
+
(!(!meta.isStrictMode) && assert(!meta.isStrictMode)); // Keyword helper did not exist, which means that we're attempting to use a
|
|
298
296
|
// value of some kind that is not in scope
|
|
299
297
|
throw new Error(`Attempted to resolve a ${type} in a strict mode template, but that value was not in scope: ${
|
|
300
298
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- @fixme
|
|
@@ -406,7 +404,7 @@ class Labels {
|
|
|
406
404
|
} of targets) {
|
|
407
405
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- @fixme
|
|
408
406
|
let address = labels[target] - at;
|
|
409
|
-
assert(heap.getbyaddr(at) === -1);
|
|
407
|
+
(!(heap.getbyaddr(at) === -1) && assert(heap.getbyaddr(at) === -1));
|
|
410
408
|
heap.setbyaddr(at, address);
|
|
411
409
|
}
|
|
412
410
|
}
|
|
@@ -570,7 +568,7 @@ class Compilers {
|
|
|
570
568
|
let name = sexp[0];
|
|
571
569
|
let index = unwrap(this.names[name]);
|
|
572
570
|
let func = this.funcs[index];
|
|
573
|
-
assert(func, `expected an implementation for ${sexp[0]}`);
|
|
571
|
+
(!(func) && assert(func, `expected an implementation for ${sexp[0]}`));
|
|
574
572
|
func(op, sexp);
|
|
575
573
|
}
|
|
576
574
|
}
|