ember-source 5.7.0-alpha.2 → 5.7.0-alpha.4

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.
@@ -1,13 +1,13 @@
1
1
  import { check, CheckPrimitive, CheckNumber, CheckOption, CheckHandle, CheckBlockSymbolTable, CheckInstanceof, CheckString, CheckElement, CheckMaybe, CheckNode, CheckOr, CheckProgramSymbolTable, CheckInterface, CheckFunction, wrap, CheckArray, CheckDict, CheckUnknown, CheckObject, CheckSafeString, CheckDocumentFragment, recordStackSize } from '@glimmer/debug';
2
2
  import { createConstRef, createPrimitiveRef, valueForRef, isConstRef, createComputeRef, UNDEFINED_REFERENCE, createDebugAliasRef, childRefFor, TRUE_REFERENCE, FALSE_REFERENCE, createIteratorRef, NULL_REFERENCE, REFERENCE, isInvokableRef, updateRef, createIteratorItemRef } from '@glimmer/reference';
3
- import { decodeHandle, isHandle, decodeImmediate, assert, expect, unwrap, isObject, assign, debugToString, EMPTY_STRING_ARRAY, dict, unwrapTemplate, enumerate, emptyArray, castToSimple, buildUntouchableThis, NS_SVG, castToBrowser, Stack, clearElement, INSERT_AFTER_BEGIN, INSERT_BEFORE_END, isDict, unwrapHandle, reverse, COMMENT_NODE, fillNulls, INSERT_BEFORE_BEGIN } from '@glimmer/util';
3
+ import { decodeHandle, isHandle, decodeImmediate, assert, expect, unwrap, isObject, assign, debugToString, EMPTY_STRING_ARRAY, dict, unwrapTemplate, enumerate, emptyArray, castToSimple, buildUntouchableThis, NS_SVG, castToBrowser, Stack, clearElement, INSERT_AFTER_BEGIN, INSERT_BEFORE_END, isDict, unwrapHandle, reverse, COMMENT_NODE, INSERT_BEFORE_BEGIN } from '@glimmer/util';
4
4
  import { Op, $t0, CurriedTypes, $t1, InternalComponentCapabilities, $sp, $v0, ContentType, CurriedType, $pc, isLowLevelRegister, $s1, $s0, $fp, $ra, MachineOp } from '@glimmer/vm';
5
5
  import { destroy, associateDestroyableChild, registerDestructor, _hasDestroyableChildren, isDestroying, isDestroyed, destroyChildren } from '@glimmer/destroyable';
6
6
  export { destroy, isDestroyed, isDestroying, registerDestructor } from '@glimmer/destroyable';
7
7
  import { DEBUG } from '@glimmer/env';
8
8
  import { toBool, warnIfStyleNotTrusted, getPath, setPath, assertGlobalContextWasSet, deprecate } from '@glimmer/global-context';
9
+ import { getInternalModifierManager, managerHasCapability, getInternalHelperManager, setInternalComponentManager, setInternalModifierManager, hasInternalComponentManager, hasInternalHelperManager, setInternalHelperManager, hasValue, hasDestroyable } from '@glimmer/manager';
9
10
  import { consumeTag, valueForTag, validateTag, CURRENT_TAG, COMPUTE, CONSTANT_TAG, createCache, debug, resetTracking, beginTrackFrame, endTrackFrame, track, updateTag, createUpdatableTag, INITIAL, getValue } from '@glimmer/validator';
10
- import { managerHasCapability, setInternalComponentManager, setInternalModifierManager, hasInternalComponentManager, hasInternalHelperManager, setInternalHelperManager, getInternalHelperManager, hasValue, hasDestroyable } from '@glimmer/manager';
11
11
  import { RuntimeProgramImpl } from '@glimmer/program';
12
12
  import { getOwner } from '@glimmer/owner';
13
13
 
@@ -31,24 +31,14 @@ class DynamicScopeImpl {
31
31
  }
32
32
  }
33
33
  class PartialScopeImpl {
34
- static root(self) {
35
- let size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
36
- let owner = arguments.length > 2 ? arguments[2] : undefined;
37
- let refs = new Array(size + 1);
38
- for (let i = 0; i <= size; i++) {
39
- refs[i] = UNDEFINED_REFERENCE;
40
- }
34
+ static root(self, size = 0, owner) {
35
+ let refs = new Array(size + 1).fill(UNDEFINED_REFERENCE);
41
36
  return new PartialScopeImpl(refs, owner, null, null, null).init({
42
37
  self
43
38
  });
44
39
  }
45
- static sized() {
46
- let size = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
47
- let owner = arguments.length > 1 ? arguments[1] : undefined;
48
- let refs = new Array(size + 1);
49
- for (let i = 0; i <= size; i++) {
50
- refs[i] = UNDEFINED_REFERENCE;
51
- }
40
+ static sized(size = 0, owner) {
41
+ let refs = new Array(size + 1).fill(UNDEFINED_REFERENCE);
52
42
  return new PartialScopeImpl(refs, owner, null, null, null);
53
43
  }
54
44
  constructor(
@@ -64,10 +54,9 @@ class PartialScopeImpl {
64
54
  this.evalScope = evalScope;
65
55
  this.partialMap = partialMap;
66
56
  }
67
- init(_ref) {
68
- let {
69
- self
70
- } = _ref;
57
+ init({
58
+ self
59
+ }) {
71
60
  this.slots[0] = self;
72
61
  return this;
73
62
  }
@@ -162,21 +151,6 @@ class ConcreteBounds {
162
151
  return this.last;
163
152
  }
164
153
  }
165
- class SingleNodeBounds {
166
- constructor(parentNode, node) {
167
- this.parentNode = parentNode;
168
- this.node = node;
169
- }
170
- parentElement() {
171
- return this.parentNode;
172
- }
173
- firstNode() {
174
- return this.node;
175
- }
176
- lastNode() {
177
- return this.node;
178
- }
179
- }
180
154
  function move(bounds, reference) {
181
155
  let parent = bounds.parentElement();
182
156
  let first = bounds.firstNode();
@@ -332,46 +306,49 @@ function checkDataURI(tagName, attribute) {
332
306
  function requiresSanitization(tagName, attribute) {
333
307
  return checkURI(tagName, attribute) || checkDataURI(tagName, attribute);
334
308
  }
335
- let protocolForUrl;
336
- if (typeof URL === 'object' && URL !== null &&
337
- // this is super annoying, TS thinks that URL **must** be a function so `URL.parse` check
338
- // thinks it is `never` without this `as unknown as any`
339
- typeof URL.parse === 'function') {
340
- // In Ember-land the `fastboot` package sets the `URL` global to `require('url')`
341
- // ultimately, this should be changed (so that we can either rely on the natural `URL` global
342
- // that exists) but for now we have to detect the specific `FastBoot` case first
343
- //
344
- // a future version of `fastboot` will detect if this legacy URL setup is required (by
345
- // inspecting Ember version) and if new enough, it will avoid shadowing the `URL` global
346
- // constructor with `require('url')`.
347
- let nodeURL = URL;
348
- protocolForUrl = url => {
349
- let protocol = null;
350
- if (typeof url === 'string') {
351
- protocol = nodeURL.parse(url).protocol;
352
- }
353
- return protocol === null ? ':' : protocol;
354
- };
355
- } else if (typeof URL === 'function') {
356
- protocolForUrl = _url => {
357
- try {
358
- let url = new URL(_url);
359
- return url.protocol;
360
- } catch (error) {
361
- // any non-fully qualified url string will trigger an error (because there is no
362
- // baseURI that we can provide; in that case we **know** that the protocol is
363
- // "safe" because it isn't specifically one of the `badProtocols` listed above
364
- // (and those protocols can never be the default baseURI)
365
- return ':';
366
- }
367
- };
368
- } else {
369
- // fallback for IE11 support
370
- let parsingNode = document.createElement('a');
371
- protocolForUrl = url => {
372
- parsingNode.href = url;
373
- return parsingNode.protocol;
374
- };
309
+ function findProtocolForURL() {
310
+ if (typeof URL === 'object' && URL !== null &&
311
+ // this is super annoying, TS thinks that URL **must** be a function so `URL.parse` check
312
+ // thinks it is `never` without this `as unknown as any`
313
+ typeof URL.parse === 'function') {
314
+ // In Ember-land the `fastboot` package sets the `URL` global to `require('url')`
315
+ // ultimately, this should be changed (so that we can either rely on the natural `URL` global
316
+ // that exists) but for now we have to detect the specific `FastBoot` case first
317
+ //
318
+ // a future version of `fastboot` will detect if this legacy URL setup is required (by
319
+ // inspecting Ember version) and if new enough, it will avoid shadowing the `URL` global
320
+ // constructor with `require('url')`.
321
+ let nodeURL = URL;
322
+ return url => {
323
+ let protocol = null;
324
+ if (typeof url === 'string') {
325
+ protocol = nodeURL.parse(url).protocol;
326
+ }
327
+ return protocol === null ? ':' : protocol;
328
+ };
329
+ } else if (typeof URL === 'function') {
330
+ return _url => {
331
+ try {
332
+ let url = new URL(_url);
333
+ return url.protocol;
334
+ } catch (error) {
335
+ // any non-fully qualified url string will trigger an error (because there is no
336
+ // baseURI that we can provide; in that case we **know** that the protocol is
337
+ // "safe" because it isn't specifically one of the `badProtocols` listed above
338
+ // (and those protocols can never be the default baseURI)
339
+ return ':';
340
+ }
341
+ };
342
+ } else {
343
+ throw new Error(`@glimmer/runtime needs a valid "globalThis.URL"`);
344
+ }
345
+ }
346
+ let _protocolForUrlImplementation;
347
+ function protocolForUrl(url) {
348
+ if (!_protocolForUrlImplementation) {
349
+ _protocolForUrlImplementation = findProtocolForURL();
350
+ }
351
+ return _protocolForUrlImplementation(url);
375
352
  }
376
353
  function sanitizeAttributeValue(element, attribute, value) {
377
354
  let tagName = null;
@@ -399,8 +376,7 @@ function sanitizeAttributeValue(element, attribute, value) {
399
376
  return str;
400
377
  }
401
378
 
402
- function dynamicAttribute(element, attr, namespace) {
403
- let isTrusting = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
379
+ function dynamicAttribute(element, attr, namespace, isTrusting = false) {
404
380
  const {
405
381
  tagName,
406
382
  namespaceURI
@@ -682,8 +658,7 @@ class NewElementBuilder {
682
658
  pushBlockList(list) {
683
659
  return this.pushLiveBlock(new LiveBlockList(this.element, list));
684
660
  }
685
- pushLiveBlock(block) {
686
- let isRemote = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
661
+ pushLiveBlock(block, isRemote = false) {
687
662
  let current = this.blockStack.current;
688
663
  if (current !== null) {
689
664
  if (!isRemote) {
@@ -746,8 +721,7 @@ class NewElementBuilder {
746
721
  this.popBlock();
747
722
  this.popElement();
748
723
  }
749
- pushElement(element) {
750
- let nextSibling = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
724
+ pushElement(element, nextSibling = null) {
751
725
  this[CURSOR_STACK].push(new CursorImpl(element, nextSibling));
752
726
  }
753
727
  pushModifiers(modifiers) {
@@ -795,7 +769,8 @@ class NewElementBuilder {
795
769
  this.dom.insertBefore(this.element, fragment, this.nextSibling);
796
770
  return ret;
797
771
  } else {
798
- return new SingleNodeBounds(this.element, this.__appendComment(''));
772
+ const comment = this.__appendComment('');
773
+ return new ConcreteBounds(this.element, comment, comment);
799
774
  }
800
775
  }
801
776
  __appendHTML(html) {
@@ -816,7 +791,7 @@ class NewElementBuilder {
816
791
  }
817
792
  appendDynamicNode(value) {
818
793
  let node = this.__appendNode(value);
819
- let bounds = new SingleNodeBounds(this.element, node);
794
+ let bounds = new ConcreteBounds(this.element, node, node);
820
795
  this.didAppendBounds(bounds);
821
796
  }
822
797
  trustedContent(value) {
@@ -983,9 +958,8 @@ function clientBuilder(env, cursor) {
983
958
  }
984
959
 
985
960
  class AppendOpcodes {
986
- evaluateOpcode = fillNulls(Op.Size).slice();
987
- add(name, evaluate) {
988
- let kind = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'syscall';
961
+ evaluateOpcode = new Array(Op.Size).fill(null);
962
+ add(name, evaluate, kind = 'syscall') {
989
963
  this.evaluateOpcode[name] = {
990
964
  syscall: kind !== 'machine',
991
965
  evaluate
@@ -1042,8 +1016,7 @@ class CurriedValue {
1042
1016
  [RESOLVED];
1043
1017
 
1044
1018
  /** @internal */
1045
- constructor(type, inner, owner, args) {
1046
- let resolved = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
1019
+ constructor(type, inner, owner, args, resolved = false) {
1047
1020
  CURRIED_VALUES.add(this);
1048
1021
  this[TYPE] = type;
1049
1022
  this[INNER] = inner;
@@ -1096,8 +1069,7 @@ function resolveCurriedValue(curriedValue) {
1096
1069
  named
1097
1070
  };
1098
1071
  }
1099
- function curry(type, spec, owner, args) {
1100
- let resolved = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
1072
+ function curry(type, spec, owner, args, resolved = false) {
1101
1073
  return new CurriedValue(type, spec, owner, args, resolved);
1102
1074
  }
1103
1075
 
@@ -1166,22 +1138,19 @@ APPEND_OPCODES.add(Op.ChildScope, vm => vm.pushChildScope());
1166
1138
  APPEND_OPCODES.add(Op.PopScope, vm => vm.popScope());
1167
1139
  APPEND_OPCODES.add(Op.PushDynamicScope, vm => vm.pushDynamicScope());
1168
1140
  APPEND_OPCODES.add(Op.PopDynamicScope, vm => vm.popDynamicScope());
1169
- APPEND_OPCODES.add(Op.Constant, (vm, _ref) => {
1170
- let {
1171
- op1: other
1172
- } = _ref;
1141
+ APPEND_OPCODES.add(Op.Constant, (vm, {
1142
+ op1: other
1143
+ }) => {
1173
1144
  vm.stack.push(vm[CONSTANTS].getValue(decodeHandle(other)));
1174
1145
  });
1175
- APPEND_OPCODES.add(Op.ConstantReference, (vm, _ref2) => {
1176
- let {
1177
- op1: other
1178
- } = _ref2;
1146
+ APPEND_OPCODES.add(Op.ConstantReference, (vm, {
1147
+ op1: other
1148
+ }) => {
1179
1149
  vm.stack.push(createConstRef(vm[CONSTANTS].getValue(decodeHandle(other)), false));
1180
1150
  });
1181
- APPEND_OPCODES.add(Op.Primitive, (vm, _ref3) => {
1182
- let {
1183
- op1: primitive
1184
- } = _ref3;
1151
+ APPEND_OPCODES.add(Op.Primitive, (vm, {
1152
+ op1: primitive
1153
+ }) => {
1185
1154
  let stack = vm.stack;
1186
1155
  if (isHandle(primitive)) {
1187
1156
  // it is a handle which does not already exist on the stack
@@ -1209,52 +1178,45 @@ APPEND_OPCODES.add(Op.PrimitiveReference, vm => {
1209
1178
  }
1210
1179
  stack.push(ref);
1211
1180
  });
1212
- APPEND_OPCODES.add(Op.Dup, (vm, _ref4) => {
1213
- let {
1214
- op1: register,
1215
- op2: offset
1216
- } = _ref4;
1181
+ APPEND_OPCODES.add(Op.Dup, (vm, {
1182
+ op1: register,
1183
+ op2: offset
1184
+ }) => {
1217
1185
  let position = check(vm.fetchValue(register), CheckNumber) - offset;
1218
1186
  vm.stack.dup(position);
1219
1187
  });
1220
- APPEND_OPCODES.add(Op.Pop, (vm, _ref5) => {
1221
- let {
1222
- op1: count
1223
- } = _ref5;
1188
+ APPEND_OPCODES.add(Op.Pop, (vm, {
1189
+ op1: count
1190
+ }) => {
1224
1191
  vm.stack.pop(count);
1225
1192
  });
1226
- APPEND_OPCODES.add(Op.Load, (vm, _ref6) => {
1227
- let {
1228
- op1: register
1229
- } = _ref6;
1193
+ APPEND_OPCODES.add(Op.Load, (vm, {
1194
+ op1: register
1195
+ }) => {
1230
1196
  vm.load(register);
1231
1197
  });
1232
- APPEND_OPCODES.add(Op.Fetch, (vm, _ref7) => {
1233
- let {
1234
- op1: register
1235
- } = _ref7;
1198
+ APPEND_OPCODES.add(Op.Fetch, (vm, {
1199
+ op1: register
1200
+ }) => {
1236
1201
  vm.fetch(register);
1237
1202
  });
1238
- APPEND_OPCODES.add(Op.BindDynamicScope, (vm, _ref8) => {
1239
- let {
1240
- op1: _names
1241
- } = _ref8;
1203
+ APPEND_OPCODES.add(Op.BindDynamicScope, (vm, {
1204
+ op1: _names
1205
+ }) => {
1242
1206
  let names = vm[CONSTANTS].getArray(_names);
1243
1207
  vm.bindDynamicScope(names);
1244
1208
  });
1245
- APPEND_OPCODES.add(Op.Enter, (vm, _ref9) => {
1246
- let {
1247
- op1: args
1248
- } = _ref9;
1209
+ APPEND_OPCODES.add(Op.Enter, (vm, {
1210
+ op1: args
1211
+ }) => {
1249
1212
  vm.enter(args);
1250
1213
  });
1251
1214
  APPEND_OPCODES.add(Op.Exit, vm => {
1252
1215
  vm.exit();
1253
1216
  });
1254
- APPEND_OPCODES.add(Op.PushSymbolTable, (vm, _ref10) => {
1255
- let {
1256
- op1: _table
1257
- } = _ref10;
1217
+ APPEND_OPCODES.add(Op.PushSymbolTable, (vm, {
1218
+ op1: _table
1219
+ }) => {
1258
1220
  let stack = vm.stack;
1259
1221
  stack.push(vm[CONSTANTS].getValue(_table));
1260
1222
  });
@@ -1303,10 +1265,9 @@ APPEND_OPCODES.add(Op.InvokeYield, vm => {
1303
1265
  vm.pushScope(invokingScope);
1304
1266
  vm.call(handle);
1305
1267
  });
1306
- APPEND_OPCODES.add(Op.JumpIf, (vm, _ref11) => {
1307
- let {
1308
- op1: target
1309
- } = _ref11;
1268
+ APPEND_OPCODES.add(Op.JumpIf, (vm, {
1269
+ op1: target
1270
+ }) => {
1310
1271
  let reference = check(vm.stack.pop(), CheckReference);
1311
1272
  let value = Boolean(valueForRef(reference));
1312
1273
  if (isConstRef(reference)) {
@@ -1320,10 +1281,9 @@ APPEND_OPCODES.add(Op.JumpIf, (vm, _ref11) => {
1320
1281
  vm.updateWith(new Assert(reference));
1321
1282
  }
1322
1283
  });
1323
- APPEND_OPCODES.add(Op.JumpUnless, (vm, _ref12) => {
1324
- let {
1325
- op1: target
1326
- } = _ref12;
1284
+ APPEND_OPCODES.add(Op.JumpUnless, (vm, {
1285
+ op1: target
1286
+ }) => {
1327
1287
  let reference = check(vm.stack.pop(), CheckReference);
1328
1288
  let value = Boolean(valueForRef(reference));
1329
1289
  if (isConstRef(reference)) {
@@ -1337,11 +1297,10 @@ APPEND_OPCODES.add(Op.JumpUnless, (vm, _ref12) => {
1337
1297
  vm.updateWith(new Assert(reference));
1338
1298
  }
1339
1299
  });
1340
- APPEND_OPCODES.add(Op.JumpEq, (vm, _ref13) => {
1341
- let {
1342
- op1: target,
1343
- op2: comparison
1344
- } = _ref13;
1300
+ APPEND_OPCODES.add(Op.JumpEq, (vm, {
1301
+ op1: target,
1302
+ op2: comparison
1303
+ }) => {
1345
1304
  let other = check(vm.stack.peek(), CheckNumber);
1346
1305
  if (other === comparison) {
1347
1306
  vm.goto(target);
@@ -1439,22 +1398,19 @@ class EndTrackFrameOpcode {
1439
1398
  }
1440
1399
  }
1441
1400
 
1442
- APPEND_OPCODES.add(Op.Text, (vm, _ref) => {
1443
- let {
1444
- op1: text
1445
- } = _ref;
1401
+ APPEND_OPCODES.add(Op.Text, (vm, {
1402
+ op1: text
1403
+ }) => {
1446
1404
  vm.elements().appendText(vm[CONSTANTS].getValue(text));
1447
1405
  });
1448
- APPEND_OPCODES.add(Op.Comment, (vm, _ref2) => {
1449
- let {
1450
- op1: text
1451
- } = _ref2;
1406
+ APPEND_OPCODES.add(Op.Comment, (vm, {
1407
+ op1: text
1408
+ }) => {
1452
1409
  vm.elements().appendComment(vm[CONSTANTS].getValue(text));
1453
1410
  });
1454
- APPEND_OPCODES.add(Op.OpenElement, (vm, _ref3) => {
1455
- let {
1456
- op1: tag
1457
- } = _ref3;
1411
+ APPEND_OPCODES.add(Op.OpenElement, (vm, {
1412
+ op1: tag
1413
+ }) => {
1458
1414
  vm.elements().openElement(vm[CONSTANTS].getValue(tag));
1459
1415
  });
1460
1416
  APPEND_OPCODES.add(Op.OpenDynamicElement, vm => {
@@ -1491,24 +1447,19 @@ APPEND_OPCODES.add(Op.FlushElement, vm => {
1491
1447
  });
1492
1448
  APPEND_OPCODES.add(Op.CloseElement, vm => {
1493
1449
  let modifiers = vm.elements().closeElement();
1494
- if (modifiers) {
1450
+ if (modifiers !== null) {
1495
1451
  modifiers.forEach(modifier => {
1496
1452
  vm.env.scheduleInstallModifier(modifier);
1497
- let {
1498
- manager,
1499
- state
1500
- } = modifier;
1501
- let d = manager.getDestroyable(state);
1502
- if (d) {
1453
+ const d = modifier.manager.getDestroyable(modifier.state);
1454
+ if (d !== null) {
1503
1455
  vm.associateDestroyable(d);
1504
1456
  }
1505
1457
  });
1506
1458
  }
1507
1459
  });
1508
- APPEND_OPCODES.add(Op.Modifier, (vm, _ref4) => {
1509
- let {
1510
- op1: handle
1511
- } = _ref4;
1460
+ APPEND_OPCODES.add(Op.Modifier, (vm, {
1461
+ op1: handle
1462
+ }) => {
1512
1463
  if (vm.env.isInteractive === false) {
1513
1464
  return;
1514
1465
  }
@@ -1540,8 +1491,7 @@ APPEND_OPCODES.add(Op.DynamicModifier, vm => {
1540
1491
  return;
1541
1492
  }
1542
1493
  let {
1543
- stack,
1544
- [CONSTANTS]: constants
1494
+ stack
1545
1495
  } = vm;
1546
1496
  let ref = check(stack.pop(), CheckReference);
1547
1497
  let args = check(stack.pop(), CheckArguments).capture();
@@ -1575,14 +1525,19 @@ APPEND_OPCODES.add(Op.DynamicModifier, vm => {
1575
1525
  hostDefinition = value;
1576
1526
  owner = initialOwner;
1577
1527
  }
1578
- let handle = constants.modifier(hostDefinition, null, true);
1579
- if (DEBUG && handle === null) {
1580
- throw new Error(`Expected a dynamic modifier definition, but received an object or function that did not have a modifier manager associated with it. The dynamic invocation was \`{{${ref.debugLabel}}}\`, and the incorrect definition is the value at the path \`${ref.debugLabel}\`, which was: ${debugToString(hostDefinition)}`);
1528
+ let manager = getInternalModifierManager(hostDefinition, true);
1529
+ if (manager === null) {
1530
+ if (DEBUG) {
1531
+ throw new Error(`Expected a dynamic modifier definition, but received an object or function that did not have a modifier manager associated with it. The dynamic invocation was \`{{${ref.debugLabel}}}\`, and the incorrect definition is the value at the path \`${ref.debugLabel}\`, which was: ${debugToString(hostDefinition)}`);
1532
+ } else {
1533
+ throw new Error('BUG: modifier manager expected');
1534
+ }
1581
1535
  }
1582
- let definition = constants.getValue(expect(handle, 'BUG: modifier handle expected'));
1583
- let {
1584
- manager
1585
- } = definition;
1536
+ let definition = {
1537
+ resolvedName: null,
1538
+ manager,
1539
+ state: hostDefinition
1540
+ };
1586
1541
  let state = manager.create(owner, expect(constructing, 'BUG: ElementModifier could not find the element it applies to'), definition.state, args);
1587
1542
  return {
1588
1543
  manager,
@@ -1673,23 +1628,21 @@ class UpdateDynamicModifierOpcode {
1673
1628
  }
1674
1629
  }
1675
1630
  }
1676
- APPEND_OPCODES.add(Op.StaticAttr, (vm, _ref5) => {
1677
- let {
1678
- op1: _name,
1679
- op2: _value,
1680
- op3: _namespace
1681
- } = _ref5;
1631
+ APPEND_OPCODES.add(Op.StaticAttr, (vm, {
1632
+ op1: _name,
1633
+ op2: _value,
1634
+ op3: _namespace
1635
+ }) => {
1682
1636
  let name = vm[CONSTANTS].getValue(_name);
1683
1637
  let value = vm[CONSTANTS].getValue(_value);
1684
1638
  let namespace = _namespace ? vm[CONSTANTS].getValue(_namespace) : null;
1685
1639
  vm.elements().setStaticAttribute(name, value, namespace);
1686
1640
  });
1687
- APPEND_OPCODES.add(Op.DynamicAttr, (vm, _ref6) => {
1688
- let {
1689
- op1: _name,
1690
- op2: _trusting,
1691
- op3: _namespace
1692
- } = _ref6;
1641
+ APPEND_OPCODES.add(Op.DynamicAttr, (vm, {
1642
+ op1: _name,
1643
+ op2: _trusting,
1644
+ op3: _namespace
1645
+ }) => {
1693
1646
  let name = vm[CONSTANTS].getValue(_name);
1694
1647
  let trusting = vm[CONSTANTS].getValue(_trusting);
1695
1648
  let reference = check(vm.stack.pop(), CheckReference);
@@ -1729,10 +1682,9 @@ class UpdateDynamicAttributeOpcode {
1729
1682
  * component type's ComponentDefinition.
1730
1683
  */
1731
1684
 
1732
- APPEND_OPCODES.add(Op.PushComponentDefinition, (vm, _ref) => {
1733
- let {
1734
- op1: handle
1735
- } = _ref;
1685
+ APPEND_OPCODES.add(Op.PushComponentDefinition, (vm, {
1686
+ op1: handle
1687
+ }) => {
1736
1688
  let definition = vm[CONSTANTS].getValue(handle);
1737
1689
  assert(!!definition, `Missing component for ${handle}`);
1738
1690
  let {
@@ -1750,10 +1702,9 @@ APPEND_OPCODES.add(Op.PushComponentDefinition, (vm, _ref) => {
1750
1702
  };
1751
1703
  vm.stack.push(instance);
1752
1704
  });
1753
- APPEND_OPCODES.add(Op.ResolveDynamicComponent, (vm, _ref2) => {
1754
- let {
1755
- op1: _isStrict
1756
- } = _ref2;
1705
+ APPEND_OPCODES.add(Op.ResolveDynamicComponent, (vm, {
1706
+ op1: _isStrict
1707
+ }) => {
1757
1708
  let stack = vm.stack;
1758
1709
  let component = check(valueForRef(check(stack.pop(), CheckReference)), CheckOr(CheckString, CheckCurriedComponentDefinition));
1759
1710
  let constants = vm[CONSTANTS];
@@ -1815,12 +1766,11 @@ APPEND_OPCODES.add(Op.PushDynamicComponentInstance, vm => {
1815
1766
  table: null
1816
1767
  });
1817
1768
  });
1818
- APPEND_OPCODES.add(Op.PushArgs, (vm, _ref3) => {
1819
- let {
1820
- op1: _names,
1821
- op2: _blockNames,
1822
- op3: flags
1823
- } = _ref3;
1769
+ APPEND_OPCODES.add(Op.PushArgs, (vm, {
1770
+ op1: _names,
1771
+ op2: _blockNames,
1772
+ op3: flags
1773
+ }) => {
1824
1774
  let stack = vm.stack;
1825
1775
  let names = vm[CONSTANTS].getArray(_names);
1826
1776
  let positionalCount = flags >> 4;
@@ -1841,10 +1791,9 @@ APPEND_OPCODES.add(Op.CaptureArgs, vm => {
1841
1791
  let capturedArgs = args.capture();
1842
1792
  stack.push(capturedArgs);
1843
1793
  });
1844
- APPEND_OPCODES.add(Op.PrepareArgs, (vm, _ref4) => {
1845
- let {
1846
- op1: _state
1847
- } = _ref4;
1794
+ APPEND_OPCODES.add(Op.PrepareArgs, (vm, {
1795
+ op1: _state
1796
+ }) => {
1848
1797
  let stack = vm.stack;
1849
1798
  let instance = vm.fetchValue(_state);
1850
1799
  let args = check(stack.pop(), CheckInstanceof(VMArgumentsImpl));
@@ -1923,11 +1872,10 @@ APPEND_OPCODES.add(Op.PrepareArgs, (vm, _ref4) => {
1923
1872
  }
1924
1873
  stack.push(args);
1925
1874
  });
1926
- APPEND_OPCODES.add(Op.CreateComponent, (vm, _ref5) => {
1927
- let {
1928
- op1: flags,
1929
- op2: _state
1930
- } = _ref5;
1875
+ APPEND_OPCODES.add(Op.CreateComponent, (vm, {
1876
+ op1: flags,
1877
+ op2: _state
1878
+ }) => {
1931
1879
  let instance = check(vm.fetchValue(_state), CheckComponentInstance);
1932
1880
  let {
1933
1881
  definition,
@@ -1962,10 +1910,9 @@ APPEND_OPCODES.add(Op.CreateComponent, (vm, _ref5) => {
1962
1910
  vm.updateWith(new UpdateComponentOpcode(state, manager, dynamicScope));
1963
1911
  }
1964
1912
  });
1965
- APPEND_OPCODES.add(Op.RegisterComponentDestructor, (vm, _ref6) => {
1966
- let {
1967
- op1: _state
1968
- } = _ref6;
1913
+ APPEND_OPCODES.add(Op.RegisterComponentDestructor, (vm, {
1914
+ op1: _state
1915
+ }) => {
1969
1916
  let {
1970
1917
  manager,
1971
1918
  state,
@@ -1977,10 +1924,9 @@ APPEND_OPCODES.add(Op.RegisterComponentDestructor, (vm, _ref6) => {
1977
1924
  }
1978
1925
  if (d) vm.associateDestroyable(d);
1979
1926
  });
1980
- APPEND_OPCODES.add(Op.BeginComponentTransaction, (vm, _ref7) => {
1981
- let {
1982
- op1: _state
1983
- } = _ref7;
1927
+ APPEND_OPCODES.add(Op.BeginComponentTransaction, (vm, {
1928
+ op1: _state
1929
+ }) => {
1984
1930
  let name;
1985
1931
  if (DEBUG) {
1986
1932
  let {
@@ -1995,24 +1941,22 @@ APPEND_OPCODES.add(Op.BeginComponentTransaction, (vm, _ref7) => {
1995
1941
  APPEND_OPCODES.add(Op.PutComponentOperations, vm => {
1996
1942
  vm.loadValue($t0, new ComponentElementOperations());
1997
1943
  });
1998
- APPEND_OPCODES.add(Op.ComponentAttr, (vm, _ref8) => {
1999
- let {
2000
- op1: _name,
2001
- op2: _trusting,
2002
- op3: _namespace
2003
- } = _ref8;
1944
+ APPEND_OPCODES.add(Op.ComponentAttr, (vm, {
1945
+ op1: _name,
1946
+ op2: _trusting,
1947
+ op3: _namespace
1948
+ }) => {
2004
1949
  let name = vm[CONSTANTS].getValue(_name);
2005
1950
  let trusting = vm[CONSTANTS].getValue(_trusting);
2006
1951
  let reference = check(vm.stack.pop(), CheckReference);
2007
1952
  let namespace = _namespace ? vm[CONSTANTS].getValue(_namespace) : null;
2008
1953
  check(vm.fetchValue($t0), CheckInstanceof(ComponentElementOperations)).setAttribute(name, reference, trusting, namespace);
2009
1954
  });
2010
- APPEND_OPCODES.add(Op.StaticComponentAttr, (vm, _ref9) => {
2011
- let {
2012
- op1: _name,
2013
- op2: _value,
2014
- op3: _namespace
2015
- } = _ref9;
1955
+ APPEND_OPCODES.add(Op.StaticComponentAttr, (vm, {
1956
+ op1: _name,
1957
+ op2: _value,
1958
+ op3: _namespace
1959
+ }) => {
2016
1960
  let name = vm[CONSTANTS].getValue(_name);
2017
1961
  let value = vm[CONSTANTS].getValue(_value);
2018
1962
  let namespace = _namespace ? vm[CONSTANTS].getValue(_namespace) : null;
@@ -2080,15 +2024,9 @@ function mergeClasses(classes) {
2080
2024
  return createClassListRef(classes);
2081
2025
  }
2082
2026
  function allStringClasses(classes) {
2083
- for (let i = 0; i < classes.length; i++) {
2084
- if (typeof classes[i] !== 'string') {
2085
- return false;
2086
- }
2087
- }
2088
- return true;
2027
+ return classes.every(c => typeof c === 'string');
2089
2028
  }
2090
- function setDeferredAttr(vm, name, value, namespace) {
2091
- let trusting = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
2029
+ function setDeferredAttr(vm, name, value, namespace, trusting = false) {
2092
2030
  if (typeof value === 'string') {
2093
2031
  vm.elements().setStaticAttribute(name, value, namespace);
2094
2032
  } else {
@@ -2098,10 +2036,9 @@ function setDeferredAttr(vm, name, value, namespace) {
2098
2036
  }
2099
2037
  }
2100
2038
  }
2101
- APPEND_OPCODES.add(Op.DidCreateElement, (vm, _ref10) => {
2102
- let {
2103
- op1: _state
2104
- } = _ref10;
2039
+ APPEND_OPCODES.add(Op.DidCreateElement, (vm, {
2040
+ op1: _state
2041
+ }) => {
2105
2042
  let {
2106
2043
  definition,
2107
2044
  state
@@ -2112,11 +2049,10 @@ APPEND_OPCODES.add(Op.DidCreateElement, (vm, _ref10) => {
2112
2049
  let operations = check(vm.fetchValue($t0), CheckInstanceof(ComponentElementOperations));
2113
2050
  manager.didCreateElement(state, expect(vm.elements().constructing, `Expected a constructing element in DidCreateOpcode`), operations);
2114
2051
  });
2115
- APPEND_OPCODES.add(Op.GetComponentSelf, (vm, _ref11) => {
2116
- let {
2117
- op1: _state,
2118
- op2: _names
2119
- } = _ref11;
2052
+ APPEND_OPCODES.add(Op.GetComponentSelf, (vm, {
2053
+ op1: _state,
2054
+ op2: _names
2055
+ }) => {
2120
2056
  let instance = check(vm.fetchValue(_state), CheckComponentInstance);
2121
2057
  let {
2122
2058
  definition,
@@ -2186,10 +2122,9 @@ APPEND_OPCODES.add(Op.GetComponentSelf, (vm, _ref11) => {
2186
2122
  }
2187
2123
  vm.stack.push(selfRef);
2188
2124
  });
2189
- APPEND_OPCODES.add(Op.GetComponentTagName, (vm, _ref12) => {
2190
- let {
2191
- op1: _state
2192
- } = _ref12;
2125
+ APPEND_OPCODES.add(Op.GetComponentTagName, (vm, {
2126
+ op1: _state
2127
+ }) => {
2193
2128
  let {
2194
2129
  definition,
2195
2130
  state
@@ -2204,10 +2139,9 @@ APPEND_OPCODES.add(Op.GetComponentTagName, (vm, _ref12) => {
2204
2139
  });
2205
2140
 
2206
2141
  // Dynamic Invocation Only
2207
- APPEND_OPCODES.add(Op.GetComponentLayout, (vm, _ref13) => {
2208
- let {
2209
- op1: _state
2210
- } = _ref13;
2142
+ APPEND_OPCODES.add(Op.GetComponentLayout, (vm, {
2143
+ op1: _state
2144
+ }) => {
2211
2145
  let instance = check(vm.fetchValue(_state), CheckComponentInstance);
2212
2146
  let {
2213
2147
  manager,
@@ -2237,10 +2171,9 @@ APPEND_OPCODES.add(Op.GetComponentLayout, (vm, _ref13) => {
2237
2171
  stack.push(compilable.symbolTable);
2238
2172
  stack.push(handle);
2239
2173
  });
2240
- APPEND_OPCODES.add(Op.Main, (vm, _ref14) => {
2241
- let {
2242
- op1: register
2243
- } = _ref14;
2174
+ APPEND_OPCODES.add(Op.Main, (vm, {
2175
+ op1: register
2176
+ }) => {
2244
2177
  let definition = check(vm.stack.pop(), CheckComponentDefinition);
2245
2178
  let invocation = check(vm.stack.pop(), CheckInvocation);
2246
2179
  let {
@@ -2258,10 +2191,9 @@ APPEND_OPCODES.add(Op.Main, (vm, _ref14) => {
2258
2191
  };
2259
2192
  vm.loadValue(register, state);
2260
2193
  });
2261
- APPEND_OPCODES.add(Op.PopulateLayout, (vm, _ref15) => {
2262
- let {
2263
- op1: _state
2264
- } = _ref15;
2194
+ APPEND_OPCODES.add(Op.PopulateLayout, (vm, {
2195
+ op1: _state
2196
+ }) => {
2265
2197
  let {
2266
2198
  stack
2267
2199
  } = vm;
@@ -2273,10 +2205,9 @@ APPEND_OPCODES.add(Op.PopulateLayout, (vm, _ref15) => {
2273
2205
  state.handle = handle;
2274
2206
  state.table = table;
2275
2207
  });
2276
- APPEND_OPCODES.add(Op.VirtualRootScope, (vm, _ref16) => {
2277
- let {
2278
- op1: _state
2279
- } = _ref16;
2208
+ APPEND_OPCODES.add(Op.VirtualRootScope, (vm, {
2209
+ op1: _state
2210
+ }) => {
2280
2211
  let {
2281
2212
  table,
2282
2213
  manager,
@@ -2303,20 +2234,18 @@ APPEND_OPCODES.add(Op.VirtualRootScope, (vm, _ref16) => {
2303
2234
  }
2304
2235
  vm.pushRootScope(table.symbols.length + 1, owner);
2305
2236
  });
2306
- APPEND_OPCODES.add(Op.SetupForEval, (vm, _ref17) => {
2307
- let {
2308
- op1: _state
2309
- } = _ref17;
2237
+ APPEND_OPCODES.add(Op.SetupForEval, (vm, {
2238
+ op1: _state
2239
+ }) => {
2310
2240
  let state = check(vm.fetchValue(_state), CheckFinishedComponentInstance);
2311
2241
  if (state.table.hasEval) {
2312
2242
  let lookup = state.lookup = dict();
2313
2243
  vm.scope().bindEvalScope(lookup);
2314
2244
  }
2315
2245
  });
2316
- APPEND_OPCODES.add(Op.SetNamedVariables, (vm, _ref18) => {
2317
- let {
2318
- op1: _state
2319
- } = _ref18;
2246
+ APPEND_OPCODES.add(Op.SetNamedVariables, (vm, {
2247
+ op1: _state
2248
+ }) => {
2320
2249
  let state = check(vm.fetchValue(_state), CheckFinishedComponentInstance);
2321
2250
  let scope = vm.scope();
2322
2251
  let args = check(vm.stack.peek(), CheckArguments);
@@ -2335,10 +2264,9 @@ function bindBlock(symbolName, blockName, state, blocks, vm) {
2335
2264
  if (symbol !== -1) vm.scope().bindBlock(symbol + 1, block);
2336
2265
  if (state.lookup) state.lookup[symbolName] = block;
2337
2266
  }
2338
- APPEND_OPCODES.add(Op.SetBlocks, (vm, _ref19) => {
2339
- let {
2340
- op1: _state
2341
- } = _ref19;
2267
+ APPEND_OPCODES.add(Op.SetBlocks, (vm, {
2268
+ op1: _state
2269
+ }) => {
2342
2270
  let state = check(vm.fetchValue(_state), CheckFinishedComponentInstance);
2343
2271
  let {
2344
2272
  blocks
@@ -2349,17 +2277,15 @@ APPEND_OPCODES.add(Op.SetBlocks, (vm, _ref19) => {
2349
2277
  });
2350
2278
 
2351
2279
  // Dynamic Invocation Only
2352
- APPEND_OPCODES.add(Op.InvokeComponentLayout, (vm, _ref20) => {
2353
- let {
2354
- op1: _state
2355
- } = _ref20;
2280
+ APPEND_OPCODES.add(Op.InvokeComponentLayout, (vm, {
2281
+ op1: _state
2282
+ }) => {
2356
2283
  let state = check(vm.fetchValue(_state), CheckFinishedComponentInstance);
2357
2284
  vm.call(state.handle);
2358
2285
  });
2359
- APPEND_OPCODES.add(Op.DidRenderLayout, (vm, _ref21) => {
2360
- let {
2361
- op1: _state
2362
- } = _ref21;
2286
+ APPEND_OPCODES.add(Op.DidRenderLayout, (vm, {
2287
+ op1: _state
2288
+ }) => {
2363
2289
  let instance = check(vm.fetchValue(_state), CheckComponentInstance);
2364
2290
  let {
2365
2291
  manager,
@@ -2726,8 +2652,7 @@ class NamedArgumentsImpl {
2726
2652
  has(name) {
2727
2653
  return this.names.indexOf(name) !== -1;
2728
2654
  }
2729
- get(name) {
2730
- let atNames = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
2655
+ get(name, atNames = false) {
2731
2656
  let {
2732
2657
  base,
2733
2658
  stack
@@ -2918,11 +2843,11 @@ const EMPTY_ARGS = createCapturedArgs(EMPTY_NAMED, EMPTY_POSITIONAL);
2918
2843
 
2919
2844
  function createConcatRef(partsRefs) {
2920
2845
  return createComputeRef(() => {
2921
- let parts = new Array();
2922
- for (const [i, ref] of enumerate(partsRefs)) {
2923
- let value = valueForRef(ref);
2846
+ const parts = [];
2847
+ for (const ref of partsRefs) {
2848
+ const value = valueForRef(ref);
2924
2849
  if (value !== null && value !== undefined) {
2925
- parts[i] = castToString(value);
2850
+ parts.push(castToString(value));
2926
2851
  }
2927
2852
  }
2928
2853
  if (parts.length > 0) {
@@ -2932,17 +2857,18 @@ function createConcatRef(partsRefs) {
2932
2857
  });
2933
2858
  }
2934
2859
  function castToString(value) {
2935
- if (typeof value.toString !== 'function') {
2860
+ if (typeof value === 'string') {
2861
+ return value;
2862
+ } else if (typeof value.toString !== 'function') {
2936
2863
  return '';
2937
2864
  }
2938
2865
  return String(value);
2939
2866
  }
2940
2867
 
2941
- APPEND_OPCODES.add(Op.Curry, (vm, _ref) => {
2942
- let {
2943
- op1: type,
2944
- op2: _isStrict
2945
- } = _ref;
2868
+ APPEND_OPCODES.add(Op.Curry, (vm, {
2869
+ op1: type,
2870
+ op2: _isStrict
2871
+ }) => {
2946
2872
  let stack = vm.stack;
2947
2873
  let definition = check(stack.pop(), CheckReference);
2948
2874
  let capturedArgs = check(stack.pop(), CheckCapturedArguments);
@@ -2973,7 +2899,7 @@ APPEND_OPCODES.add(Op.DynamicHelper, vm => {
2973
2899
  positional,
2974
2900
  named
2975
2901
  } = resolveCurriedValue(definition);
2976
- let helper = resolveHelper(vm[CONSTANTS], resolvedDef, ref);
2902
+ let helper = resolveHelper(resolvedDef, ref);
2977
2903
  if (named !== undefined) {
2978
2904
  args.named = assign({}, ...named, args.named);
2979
2905
  }
@@ -2983,7 +2909,7 @@ APPEND_OPCODES.add(Op.DynamicHelper, vm => {
2983
2909
  helperRef = helper(args, owner);
2984
2910
  associateDestroyableChild(helperInstanceRef, helperRef);
2985
2911
  } else if (isObject(definition)) {
2986
- let helper = resolveHelper(vm[CONSTANTS], definition, ref);
2912
+ let helper = resolveHelper(definition, ref);
2987
2913
  helperRef = helper(args, initialOwner);
2988
2914
  if (_hasDestroyableChildren(helperRef)) {
2989
2915
  associateDestroyableChild(helperInstanceRef, helperRef);
@@ -2999,17 +2925,23 @@ APPEND_OPCODES.add(Op.DynamicHelper, vm => {
2999
2925
  vm.associateDestroyable(helperInstanceRef);
3000
2926
  vm.loadValue($v0, helperValueRef);
3001
2927
  });
3002
- function resolveHelper(constants, definition, ref) {
3003
- let handle = constants.helper(definition, null, true);
3004
- if (DEBUG && handle === null) {
2928
+ function resolveHelper(definition, ref) {
2929
+ let managerOrHelper = getInternalHelperManager(definition, true);
2930
+ let helper;
2931
+ if (managerOrHelper === null) {
2932
+ helper = null;
2933
+ } else {
2934
+ helper = typeof managerOrHelper === 'function' ? managerOrHelper : managerOrHelper.getHelper(definition);
2935
+ assert(managerOrHelper, 'BUG: expected manager or helper');
2936
+ }
2937
+ if (DEBUG && helper === null) {
3005
2938
  throw new Error(`Expected a dynamic helper definition, but received an object or function that did not have a helper manager associated with it. The dynamic invocation was \`{{${ref.debugLabel}}}\` or \`(${ref.debugLabel})\`, and the incorrect definition is the value at the path \`${ref.debugLabel}\`, which was: ${debugToString(definition)}`);
3006
2939
  }
3007
- return constants.getValue(handle);
2940
+ return helper;
3008
2941
  }
3009
- APPEND_OPCODES.add(Op.Helper, (vm, _ref2) => {
3010
- let {
3011
- op1: handle
3012
- } = _ref2;
2942
+ APPEND_OPCODES.add(Op.Helper, (vm, {
2943
+ op1: handle
2944
+ }) => {
3013
2945
  let stack = vm.stack;
3014
2946
  let helper = check(vm[CONSTANTS].getValue(handle), CheckHelper);
3015
2947
  let args = check(stack.pop(), CheckArguments);
@@ -3019,33 +2951,29 @@ APPEND_OPCODES.add(Op.Helper, (vm, _ref2) => {
3019
2951
  }
3020
2952
  vm.loadValue($v0, value);
3021
2953
  });
3022
- APPEND_OPCODES.add(Op.GetVariable, (vm, _ref3) => {
3023
- let {
3024
- op1: symbol
3025
- } = _ref3;
2954
+ APPEND_OPCODES.add(Op.GetVariable, (vm, {
2955
+ op1: symbol
2956
+ }) => {
3026
2957
  let expr = vm.referenceForSymbol(symbol);
3027
2958
  vm.stack.push(expr);
3028
2959
  });
3029
- APPEND_OPCODES.add(Op.SetVariable, (vm, _ref4) => {
3030
- let {
3031
- op1: symbol
3032
- } = _ref4;
2960
+ APPEND_OPCODES.add(Op.SetVariable, (vm, {
2961
+ op1: symbol
2962
+ }) => {
3033
2963
  let expr = check(vm.stack.pop(), CheckReference);
3034
2964
  vm.scope().bindSymbol(symbol, expr);
3035
2965
  });
3036
- APPEND_OPCODES.add(Op.SetBlock, (vm, _ref5) => {
3037
- let {
3038
- op1: symbol
3039
- } = _ref5;
2966
+ APPEND_OPCODES.add(Op.SetBlock, (vm, {
2967
+ op1: symbol
2968
+ }) => {
3040
2969
  let handle = check(vm.stack.pop(), CheckCompilableBlock);
3041
2970
  let scope = check(vm.stack.pop(), CheckScope);
3042
2971
  let table = check(vm.stack.pop(), CheckBlockSymbolTable);
3043
2972
  vm.scope().bindBlock(symbol, [handle, scope, table]);
3044
2973
  });
3045
- APPEND_OPCODES.add(Op.ResolveMaybeLocal, (vm, _ref6) => {
3046
- let {
3047
- op1: _name
3048
- } = _ref6;
2974
+ APPEND_OPCODES.add(Op.ResolveMaybeLocal, (vm, {
2975
+ op1: _name
2976
+ }) => {
3049
2977
  let name = vm[CONSTANTS].getValue(_name);
3050
2978
  let locals = vm.scope().getPartialMap();
3051
2979
  let ref = locals[name];
@@ -3054,24 +2982,21 @@ APPEND_OPCODES.add(Op.ResolveMaybeLocal, (vm, _ref6) => {
3054
2982
  }
3055
2983
  vm.stack.push(ref);
3056
2984
  });
3057
- APPEND_OPCODES.add(Op.RootScope, (vm, _ref7) => {
3058
- let {
3059
- op1: symbols
3060
- } = _ref7;
2985
+ APPEND_OPCODES.add(Op.RootScope, (vm, {
2986
+ op1: symbols
2987
+ }) => {
3061
2988
  vm.pushRootScope(symbols, vm.getOwner());
3062
2989
  });
3063
- APPEND_OPCODES.add(Op.GetProperty, (vm, _ref8) => {
3064
- let {
3065
- op1: _key
3066
- } = _ref8;
2990
+ APPEND_OPCODES.add(Op.GetProperty, (vm, {
2991
+ op1: _key
2992
+ }) => {
3067
2993
  let key = vm[CONSTANTS].getValue(_key);
3068
2994
  let expr = check(vm.stack.pop(), CheckReference);
3069
2995
  vm.stack.push(childRefFor(expr, key));
3070
2996
  });
3071
- APPEND_OPCODES.add(Op.GetBlock, (vm, _ref9) => {
3072
- let {
3073
- op1: _block
3074
- } = _ref9;
2997
+ APPEND_OPCODES.add(Op.GetBlock, (vm, {
2998
+ op1: _block
2999
+ }) => {
3075
3000
  let {
3076
3001
  stack
3077
3002
  } = vm;
@@ -3119,10 +3044,9 @@ APPEND_OPCODES.add(Op.HasBlockParams, vm => {
3119
3044
  let hasBlockParams = table && table.parameters.length;
3120
3045
  vm.stack.push(hasBlockParams ? TRUE_REFERENCE : FALSE_REFERENCE);
3121
3046
  });
3122
- APPEND_OPCODES.add(Op.Concat, (vm, _ref10) => {
3123
- let {
3124
- op1: count
3125
- } = _ref10;
3047
+ APPEND_OPCODES.add(Op.Concat, (vm, {
3048
+ op1: count
3049
+ }) => {
3126
3050
  let out = new Array(count);
3127
3051
  for (let i = count; i > 0; i--) {
3128
3052
  let offset = i - 1;
@@ -3321,22 +3245,20 @@ class ScopeInspector {
3321
3245
  return tail.reduce((r, part) => childRefFor(r, part), ref);
3322
3246
  }
3323
3247
  }
3324
- APPEND_OPCODES.add(Op.Debugger, (vm, _ref) => {
3325
- let {
3326
- op1: _symbols,
3327
- op2: _debugInfo
3328
- } = _ref;
3248
+ APPEND_OPCODES.add(Op.Debugger, (vm, {
3249
+ op1: _symbols,
3250
+ op2: _debugInfo
3251
+ }) => {
3329
3252
  let symbols = vm[CONSTANTS].getArray(_symbols);
3330
3253
  let debugInfo = vm[CONSTANTS].getArray(decodeHandle(_debugInfo));
3331
3254
  let inspector = new ScopeInspector(vm.scope(), symbols, debugInfo);
3332
3255
  callback(valueForRef(vm.getSelf()), path => valueForRef(inspector.get(path)));
3333
3256
  });
3334
3257
 
3335
- APPEND_OPCODES.add(Op.EnterList, (vm, _ref) => {
3336
- let {
3337
- op1: relativeStart,
3338
- op2: elseTarget
3339
- } = _ref;
3258
+ APPEND_OPCODES.add(Op.EnterList, (vm, {
3259
+ op1: relativeStart,
3260
+ op2: elseTarget
3261
+ }) => {
3340
3262
  let stack = vm.stack;
3341
3263
  let listRef = check(stack.pop(), CheckReference);
3342
3264
  let keyRef = check(stack.pop(), CheckReference);
@@ -3356,10 +3278,9 @@ APPEND_OPCODES.add(Op.EnterList, (vm, _ref) => {
3356
3278
  APPEND_OPCODES.add(Op.ExitList, vm => {
3357
3279
  vm.exitList();
3358
3280
  });
3359
- APPEND_OPCODES.add(Op.Iterate, (vm, _ref2) => {
3360
- let {
3361
- op1: breaks
3362
- } = _ref2;
3281
+ APPEND_OPCODES.add(Op.Iterate, (vm, {
3282
+ op1: breaks
3283
+ }) => {
3363
3284
  let stack = vm.stack;
3364
3285
  let iterator = check(stack.peek(), CheckIterator);
3365
3286
  let item = iterator.next();
@@ -3389,10 +3310,9 @@ class TemplateOnlyComponentManager {
3389
3310
  getCapabilities() {
3390
3311
  return CAPABILITIES;
3391
3312
  }
3392
- getDebugName(_ref) {
3393
- let {
3394
- name
3395
- } = _ref;
3313
+ getDebugName({
3314
+ name
3315
+ }) {
3396
3316
  return name;
3397
3317
  }
3398
3318
  getSelf() {
@@ -3406,9 +3326,7 @@ const TEMPLATE_ONLY_COMPONENT_MANAGER = new TemplateOnlyComponentManager();
3406
3326
 
3407
3327
  // This is only exported for types, don't use this class directly
3408
3328
  class TemplateOnlyComponentDefinition {
3409
- constructor() {
3410
- let moduleName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '@glimmer/component/template-only';
3411
- let name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '(unknown template-only component)';
3329
+ constructor(moduleName = '@glimmer/component/template-only', name = '(unknown template-only component)') {
3412
3330
  this.moduleName = moduleName;
3413
3331
  this.name = name;
3414
3332
  }
@@ -3679,8 +3597,7 @@ class TreeConstruction extends DOMOperations {
3679
3597
  createElementNS(namespace, tag) {
3680
3598
  return this.document.createElementNS(namespace, tag);
3681
3599
  }
3682
- setAttribute(element, name, value) {
3683
- let namespace = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
3600
+ setAttribute(element, name, value, namespace = null) {
3684
3601
  if (namespace) {
3685
3602
  element.setAttributeNS(namespace, name, value);
3686
3603
  } else {
@@ -3869,10 +3786,9 @@ class DebugRenderTreeImpl {
3869
3786
  children
3870
3787
  };
3871
3788
  }
3872
- captureTemplate(_ref) {
3873
- let {
3874
- template
3875
- } = _ref;
3789
+ captureTemplate({
3790
+ template
3791
+ }) {
3876
3792
  return template || null;
3877
3793
  }
3878
3794
  captureBounds(node) {
@@ -4072,10 +3988,9 @@ function internalHelper(helper) {
4072
3988
  @public
4073
3989
  */
4074
3990
 
4075
- const array = internalHelper(_ref => {
4076
- let {
4077
- positional
4078
- } = _ref;
3991
+ const array = internalHelper(({
3992
+ positional
3993
+ }) => {
4079
3994
  return createComputeRef(() => reifyPositional(positional), null, 'array');
4080
3995
  });
4081
3996
 
@@ -4109,10 +4024,9 @@ const normalizeTextValue = value => {
4109
4024
  @public
4110
4025
  @method concat
4111
4026
  */
4112
- const concat = internalHelper(_ref => {
4113
- let {
4114
- positional
4115
- } = _ref;
4027
+ const concat = internalHelper(({
4028
+ positional
4029
+ }) => {
4116
4030
  return createComputeRef(() => reifyPositional(positional).map(normalizeTextValue).join(''), null, 'concat');
4117
4031
  });
4118
4032
 
@@ -4182,18 +4096,14 @@ const context = buildUntouchableThis('`fn` helper');
4182
4096
  @method fn
4183
4097
  @public
4184
4098
  */
4185
- const fn = internalHelper(_ref => {
4186
- let {
4187
- positional
4188
- } = _ref;
4099
+ const fn = internalHelper(({
4100
+ positional
4101
+ }) => {
4189
4102
  let callbackRef = check(positional[0], assertCallbackIsFn);
4190
4103
  return createComputeRef(() => {
4191
- return function () {
4104
+ return (...invocationArgs) => {
4192
4105
  let [fn, ...args] = reifyPositional(positional);
4193
4106
  if (DEBUG) assertCallbackIsFn(callbackRef);
4194
- for (var _len = arguments.length, invocationArgs = new Array(_len), _key = 0; _key < _len; _key++) {
4195
- invocationArgs[_key] = arguments[_key];
4196
- }
4197
4107
  if (isInvokableRef(callbackRef)) {
4198
4108
  let value = args.length > 0 ? args[0] : invocationArgs[0];
4199
4109
  return updateRef(callbackRef, value);
@@ -4286,10 +4196,9 @@ function assertCallbackIsFn(callbackRef) {
4286
4196
  @public
4287
4197
  @method get
4288
4198
  */
4289
- const get = internalHelper(_ref => {
4290
- let {
4291
- positional
4292
- } = _ref;
4199
+ const get = internalHelper(({
4200
+ positional
4201
+ }) => {
4293
4202
  let sourceRef = positional[0] ?? UNDEFINED_REFERENCE;
4294
4203
  let pathRef = positional[1] ?? UNDEFINED_REFERENCE;
4295
4204
  return createComputeRef(() => {
@@ -4356,10 +4265,9 @@ if (DEBUG) {
4356
4265
  @return {Object} Hash
4357
4266
  @public
4358
4267
  */
4359
- const hash = internalHelper(_ref => {
4360
- let {
4361
- named
4362
- } = _ref;
4268
+ const hash = internalHelper(({
4269
+ named
4270
+ }) => {
4363
4271
  let ref = createComputeRef(() => {
4364
4272
  let hash = reifyNamed(named);
4365
4273
  if (DEBUG) {
@@ -4384,8 +4292,7 @@ function getArgs(proxy) {
4384
4292
  }
4385
4293
  class SimpleArgsProxy {
4386
4294
  argsCache;
4387
- constructor(context) {
4388
- let computeArgs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : () => EMPTY_ARGS;
4295
+ constructor(context, computeArgs = () => EMPTY_ARGS) {
4389
4296
  let argsCache = createCache(() => computeArgs(context));
4390
4297
  if (DEBUG) {
4391
4298
  ARGS_CACHES.set(this, argsCache);
@@ -4441,40 +4348,6 @@ function invokeHelper(context, definition, computeArgs) {
4441
4348
  }
4442
4349
 
4443
4350
  const untouchableContext = buildUntouchableThis('`on` modifier');
4444
-
4445
- /*
4446
- Internet Explorer 11 does not support `once` and also does not support
4447
- passing `eventOptions`. In some situations it then throws a weird script
4448
- error, like:
4449
-
4450
- ```
4451
- Could not complete the operation due to error 80020101
4452
- ```
4453
-
4454
- This flag determines, whether `{ once: true }` and thus also event options in
4455
- general are supported.
4456
- */
4457
- const SUPPORTS_EVENT_OPTIONS = (() => {
4458
- try {
4459
- const div = document.createElement('div');
4460
- let counter = 0;
4461
- div.addEventListener('click', () => counter++, {
4462
- once: true
4463
- });
4464
- let event;
4465
- if (typeof Event === 'function') {
4466
- event = new Event('click');
4467
- } else {
4468
- event = document.createEvent('Event');
4469
- event.initEvent('click', true, true);
4470
- }
4471
- div.dispatchEvent(event);
4472
- div.dispatchEvent(event);
4473
- return counter === 1;
4474
- } catch (error) {
4475
- return false;
4476
- }
4477
- })();
4478
4351
  class OnModifierState {
4479
4352
  tag = createUpdatableTag();
4480
4353
  element;
@@ -4509,11 +4382,11 @@ class OnModifierState {
4509
4382
  this.capture = capture;
4510
4383
  this.shouldUpdate = true;
4511
4384
  }
4512
- let options;
4385
+
4513
4386
  // we want to handle both `true` and `false` because both have a meaning:
4514
4387
  // https://bugs.chromium.org/p/chromium/issues/detail?id=770208
4515
4388
  if (once !== undefined || passive !== undefined || capture !== undefined) {
4516
- options = this.options = {
4389
+ this.options = {
4517
4390
  once,
4518
4391
  passive,
4519
4392
  capture
@@ -4538,19 +4411,16 @@ class OnModifierState {
4538
4411
  if (DEBUG && args.positional.length !== 2) {
4539
4412
  throw new Error(`You can only pass two positional arguments (event name and callback) to the \`on\` modifier, but you provided ${args.positional.length}. Consider using the \`fn\` helper to provide additional arguments to the \`on\` callback.`);
4540
4413
  }
4541
- let needsCustomCallback = SUPPORTS_EVENT_OPTIONS === false && once /* needs manual once implementation */ || DEBUG && passive; /* needs passive enforcement */
4414
+ let needsCustomCallback = DEBUG && passive; /* needs passive enforcement */
4542
4415
 
4543
4416
  if (this.shouldUpdate) {
4544
4417
  if (needsCustomCallback) {
4545
- let callback = this.callback = function (event) {
4418
+ this.callback = function (event) {
4546
4419
  if (DEBUG && passive) {
4547
4420
  event.preventDefault = () => {
4548
4421
  throw new Error(`You marked this listener as 'passive', meaning that you must not call 'event.preventDefault()': \n\n${userProvidedCallback.name ?? `{anonymous function}`}`);
4549
4422
  };
4550
4423
  }
4551
- if (!SUPPORTS_EVENT_OPTIONS && once) {
4552
- removeEventListener(this, eventName, callback, options);
4553
- }
4554
4424
  return userProvidedCallback.call(untouchableContext, event);
4555
4425
  };
4556
4426
  } else if (DEBUG) {
@@ -4566,45 +4436,11 @@ let adds = 0;
4566
4436
  let removes = 0;
4567
4437
  function removeEventListener(element, eventName, callback, options) {
4568
4438
  removes++;
4569
- if (SUPPORTS_EVENT_OPTIONS) {
4570
- // when options are supported, use them across the board
4571
- element.removeEventListener(eventName, callback, options);
4572
- } else if (options !== undefined && options.capture) {
4573
- // used only in the following case:
4574
- //
4575
- // `{ once: true | false, passive: true | false, capture: true }
4576
- //
4577
- // `once` is handled via a custom callback that removes after first
4578
- // invocation so we only care about capture here as a boolean
4579
- element.removeEventListener(eventName, callback, true);
4580
- } else {
4581
- // used only in the following cases:
4582
- //
4583
- // * where there is no options
4584
- // * `{ once: true | false, passive: true | false, capture: false }
4585
- element.removeEventListener(eventName, callback);
4586
- }
4439
+ element.removeEventListener(eventName, callback, options);
4587
4440
  }
4588
4441
  function addEventListener(element, eventName, callback, options) {
4589
4442
  adds++;
4590
- if (SUPPORTS_EVENT_OPTIONS) {
4591
- // when options are supported, use them across the board
4592
- element.addEventListener(eventName, callback, options);
4593
- } else if (options !== undefined && options.capture) {
4594
- // used only in the following case:
4595
- //
4596
- // `{ once: true | false, passive: true | false, capture: true }
4597
- //
4598
- // `once` is handled via a custom callback that removes after first
4599
- // invocation so we only care about capture here as a boolean
4600
- element.addEventListener(eventName, callback, true);
4601
- } else {
4602
- // used only in the following cases:
4603
- //
4604
- // * where there is no options
4605
- // * `{ once: true | false, passive: true | false, capture: false }
4606
- element.addEventListener(eventName, callback);
4607
- }
4443
+ element.addEventListener(eventName, callback, options);
4608
4444
  }
4609
4445
 
4610
4446
  /**
@@ -4694,7 +4530,6 @@ function addEventListener(element, eventName, callback, options) {
4694
4530
  @public
4695
4531
  */
4696
4532
  class OnModifierManager {
4697
- SUPPORTS_EVENT_OPTIONS = SUPPORTS_EVENT_OPTIONS;
4698
4533
  getDebugName() {
4699
4534
  return 'on';
4700
4535
  }
@@ -4886,10 +4721,9 @@ class UpdatingVM {
4886
4721
  dom;
4887
4722
  alwaysRevalidate;
4888
4723
  frameStack = new Stack();
4889
- constructor(env, _ref) {
4890
- let {
4891
- alwaysRevalidate = false
4892
- } = _ref;
4724
+ constructor(env, {
4725
+ alwaysRevalidate = false
4726
+ }) {
4893
4727
  this.env = env;
4894
4728
  this.dom = env.getDOM();
4895
4729
  this.alwaysRevalidate = alwaysRevalidate;
@@ -5220,12 +5054,11 @@ class RenderResultImpl {
5220
5054
  associateDestroyableChild(this, drop);
5221
5055
  registerDestructor(this, () => clear(this.bounds));
5222
5056
  }
5223
- rerender() {
5224
- let {
5225
- alwaysRevalidate = false
5226
- } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
5227
- alwaysRevalidate: false
5228
- };
5057
+ rerender({
5058
+ alwaysRevalidate = false
5059
+ } = {
5060
+ alwaysRevalidate: false
5061
+ }) {
5229
5062
  let {
5230
5063
  env,
5231
5064
  updating
@@ -5256,38 +5089,31 @@ class EvaluationStackImpl {
5256
5089
  [REGISTERS];
5257
5090
 
5258
5091
  // fp -> sp
5259
- constructor() {
5260
- let stack = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
5261
- let registers = arguments.length > 1 ? arguments[1] : undefined;
5092
+ constructor(stack = [], registers) {
5262
5093
  this.stack = stack;
5263
5094
  this[REGISTERS] = registers;
5264
5095
  }
5265
5096
  push(value) {
5266
5097
  this.stack[++this[REGISTERS][$sp]] = value;
5267
5098
  }
5268
- dup() {
5269
- let position = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this[REGISTERS][$sp];
5099
+ dup(position = this[REGISTERS][$sp]) {
5270
5100
  this.stack[++this[REGISTERS][$sp]] = this.stack[position];
5271
5101
  }
5272
5102
  copy(from, to) {
5273
5103
  this.stack[to] = this.stack[from];
5274
5104
  }
5275
- pop() {
5276
- let n = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
5105
+ pop(n = 1) {
5277
5106
  let top = this.stack[this[REGISTERS][$sp]];
5278
5107
  this[REGISTERS][$sp] -= n;
5279
5108
  return top;
5280
5109
  }
5281
- peek() {
5282
- let offset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
5110
+ peek(offset = 0) {
5283
5111
  return this.stack[this[REGISTERS][$sp] - offset];
5284
5112
  }
5285
- get(offset) {
5286
- let base = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this[REGISTERS][$fp];
5113
+ get(offset, base = this[REGISTERS][$fp]) {
5287
5114
  return this.stack[base + offset];
5288
5115
  }
5289
- set(value, offset) {
5290
- let base = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this[REGISTERS][$fp];
5116
+ set(value, offset, base = this[REGISTERS][$fp]) {
5291
5117
  this.stack[base + offset] = value;
5292
5118
  }
5293
5119
  slice(start, end) {
@@ -5436,13 +5262,12 @@ class VM {
5436
5262
  * End of migrated.
5437
5263
  */
5438
5264
 
5439
- constructor(runtime, _ref, elementStack, context) {
5440
- let {
5441
- pc,
5442
- scope,
5443
- dynamicScope,
5444
- stack
5445
- } = _ref;
5265
+ constructor(runtime, {
5266
+ pc,
5267
+ scope,
5268
+ dynamicScope,
5269
+ stack
5270
+ }, elementStack, context) {
5446
5271
  this.runtime = runtime;
5447
5272
  this.elementStack = elementStack;
5448
5273
  this.context = context;
@@ -5472,28 +5297,26 @@ class VM {
5472
5297
  this.destructor = {};
5473
5298
  this[DESTROYABLE_STACK].push(this.destructor);
5474
5299
  }
5475
- static initial(runtime, context, _ref2) {
5476
- let {
5477
- handle,
5478
- self,
5479
- dynamicScope,
5480
- treeBuilder,
5481
- numSymbols,
5482
- owner
5483
- } = _ref2;
5300
+ static initial(runtime, context, {
5301
+ handle,
5302
+ self,
5303
+ dynamicScope,
5304
+ treeBuilder,
5305
+ numSymbols,
5306
+ owner
5307
+ }) {
5484
5308
  let scope = PartialScopeImpl.root(self, numSymbols, owner);
5485
5309
  let state = vmState(runtime.program.heap.getaddr(handle), scope, dynamicScope);
5486
5310
  let vm = initVM(context)(runtime, state, treeBuilder);
5487
5311
  vm.pushUpdating();
5488
5312
  return vm;
5489
5313
  }
5490
- static empty(runtime, _ref3, context) {
5491
- let {
5492
- handle,
5493
- treeBuilder,
5494
- dynamicScope,
5495
- owner
5496
- } = _ref3;
5314
+ static empty(runtime, {
5315
+ handle,
5316
+ treeBuilder,
5317
+ dynamicScope,
5318
+ owner
5319
+ }, context) {
5497
5320
  let vm = initVM(context)(runtime, vmState(runtime.program.heap.getaddr(handle), PartialScopeImpl.root(UNDEFINED_REFERENCE, 0, owner), dynamicScope), treeBuilder);
5498
5321
  vm.pushUpdating();
5499
5322
  return vm;
@@ -5509,8 +5332,7 @@ class VM {
5509
5332
  get env() {
5510
5333
  return this.runtime.env;
5511
5334
  }
5512
- captureState(args) {
5513
- let pc = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this[INNER_VM].fetchRegister($pc);
5335
+ captureState(args, pc = this[INNER_VM].fetchRegister($pc)) {
5514
5336
  return {
5515
5337
  pc,
5516
5338
  scope: this.scope(),
@@ -5518,8 +5340,7 @@ class VM {
5518
5340
  stack: this.stack.capture(args)
5519
5341
  };
5520
5342
  }
5521
- capture(args) {
5522
- let pc = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this[INNER_VM].fetchRegister($pc);
5343
+ capture(args, pc = this[INNER_VM].fetchRegister($pc)) {
5523
5344
  return new ResumableVMStateImpl(this.captureState(args, pc), this.resume);
5524
5345
  }
5525
5346
  beginCacheGroup(name) {
@@ -5544,12 +5365,11 @@ class VM {
5544
5365
  let tryOpcode = new TryOpcode(state, this.runtime, block, updating);
5545
5366
  this.didEnter(tryOpcode);
5546
5367
  }
5547
- enterItem(_ref4) {
5548
- let {
5549
- key,
5550
- value,
5551
- memo
5552
- } = _ref4;
5368
+ enterItem({
5369
+ key,
5370
+ value,
5371
+ memo
5372
+ }) {
5553
5373
  let {
5554
5374
  stack
5555
5375
  } = this;
@@ -5590,8 +5410,7 @@ class VM {
5590
5410
  this.exit();
5591
5411
  this[STACKS].list.pop();
5592
5412
  }
5593
- pushUpdating() {
5594
- let list = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
5413
+ pushUpdating(list = []) {
5595
5414
  this[STACKS].updating.push(list);
5596
5415
  }
5597
5416
  popUpdating() {
@@ -5754,8 +5573,7 @@ function renderSync(env, iterator) {
5754
5573
  inTransaction(env, () => result = iterator.sync());
5755
5574
  return result;
5756
5575
  }
5757
- function renderMain(runtime, context, owner, self, treeBuilder, layout) {
5758
- let dynamicScope = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : new DynamicScopeImpl();
5576
+ function renderMain(runtime, context, owner, self, treeBuilder, layout, dynamicScope = new DynamicScopeImpl()) {
5759
5577
  let handle = unwrapHandle(layout.compile(context));
5760
5578
  let numSymbols = layout.symbolTable.symbols.length;
5761
5579
  let vm = VM.initial(runtime, context, {
@@ -5774,10 +5592,7 @@ function renderInvocation(vm, context, owner, definition, args) {
5774
5592
  const argList = Object.keys(args).map(key => [key, args[key]]);
5775
5593
  const blockNames = ['main', 'else', 'attrs'];
5776
5594
  // Prefix argument names with `@` symbol
5777
- const argNames = argList.map(_ref => {
5778
- let [name] = _ref;
5779
- return `@${name}`;
5780
- });
5595
+ const argNames = argList.map(([name]) => `@${name}`);
5781
5596
  let reified = vm[CONSTANTS].component(definition, owner);
5782
5597
  vm.pushFrame();
5783
5598
 
@@ -5788,8 +5603,7 @@ function renderInvocation(vm, context, owner, definition, args) {
5788
5603
  vm.stack.push(null);
5789
5604
 
5790
5605
  // For each argument, push its backing reference on to the stack
5791
- argList.forEach(_ref2 => {
5792
- let [, reference] = _ref2;
5606
+ argList.forEach(([, reference]) => {
5793
5607
  vm.stack.push(reference);
5794
5608
  });
5795
5609
 
@@ -5809,9 +5623,7 @@ function renderInvocation(vm, context, owner, definition, args) {
5809
5623
  vm.stack.push(reified);
5810
5624
  return new TemplateIteratorImpl(vm);
5811
5625
  }
5812
- function renderComponent(runtime, treeBuilder, context, owner, definition) {
5813
- let args = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};
5814
- let dynamicScope = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : new DynamicScopeImpl();
5626
+ function renderComponent(runtime, treeBuilder, context, owner, definition, args = {}, dynamicScope = new DynamicScopeImpl()) {
5815
5627
  let vm = VM.empty(runtime, {
5816
5628
  treeBuilder,
5817
5629
  handle: context.stdlib.main,
@@ -5911,8 +5723,7 @@ class RehydrateBuilder extends NewElementBuilder {
5911
5723
  currentCursor.candidate = candidate;
5912
5724
  currentCursor.nextSibling = null;
5913
5725
  }
5914
- pushElement(element) {
5915
- let nextSibling = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
5726
+ pushElement(element, nextSibling = null) {
5916
5727
  const cursor = new RehydratingCursor(element, nextSibling, this.blockDepth || 0);
5917
5728
 
5918
5729
  /**