ember-source 5.9.0-alpha.6 → 5.9.0-beta.1
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/dependencies/@glimmer/debug.js +10 -1
- package/dist/dependencies/@glimmer/global-context.js +2 -0
- package/dist/dependencies/@glimmer/manager.js +10 -6
- package/dist/dependencies/@glimmer/opcode-compiler.js +26 -91
- package/dist/dependencies/@glimmer/runtime.js +231 -134
- package/dist/dependencies/@glimmer/util.js +2 -0
- package/dist/dependencies/@glimmer/validator.js +6 -7
- package/dist/dependencies/@glimmer/wire-format.js +2 -8
- package/dist/ember-template-compiler.js +1823 -1347
- package/dist/ember-template-compiler.map +1 -1
- package/dist/ember-testing.js +1 -1
- package/dist/ember-testing.map +1 -1
- package/dist/ember.debug.js +282 -235
- package/dist/ember.debug.map +1 -1
- package/dist/header/license.js +1 -1
- package/dist/packages/@ember/-internals/glimmer/index.js +3 -0
- package/dist/packages/ember/version.js +1 -1
- package/docs/data.json +1 -1
- package/package.json +20 -19
- package/types/stable/@ember/-internals/glimmer/lib/modifiers/internal.d.ts +2 -1
- package/types/stable/ember-template-compiler/lib/plugins/index.d.ts +1 -0
- package/types/stable/ember-template-compiler/lib/plugins/utils.d.ts +2 -2
- package/types/stable/index.d.ts +0 -1
- package/types/stable/ember-template-compiler/lib/plugins/assert-splattribute-expression.d.ts +0 -5
package/build-metadata.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "5.9.0-
|
|
2
|
+
"version": "5.9.0-beta.1",
|
|
3
3
|
"buildType": "tag",
|
|
4
|
-
"SHA": "
|
|
5
|
-
"assetPath": "/tag/shas/
|
|
4
|
+
"SHA": "79111462575293d5ad9cf9e101a69012fab13dea",
|
|
5
|
+
"assetPath": "/tag/shas/79111462575293d5ad9cf9e101a69012fab13dea.tgz"
|
|
6
6
|
}
|
|
@@ -1300,6 +1300,14 @@ class NullChecker {
|
|
|
1300
1300
|
return `null`;
|
|
1301
1301
|
}
|
|
1302
1302
|
}
|
|
1303
|
+
class UndefinedChecker {
|
|
1304
|
+
validate(value) {
|
|
1305
|
+
return value === undefined;
|
|
1306
|
+
}
|
|
1307
|
+
expected() {
|
|
1308
|
+
return `undefined`;
|
|
1309
|
+
}
|
|
1310
|
+
}
|
|
1303
1311
|
class InstanceofChecker {
|
|
1304
1312
|
constructor(Class) {
|
|
1305
1313
|
this.Class = Class;
|
|
@@ -1483,6 +1491,7 @@ const CheckBoolean = new TypeofChecker('boolean');
|
|
|
1483
1491
|
const CheckHandle = CheckNumber;
|
|
1484
1492
|
const CheckString = new TypeofChecker('string');
|
|
1485
1493
|
const CheckNull = new NullChecker();
|
|
1494
|
+
const CheckUndefined = new UndefinedChecker();
|
|
1486
1495
|
const CheckUnknown = new OpaqueChecker();
|
|
1487
1496
|
const CheckSafeString = new SafeStringChecker();
|
|
1488
1497
|
const CheckObject = new ObjectChecker();
|
|
@@ -1513,4 +1522,4 @@ const CheckNode = CheckInterface({
|
|
|
1513
1522
|
nextSibling: CheckUnknown
|
|
1514
1523
|
});
|
|
1515
1524
|
|
|
1516
|
-
export { CheckArray, CheckBlockSymbolTable, CheckBoolean, CheckDict, CheckDocumentFragment, CheckElement, CheckFunction, CheckHandle, CheckInstanceof, CheckInterface, CheckMaybe, CheckNode, CheckNull, CheckNumber, CheckObject, CheckOption, CheckOr, CheckPrimitive, CheckProgramSymbolTable, CheckSafeString, CheckString, CheckUnknown, CheckValue, META_KIND, OPERAND_TYPES, buildEnum, buildMetas, buildSingleMeta, check, debug, debugSlice, expectStackChange, logOpcode, normalize, normalizeAll, normalizeParsed, opcodeMetadata, recordStackSize, strip, wrap };
|
|
1525
|
+
export { CheckArray, CheckBlockSymbolTable, CheckBoolean, CheckDict, CheckDocumentFragment, CheckElement, CheckFunction, CheckHandle, CheckInstanceof, CheckInterface, CheckMaybe, CheckNode, CheckNull, CheckNumber, CheckObject, CheckOption, CheckOr, CheckPrimitive, CheckProgramSymbolTable, CheckSafeString, CheckString, CheckUndefined, CheckUnknown, CheckValue, META_KIND, OPERAND_TYPES, buildEnum, buildMetas, buildSingleMeta, check, debug, debugSlice, expectStackChange, logOpcode, normalize, normalizeAll, normalizeParsed, opcodeMetadata, recordStackSize, strip, wrap };
|
|
@@ -603,16 +603,20 @@ class CustomModifierManager {
|
|
|
603
603
|
args,
|
|
604
604
|
modifier: instance
|
|
605
605
|
};
|
|
606
|
-
if (DEBUG) {
|
|
607
|
-
state.debugName = typeof definition === 'function' ? definition.name : definition.toString();
|
|
608
|
-
}
|
|
609
606
|
registerDestructor(state, () => delegate.destroyModifier(instance, args));
|
|
610
607
|
return state;
|
|
611
608
|
}
|
|
612
|
-
getDebugName({
|
|
613
|
-
|
|
609
|
+
getDebugName(definition) {
|
|
610
|
+
if (typeof definition === 'function') {
|
|
611
|
+
return definition.name || definition.toString();
|
|
612
|
+
} else {
|
|
613
|
+
return '<unknown>';
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
getDebugInstance({
|
|
617
|
+
modifier
|
|
614
618
|
}) {
|
|
615
|
-
return
|
|
619
|
+
return modifier;
|
|
616
620
|
}
|
|
617
621
|
getTag({
|
|
618
622
|
tag
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { EMPTY_STRING_ARRAY, isSmallInt, encodeImmediate, unwrap, reverse, assert
|
|
1
|
+
import { EMPTY_STRING_ARRAY, isSmallInt, encodeImmediate, unwrap, reverse, assert, Stack, isPresentArray, encodeHandle, expect, assign, dict, enumerate, EMPTY_ARRAY, debugToString } from '@glimmer/util';
|
|
2
2
|
import '@glimmer/debug';
|
|
3
3
|
import { Op, MachineOp, $v0, $fp, $sp, InternalComponentCapabilities, $s0, ContentType, TYPE_SIZE, isMachineOp, MACHINE_MASK, ARG_SHIFT, $s1 } from '@glimmer/vm';
|
|
4
4
|
import { DEBUG } from '@glimmer/env';
|
|
5
5
|
import { InstructionEncoderImpl } from '@glimmer/encoder';
|
|
6
6
|
import { SexpOpcodes } from '@glimmer/wire-format';
|
|
7
7
|
import { hasCapability } from '@glimmer/manager';
|
|
8
|
-
import { assert, deprecate } from '@glimmer/global-context';
|
|
9
8
|
|
|
10
9
|
let debugCompiler;
|
|
11
10
|
|
|
@@ -23,11 +22,6 @@ const isGetFreeComponent = makeResolutionTypeVerifier(SexpOpcodes.GetFreeAsCompo
|
|
|
23
22
|
const isGetFreeModifier = makeResolutionTypeVerifier(SexpOpcodes.GetFreeAsModifierHead);
|
|
24
23
|
const isGetFreeHelper = makeResolutionTypeVerifier(SexpOpcodes.GetFreeAsHelperHead);
|
|
25
24
|
const isGetFreeComponentOrHelper = makeResolutionTypeVerifier(SexpOpcodes.GetFreeAsComponentOrHelperHead);
|
|
26
|
-
const isGetFreeOptionalHelper = makeResolutionTypeVerifier(SexpOpcodes.GetFreeAsHelperHeadOrThisFallback);
|
|
27
|
-
function isGetFreeDeprecatedHelper(opcode) {
|
|
28
|
-
return Array.isArray(opcode) && opcode[0] === SexpOpcodes.GetFreeAsDeprecatedHelperHeadOrThisFallback;
|
|
29
|
-
}
|
|
30
|
-
const isGetFreeOptionalComponentOrHelper = makeResolutionTypeVerifier(SexpOpcodes.GetFreeAsComponentOrHelperHeadOrThisFallback);
|
|
31
25
|
function assertResolverInvariants(meta) {
|
|
32
26
|
if (DEBUG) {
|
|
33
27
|
if (!meta.upvars) {
|
|
@@ -46,9 +40,10 @@ function assertResolverInvariants(meta) {
|
|
|
46
40
|
* <Foo @arg={{true}} />
|
|
47
41
|
*/
|
|
48
42
|
function resolveComponent(resolver, constants, meta, [, expr, then]) {
|
|
49
|
-
assert
|
|
43
|
+
assert(isGetFreeComponent(expr), 'Attempted to resolve a component with incorrect opcode');
|
|
50
44
|
let type = expr[0];
|
|
51
45
|
if (DEBUG && expr[0] === SexpOpcodes.GetStrictKeyword) {
|
|
46
|
+
assert(!meta.isStrictMode, 'Strict mode errors should already be handled at compile time');
|
|
52
47
|
throw new Error(`Attempted to resolve a component in a strict mode template, but that value was not in scope: ${meta.upvars[expr[1]] ?? '{unknown variable}'}`);
|
|
53
48
|
}
|
|
54
49
|
if (type === SexpOpcodes.GetLexicalSymbol) {
|
|
@@ -66,6 +61,7 @@ function resolveComponent(resolver, constants, meta, [, expr, then]) {
|
|
|
66
61
|
let name = unwrap(upvars[expr[1]]);
|
|
67
62
|
let definition = resolver.lookupComponent(name, owner);
|
|
68
63
|
if (DEBUG && (typeof definition !== 'object' || definition === null)) {
|
|
64
|
+
assert(!meta.isStrictMode, 'Strict mode errors should already be handled at compile time');
|
|
69
65
|
throw new Error(`Attempted to resolve \`${name}\`, which was expected to be a component, but nothing was found.`);
|
|
70
66
|
}
|
|
71
67
|
then(constants.resolvedComponent(definition, name));
|
|
@@ -77,7 +73,7 @@ function resolveComponent(resolver, constants, meta, [, expr, then]) {
|
|
|
77
73
|
* (helper arg)
|
|
78
74
|
*/
|
|
79
75
|
function resolveHelper(resolver, constants, meta, [, expr, then]) {
|
|
80
|
-
assert
|
|
76
|
+
assert(isGetFreeHelper(expr), 'Attempted to resolve a helper with incorrect opcode');
|
|
81
77
|
let type = expr[0];
|
|
82
78
|
if (type === SexpOpcodes.GetLexicalSymbol) {
|
|
83
79
|
let {
|
|
@@ -95,6 +91,7 @@ function resolveHelper(resolver, constants, meta, [, expr, then]) {
|
|
|
95
91
|
let name = unwrap(upvars[expr[1]]);
|
|
96
92
|
let helper = resolver.lookupHelper(name, owner);
|
|
97
93
|
if (DEBUG && helper === null) {
|
|
94
|
+
assert(!meta.isStrictMode, 'Strict mode errors should already be handled at compile time');
|
|
98
95
|
throw new Error(`Attempted to resolve \`${name}\`, which was expected to be a helper, but nothing was found.`);
|
|
99
96
|
}
|
|
100
97
|
then(constants.helper(helper, name));
|
|
@@ -107,7 +104,7 @@ function resolveHelper(resolver, constants, meta, [, expr, then]) {
|
|
|
107
104
|
* <Foo {{modifier}}/>
|
|
108
105
|
*/
|
|
109
106
|
function resolveModifier(resolver, constants, meta, [, expr, then]) {
|
|
110
|
-
assert
|
|
107
|
+
assert(isGetFreeModifier(expr), 'Attempted to resolve a modifier with incorrect opcode');
|
|
111
108
|
let type = expr[0];
|
|
112
109
|
if (type === SexpOpcodes.GetLexicalSymbol) {
|
|
113
110
|
let {
|
|
@@ -122,6 +119,7 @@ function resolveModifier(resolver, constants, meta, [, expr, then]) {
|
|
|
122
119
|
let name = unwrap(upvars[expr[1]]);
|
|
123
120
|
let modifier = resolver.lookupBuiltInModifier(name);
|
|
124
121
|
if (DEBUG && modifier === null) {
|
|
122
|
+
assert(!meta.isStrictMode, 'Strict mode errors should already be handled at compile time');
|
|
125
123
|
throw new Error(`Attempted to resolve a modifier in a strict mode template, but it was not in scope: ${name}`);
|
|
126
124
|
}
|
|
127
125
|
then(constants.modifier(modifier, name));
|
|
@@ -133,6 +131,7 @@ function resolveModifier(resolver, constants, meta, [, expr, then]) {
|
|
|
133
131
|
let name = unwrap(upvars[expr[1]]);
|
|
134
132
|
let modifier = resolver.lookupModifier(name, owner);
|
|
135
133
|
if (DEBUG && modifier === null) {
|
|
134
|
+
assert(!meta.isStrictMode, 'Strict mode errors should already be handled at compile time');
|
|
136
135
|
throw new Error(`Attempted to resolve \`${name}\`, which was expected to be a modifier, but nothing was found.`);
|
|
137
136
|
}
|
|
138
137
|
then(constants.modifier(modifier, name));
|
|
@@ -146,7 +145,7 @@ function resolveComponentOrHelper(resolver, constants, meta, [, expr, {
|
|
|
146
145
|
ifComponent,
|
|
147
146
|
ifHelper
|
|
148
147
|
}]) {
|
|
149
|
-
assert
|
|
148
|
+
assert(isGetFreeComponentOrHelper(expr), 'Attempted to resolve a component or helper with incorrect opcode');
|
|
150
149
|
let type = expr[0];
|
|
151
150
|
if (type === SexpOpcodes.GetLexicalSymbol) {
|
|
152
151
|
let {
|
|
@@ -161,6 +160,7 @@ function resolveComponentOrHelper(resolver, constants, meta, [, expr, {
|
|
|
161
160
|
}
|
|
162
161
|
let helper = constants.helper(definition, null, true);
|
|
163
162
|
if (DEBUG && helper === null) {
|
|
163
|
+
assert(!meta.isStrictMode, 'Strict mode errors should already be handled at compile time');
|
|
164
164
|
throw new Error(`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)}`);
|
|
165
165
|
}
|
|
166
166
|
ifHelper(expect(helper, 'BUG: helper must exist'));
|
|
@@ -178,6 +178,7 @@ function resolveComponentOrHelper(resolver, constants, meta, [, expr, {
|
|
|
178
178
|
} else {
|
|
179
179
|
let helper = resolver.lookupHelper(name, owner);
|
|
180
180
|
if (DEBUG && helper === null) {
|
|
181
|
+
assert(!meta.isStrictMode, 'Strict mode errors should already be handled at compile time');
|
|
181
182
|
throw new Error(`Attempted to resolve \`${name}\`, which was expected to be a component or helper, but nothing was found.`);
|
|
182
183
|
}
|
|
183
184
|
ifHelper(constants.helper(helper, name));
|
|
@@ -185,24 +186,6 @@ function resolveComponentOrHelper(resolver, constants, meta, [, expr, {
|
|
|
185
186
|
}
|
|
186
187
|
}
|
|
187
188
|
|
|
188
|
-
/**
|
|
189
|
-
* <Foo @arg={{helper}}>
|
|
190
|
-
*/
|
|
191
|
-
function resolveOptionalHelper(resolver, constants, meta, [, expr, {
|
|
192
|
-
ifHelper
|
|
193
|
-
}]) {
|
|
194
|
-
assert$1(isGetFreeOptionalHelper(expr) || isGetFreeDeprecatedHelper(expr), 'Attempted to resolve a helper with incorrect opcode');
|
|
195
|
-
let {
|
|
196
|
-
upvars,
|
|
197
|
-
owner
|
|
198
|
-
} = assertResolverInvariants(meta);
|
|
199
|
-
let name = unwrap(upvars[expr[1]]);
|
|
200
|
-
let helper = resolver.lookupHelper(name, owner);
|
|
201
|
-
if (helper) {
|
|
202
|
-
ifHelper(constants.helper(helper, name), name, meta.moduleName);
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
|
|
206
189
|
/**
|
|
207
190
|
* {{maybeHelperOrComponent}}
|
|
208
191
|
*/
|
|
@@ -211,7 +194,7 @@ function resolveOptionalComponentOrHelper(resolver, constants, meta, [, expr, {
|
|
|
211
194
|
ifHelper,
|
|
212
195
|
ifValue
|
|
213
196
|
}]) {
|
|
214
|
-
assert
|
|
197
|
+
assert(isGetFreeComponentOrHelper(expr), 'Attempted to resolve an optional component or helper with incorrect opcode');
|
|
215
198
|
let type = expr[0];
|
|
216
199
|
if (type === SexpOpcodes.GetLexicalSymbol) {
|
|
217
200
|
let {
|
|
@@ -261,6 +244,8 @@ function lookupBuiltInHelper(expr, resolver, meta, constants, type) {
|
|
|
261
244
|
let name = unwrap(upvars[expr[1]]);
|
|
262
245
|
let helper = resolver.lookupBuiltInHelper(name);
|
|
263
246
|
if (DEBUG && helper === null) {
|
|
247
|
+
assert(!meta.isStrictMode, 'Strict mode errors should already be handled at compile time');
|
|
248
|
+
|
|
264
249
|
// Keyword helper did not exist, which means that we're attempting to use a
|
|
265
250
|
// value of some kind that is not in scope
|
|
266
251
|
throw new Error(`Attempted to resolve a ${type} in a strict mode template, but that value was not in scope: ${meta.upvars[expr[1]] ?? '{unknown variable}'}`);
|
|
@@ -272,10 +257,8 @@ const HighLevelResolutionOpcodes = {
|
|
|
272
257
|
Modifier: 1003,
|
|
273
258
|
Component: 1004,
|
|
274
259
|
Helper: 1005,
|
|
275
|
-
OptionalHelper: 1006,
|
|
276
260
|
ComponentOrHelper: 1007,
|
|
277
261
|
OptionalComponentOrHelper: 1008,
|
|
278
|
-
Free: 1009,
|
|
279
262
|
Local: 1010,
|
|
280
263
|
TemplateLocal: 1011
|
|
281
264
|
};
|
|
@@ -328,7 +311,7 @@ function stdlibOperand(value) {
|
|
|
328
311
|
};
|
|
329
312
|
}
|
|
330
313
|
function nonSmallIntOperand(value) {
|
|
331
|
-
assert
|
|
314
|
+
assert(!isSmallInt(value), 'Attempted to make a operand for an int that was not a small int, you should encode this as an immediate');
|
|
332
315
|
return {
|
|
333
316
|
type: HighLevelOperands.NonSmallInt,
|
|
334
317
|
value
|
|
@@ -369,7 +352,7 @@ class Labels {
|
|
|
369
352
|
target
|
|
370
353
|
} of targets) {
|
|
371
354
|
let address = labels[target] - at;
|
|
372
|
-
assert
|
|
355
|
+
assert(heap.getbyaddr(at) === -1, 'Expected heap to contain a placeholder, but it did not');
|
|
373
356
|
heap.setbyaddr(at, address);
|
|
374
357
|
}
|
|
375
358
|
}
|
|
@@ -394,8 +377,6 @@ function encodeOp(encoder, constants, resolver, meta, op) {
|
|
|
394
377
|
return resolveHelper(resolver, constants, meta, op);
|
|
395
378
|
case HighLevelResolutionOpcodes.ComponentOrHelper:
|
|
396
379
|
return resolveComponentOrHelper(resolver, constants, meta, op);
|
|
397
|
-
case HighLevelResolutionOpcodes.OptionalHelper:
|
|
398
|
-
return resolveOptionalHelper(resolver, constants, meta, op);
|
|
399
380
|
case HighLevelResolutionOpcodes.OptionalComponentOrHelper:
|
|
400
381
|
return resolveOptionalComponentOrHelper(resolver, constants, meta, op);
|
|
401
382
|
case HighLevelResolutionOpcodes.Local:
|
|
@@ -409,17 +390,10 @@ function encodeOp(encoder, constants, resolver, meta, op) {
|
|
|
409
390
|
case HighLevelResolutionOpcodes.TemplateLocal:
|
|
410
391
|
{
|
|
411
392
|
let [, valueIndex, then] = op;
|
|
412
|
-
let value = expect(meta.scopeValues, 'BUG: Attempted to
|
|
393
|
+
let value = expect(meta.scopeValues, 'BUG: Attempted to get a template local, but template does not have any')[valueIndex];
|
|
413
394
|
then(constants.value(value));
|
|
414
395
|
break;
|
|
415
396
|
}
|
|
416
|
-
case HighLevelResolutionOpcodes.Free:
|
|
417
|
-
if (DEBUG) {
|
|
418
|
-
let [, upvarIndex] = op;
|
|
419
|
-
let freeName = expect(meta.upvars, 'BUG: attempted to resolve value but no upvars found')[upvarIndex];
|
|
420
|
-
throw new Error(`Attempted to resolve a value in a strict mode template, but that value was not in scope: ${freeName}`);
|
|
421
|
-
}
|
|
422
|
-
break;
|
|
423
397
|
default:
|
|
424
398
|
throw new Error(`Unexpected high level opcode ${op[0]}`);
|
|
425
399
|
}
|
|
@@ -683,7 +657,7 @@ class Compilers {
|
|
|
683
657
|
let name = sexp[0];
|
|
684
658
|
let index = unwrap(this.names[name]);
|
|
685
659
|
let func = this.funcs[index];
|
|
686
|
-
assert
|
|
660
|
+
assert(!!func, `expected an implementation for ${sexp[0]}`);
|
|
687
661
|
func(op, sexp);
|
|
688
662
|
}
|
|
689
663
|
}
|
|
@@ -718,42 +692,17 @@ EXPRESSIONS.add(SexpOpcodes.GetLexicalSymbol, (op, [, sym, path]) => {
|
|
|
718
692
|
withPath(op, path);
|
|
719
693
|
});
|
|
720
694
|
});
|
|
721
|
-
EXPRESSIONS.add(SexpOpcodes.GetStrictKeyword, (op,
|
|
722
|
-
op(HighLevelResolutionOpcodes.Free, sym, _handle => {
|
|
723
|
-
// TODO: Implement in strict mode
|
|
724
|
-
});
|
|
725
|
-
});
|
|
726
|
-
EXPRESSIONS.add(SexpOpcodes.GetFreeAsComponentOrHelperHeadOrThisFallback, () => {
|
|
727
|
-
// TODO: The logic for this opcode currently exists in STATEMENTS.Append, since
|
|
728
|
-
// we want different wrapping logic depending on if we are invoking a component,
|
|
729
|
-
// helper, or {{this}} fallback. Eventually we fix the opcodes so that we can
|
|
730
|
-
// traverse the subexpression tree like normal in this location.
|
|
731
|
-
throw new Error('unimplemented opcode');
|
|
732
|
-
});
|
|
733
|
-
EXPRESSIONS.add(SexpOpcodes.GetFreeAsHelperHeadOrThisFallback, (op, expr) => {
|
|
734
|
-
// <div id={{baz}}>
|
|
735
|
-
|
|
695
|
+
EXPRESSIONS.add(SexpOpcodes.GetStrictKeyword, (op, expr) => {
|
|
736
696
|
op(HighLevelResolutionOpcodes.Local, expr[1], _name => {
|
|
737
|
-
op(HighLevelResolutionOpcodes.
|
|
738
|
-
|
|
739
|
-
Call(op, handle, null, null);
|
|
740
|
-
}
|
|
697
|
+
op(HighLevelResolutionOpcodes.Helper, expr, handle => {
|
|
698
|
+
Call(op, handle, null, null);
|
|
741
699
|
});
|
|
742
700
|
});
|
|
743
701
|
});
|
|
744
|
-
EXPRESSIONS.add(SexpOpcodes.
|
|
745
|
-
// <Foo @bar={{baz}}>
|
|
746
|
-
|
|
702
|
+
EXPRESSIONS.add(SexpOpcodes.GetFreeAsHelperHead, (op, expr) => {
|
|
747
703
|
op(HighLevelResolutionOpcodes.Local, expr[1], _name => {
|
|
748
|
-
op(HighLevelResolutionOpcodes.
|
|
749
|
-
|
|
750
|
-
assert(expr[2] && expr[2].length === 1, '[BUG] Missing argument name');
|
|
751
|
-
let arg = expr[2][0];
|
|
752
|
-
deprecate(`The \`${name}\` helper was used in the \`${moduleName}\` template as \`${arg}={{${name}}}\`. ` + `This is ambigious between wanting the \`${arg}\` argument to be the \`${name}\` helper itself, ` + `or the result of invoking the \`${name}\` helper (current behavior). ` + `This implicit invocation behavior has been deprecated.\n\n` + `Instead, please explicitly invoke the helper with parenthesis, i.e. \`${arg}={{(${name})}}\`.\n\n` + `Note: the parenthesis are only required in this exact scenario where an ambiguity is present – where ` + `\`${name}\` referes to a global helper (as opposed to a local variable), AND ` + `the \`${name}\` helper invocation does not take any arguments, AND ` + `this occurs in a named argument position of a component invocation.\n\n` + `We expect this combination to be quite rare, as most helpers require at least one argument. ` + `There is no need to refactor helper invocations in cases where this deprecation was not triggered.`, false, {
|
|
753
|
-
id: 'argument-less-helper-paren-less-invocation'
|
|
754
|
-
});
|
|
755
|
-
Call(op, handle, null, null);
|
|
756
|
-
}
|
|
704
|
+
op(HighLevelResolutionOpcodes.Helper, expr, handle => {
|
|
705
|
+
Call(op, handle, null, null);
|
|
757
706
|
});
|
|
758
707
|
});
|
|
759
708
|
});
|
|
@@ -1705,7 +1654,7 @@ STATEMENTS.add(SexpOpcodes.Append, (op, [, value]) => {
|
|
|
1705
1654
|
// Special case for static values
|
|
1706
1655
|
if (!Array.isArray(value)) {
|
|
1707
1656
|
op(Op.Text, value === null || value === undefined ? '' : String(value));
|
|
1708
|
-
} else if (
|
|
1657
|
+
} else if (isGetFreeComponentOrHelper(value)) {
|
|
1709
1658
|
op(HighLevelResolutionOpcodes.OptionalComponentOrHelper, value, {
|
|
1710
1659
|
ifComponent(component) {
|
|
1711
1660
|
InvokeComponent(op, component, null, null, null, null);
|
|
@@ -1841,20 +1790,6 @@ STATEMENTS.add(SexpOpcodes.Each, (op, [, value, key, block, inverse]) => Replaya
|
|
|
1841
1790
|
InvokeStaticBlock(op, inverse);
|
|
1842
1791
|
}
|
|
1843
1792
|
}));
|
|
1844
|
-
STATEMENTS.add(SexpOpcodes.With, (op, [, value, block, inverse]) => {
|
|
1845
|
-
ReplayableIf(op, () => {
|
|
1846
|
-
expr(op, value);
|
|
1847
|
-
op(Op.Dup, $sp, 0);
|
|
1848
|
-
op(Op.ToBoolean);
|
|
1849
|
-
return 2;
|
|
1850
|
-
}, () => {
|
|
1851
|
-
InvokeStaticBlockWithStack(op, block, 1);
|
|
1852
|
-
}, () => {
|
|
1853
|
-
if (inverse) {
|
|
1854
|
-
InvokeStaticBlock(op, inverse);
|
|
1855
|
-
}
|
|
1856
|
-
});
|
|
1857
|
-
});
|
|
1858
1793
|
STATEMENTS.add(SexpOpcodes.Let, (op, [, positional, block]) => {
|
|
1859
1794
|
let count = CompilePositional(op, positional);
|
|
1860
1795
|
InvokeStaticBlockWithStack(op, block, count);
|