diff --git a/engine262.js b/engine262.js index 7cb23f6b..49f3f459 100644 --- a/engine262.js +++ b/engine262.js @@ -1,5 +1,5 @@ /* - * engine262 0.0.1 fe5c49d858df245fe760a37e8780cc3810a26d2a + * engine262 0.0.1 67bef1a3b2474a580e88199484fb860aa503fcb6 * * Copyright (c) 2018 engine262 Contributors * @@ -24248,7 +24248,7 @@ return surroundingAgent.Throw('TypeError', 'NotAFunction', adder); } - Assert(iterable && Type(iterable) !== 'Undefined' && Type(iterable) !== 'Null', "iterable && Type(iterable) !== 'Undefined' && Type(iterable) !== 'Null'"); + Assert(iterable !== undefined && iterable !== Value.undefined && iterable !== Value.null, "iterable !== undefined && iterable !== Value.undefined && iterable !== Value.null"); let _temp = GetIterator(iterable); /* istanbul ignore if */ @@ -24296,7 +24296,7 @@ const nextItem = _temp3; if (Type(nextItem) !== 'Object') { - const error = new ThrowCompletion(surroundingAgent.Throw('TypeError', 'NotAnObject', nextItem).Value); + const error = surroundingAgent.Throw('TypeError', 'NotAnObject', nextItem); return IteratorClose(iteratorRecord, error); } @@ -44058,6 +44058,444 @@ realmRec.Intrinsics['%DataView.prototype%'] = proto; } + function WeakMapProto_delete([key = Value.undefined], { + thisValue + }) { + // 1. Let M be the this value. + const M = thisValue; // 2. Perform ? RequireInternalSlot(M, [[WeakMapData]]). + + let _temp = RequireInternalSlot(M, 'WeakMapData'); + /* istanbul ignore if */ + + + if (_temp instanceof AbruptCompletion) { + return _temp; + } + /* istanbul ignore if */ + + + if (_temp instanceof Completion) { + _temp = _temp.Value; + } + + const entries = M.WeakMapData; // 4. If Type(key) is not Object, return false. + + if (Type(key) !== 'Object') { + return Value.false; + } // 5. For each Record { [[Key]], [[Value]] } p that is an element of entries, do + + + for (let i = 0; i < entries.length; i += 1) { + const p = entries[i]; // a. If p.[[Key]] is not empty and SameValue(p.[[Key]], key) is true, then + + if (p.Key !== undefined && SameValue(p.Key, key) === Value.true) { + // i. Set p.[[Key]] to empty. + p.Key = undefined; // ii. Set p.[[Value]] to empty. + + p.Value = undefined; // iii. return true. + + return Value.true; + } + } // 6. Return false. + + + return Value.false; + } + + function WeakMapProto_get([key = Value.undefined], { + thisValue + }) { + // 1. Let m be the this value. + const M = thisValue; // 2. Perform ? RequireInternalSlot(M, [[WeakMapData]]). + + let _temp2 = RequireInternalSlot(M, 'WeakMapData'); + + if (_temp2 instanceof AbruptCompletion) { + return _temp2; + } + + if (_temp2 instanceof Completion) { + _temp2 = _temp2.Value; + } + + const entries = M.WeakMapData; // 4. If Type(key) is not Object, return undefined. + + if (Type(key) !== 'Object') { + return Value.undefined; + } // 5. For each Record { [[Key]], [[Value]] } p that is an element of entries, do + + + for (const p of entries) { + // a. If p.[[Key]] is not empty and SameValue(p.[[Key]], key) is true, return p.[[Value]]. + if (p.Key !== undefined && SameValue(p.Key, key) === Value.true) { + return p.Value; + } + } // 6. Return undefined. + + + return Value.undefined; + } + + function WeakMapProto_has([key = Value.undefined], { + thisValue + }) { + // 1. Let M be the this value. + const M = thisValue; // 2. Perform ? RequireInternalSlot(M, [[WeakMapData]]). + + let _temp3 = RequireInternalSlot(M, 'WeakMapData'); + + if (_temp3 instanceof AbruptCompletion) { + return _temp3; + } + + if (_temp3 instanceof Completion) { + _temp3 = _temp3.Value; + } + + const entries = M.WeakMapData; // 4. If Type(key) is not Object, return false. + + if (Type(key) !== 'Object') { + return Value.false; + } // 5. For each Record { [[Key]], [[Value]] } p that is an element of entries, do + + + for (const p of entries) { + // a. If p.[[Key]] is not empty and SameValue(p.[[Key]], key) is true, return true. + if (p.Key !== undefined && SameValue(p.Key, key) === Value.true) { + return Value.true; + } + } // 6. Return false. + + + return Value.false; + } + + function WeakMapProto_set([key = Value.undefined, value = Value.undefined], { + thisValue + }) { + // 1. Let M be the this value. + const M = thisValue; // 2. Perform ? RequireInternalSlot(M, [[WeakMapData]]). + + let _temp4 = RequireInternalSlot(M, 'WeakMapData'); + + if (_temp4 instanceof AbruptCompletion) { + return _temp4; + } + + if (_temp4 instanceof Completion) { + _temp4 = _temp4.Value; + } + + const entries = M.WeakMapData; // 4. If Type(key) is not Object, throw a TypeError exception. + + if (Type(key) !== 'Object') { + return surroundingAgent.Throw('TypeError', 'WeakCollectionNotObject', key); + } // 5. For each Record { [[Key]], [[Value]] } p that is an element of entries, do + + + for (const p of entries) { + // a. If p.[[Key]] is not empty and SameValue(p.[[Key]], key) is true, then + if (p.Key !== undefined && SameValue(p.Key, key) === Value.true) { + // i. Set p.[[Value]] to value. + p.Value = value; // ii. Return M. + + return M; + } + } // 6. Let p be the Record { [[Key]]: key, [[Value]]: value }. + + + const p = { + Key: key, + Value: value + }; // 7. Append p as the last element of entries. + + entries.push(p); // 8. Return M. + + return M; + } + + function BootstrapWeakMapPrototype(realmRec) { + const proto = BootstrapPrototype(realmRec, [['delete', WeakMapProto_delete, 1], ['get', WeakMapProto_get, 1], ['has', WeakMapProto_has, 1], ['set', WeakMapProto_set, 2]], realmRec.Intrinsics['%Object.prototype%'], 'WeakMap'); + realmRec.Intrinsics['%WeakMap.prototype%'] = proto; + } + + function WeakMapConstructor([iterable = Value.undefined], { + NewTarget + }) { + // 1. If NewTarget is undefined, throw a TypeError exception. + if (NewTarget === Value.undefined) { + return surroundingAgent.Throw('TypeError', 'ConstructorRequiresNew', 'WeakMap'); + } // 2. Let map be ? OrdinaryCreateFromConstructor(NewTarget, "%WeakMap.prototype%", « [[WeakMapData]] »). + + + let _temp = OrdinaryCreateFromConstructor(NewTarget, '%WeakMap.prototype%', ['WeakMapData']); + /* istanbul ignore if */ + + + if (_temp instanceof AbruptCompletion) { + return _temp; + } + /* istanbul ignore if */ + + + if (_temp instanceof Completion) { + _temp = _temp.Value; + } + + const map = _temp; // 3. Set map.[[WeakMapData]] to a new empty List. + + map.WeakMapData = []; // 4. If iterable is either undefined or null, return map. + + if (iterable === Value.undefined || iterable === Value.null) { + return map; + } // 5. Let adder be ? Get(map, "set"). + + + let _temp2 = Get(map, new Value('set')); + + if (_temp2 instanceof AbruptCompletion) { + return _temp2; + } + + if (_temp2 instanceof Completion) { + _temp2 = _temp2.Value; + } + + const adder = _temp2; // 6. Return ? AddEntriesFromIterable(map, iterable, adder). + + return AddEntriesFromIterable(map, iterable, adder); + } + + function BootstrapWeakMap(realmRec) { + const c = BootstrapConstructor(realmRec, WeakMapConstructor, 'WeakMap', 0, realmRec.Intrinsics['%WeakMap.prototype%'], []); + realmRec.Intrinsics['%WeakMap%'] = c; + } + + function WeakSetProto_add([value = Value.undefined], { + thisValue + }) { + // 1. Let S be this value. + const S = thisValue; // 2. Perform ? RequireInternalSlot(S, [[WeakSetData]]). + + let _temp = RequireInternalSlot(S, 'WeakSetData'); + /* istanbul ignore if */ + + + if (_temp instanceof AbruptCompletion) { + return _temp; + } + /* istanbul ignore if */ + + + if (_temp instanceof Completion) { + _temp = _temp.Value; + } + + if (Type(value) !== 'Object') { + return surroundingAgent.Throw('TypeError', 'WeakCollectionNotObject', value); + } // 4. Let entries be the List that is S.[[WeakSetData]]. + + + const entries = S.WeakSetData; // 5. For each e that is an element of entries, do + + for (const e of entries) { + // a. If e is not empty and SameValue(e, value) is true, then + if (e !== undefined && SameValue(e, value) === Value.true) { + // i. Return S. + return S; + } + } // 6. Append value as the last element of entries. + + + entries.push(value); // 7. Return S. + + return S; + } // #sec-weakset.prototype.delete + + + function WeakSetProto_delete([value = Value.undefined], { + thisValue + }) { + // 1. Let S be the this value.` + const S = thisValue; // 2. Perform ? RequireInternalSlot(S, [[WeakSetData]]). + + let _temp2 = RequireInternalSlot(S, 'WeakSetData'); + + if (_temp2 instanceof AbruptCompletion) { + return _temp2; + } + + if (_temp2 instanceof Completion) { + _temp2 = _temp2.Value; + } + + if (Type(value) !== 'Object') { + return Value.false; + } // 4. Let entries be the List that is S.[[WeakSetData]]. + + + const entries = S.WeakSetData; // 5. For each e that is an element of entries, do + + for (let i = 0; i < entries.length; i += 1) { + const e = entries[i]; // i. If e is not empty and SameValue(e, value) is true, then + + if (e !== undefined && SameValue(e, value) === Value.true) { + // i. Replace the element of entries whose value is e with an element whose value is empty. + entries[i] = undefined; // ii. Return true. + + return Value.true; + } + } // 6. Return false. + + + return Value.false; + } // #sec-weakset.prototype.has + + + function WeakSetProto_has([value = Value.undefined], { + thisValue + }) { + // 1. Let S be the this value. + const S = thisValue; // 2. Perform ? RequireInternalSlot(S, [[WeakSetData]]). + + let _temp3 = RequireInternalSlot(S, 'WeakSetData'); + + if (_temp3 instanceof AbruptCompletion) { + return _temp3; + } + + if (_temp3 instanceof Completion) { + _temp3 = _temp3.Value; + } + + const entries = S.WeakSetData; // 4. If Type(value) is not Object, return false. + + if (Type(value) !== 'Object') { + return Value.false; + } // 5. For each e that is an element of entries, do + + + for (const e of entries) { + // a. If e is not empty and SameValue(e, value) is true, return true. + if (e !== undefined && SameValue(e, value) === Value.true) { + return Value.true; + } + } // 6. Return false. + + + return Value.false; + } + + function BootstrapWeakSetPrototype(realmRec) { + const proto = BootstrapPrototype(realmRec, [['add', WeakSetProto_add, 1], ['delete', WeakSetProto_delete, 1], ['has', WeakSetProto_has, 1]], realmRec.Intrinsics['%Object.prototype%'], 'WeakSet'); + realmRec.Intrinsics['%WeakSet.prototype%'] = proto; + } + + function WeakSetConstructor([iterable = Value.undefined], { + NewTarget + }) { + // 1. If NewTarget is undefined, throw a TypeError exception. + if (NewTarget === Value.undefined) { + return surroundingAgent.Throw('TypeError', 'ConstructorRequiresNew', 'WeakSet'); + } // 2. Let set be ? OrdinaryCreateFromConstructor(NewTarget, "%WeakSet.prototype%", « [[WeakSetData]] »). + + + let _temp = OrdinaryCreateFromConstructor(NewTarget, '%WeakSet.prototype%', ['WeakSetData']); + /* istanbul ignore if */ + + + if (_temp instanceof AbruptCompletion) { + return _temp; + } + /* istanbul ignore if */ + + + if (_temp instanceof Completion) { + _temp = _temp.Value; + } + + const set = _temp; // 3. Set set.[[WeakSetData]] to a new empty List. + + set.WeakSetData = []; // 4. If iterable is either undefined or null, return set. + + if (iterable === Value.undefined || iterable === Value.null) { + return set; + } // 5. Let adder be ? Get(set, "add"). + + + let _temp2 = Get(set, new Value('add')); + + if (_temp2 instanceof AbruptCompletion) { + return _temp2; + } + + if (_temp2 instanceof Completion) { + _temp2 = _temp2.Value; + } + + const adder = _temp2; // 6. If IsCallable(adder) is false, throw a TypeError exception. + + if (IsCallable(adder) === Value.false) { + return surroundingAgent.Throw('TypeError', 'NotAFunction', adder); + } // 7. Let iteratorRecord be ? GetIterator(iterable). + + + let _temp3 = GetIterator(iterable); + + if (_temp3 instanceof AbruptCompletion) { + return _temp3; + } + + if (_temp3 instanceof Completion) { + _temp3 = _temp3.Value; + } + + const iteratorRecord = _temp3; // 8. Repeat, + + while (true) { + let _temp4 = IteratorStep(iteratorRecord); + + if (_temp4 instanceof AbruptCompletion) { + return _temp4; + } + + if (_temp4 instanceof Completion) { + _temp4 = _temp4.Value; + } + + // a. Let next be ? IteratorStep(iteratorRecord). + const next = _temp4; // b. If next is false, return set. + + if (next === Value.false) { + return set; + } // c. Let nextValue be ? IteratorValue(next). + + + let _temp5 = IteratorValue(next); + + if (_temp5 instanceof AbruptCompletion) { + return _temp5; + } + + if (_temp5 instanceof Completion) { + _temp5 = _temp5.Value; + } + + const nextValue = _temp5; // d. Let status be Call(adder, set, « nextValue »). + + const status = Call(adder, set, [nextValue]); // e. If status is an abrupt completion, return ? IteratorClose(iteratorRecord, status). + + if (status instanceof AbruptCompletion) { + return IteratorClose(iteratorRecord, status); + } + } + } + + function BootstrapWeakSet(realmRec) { + const c = BootstrapConstructor(realmRec, WeakSetConstructor, 'WeakSet', 0, realmRec.Intrinsics['%WeakSet.prototype%'], []); + realmRec.Intrinsics['%WeakSet%'] = c; + } + function WeakRefProto_deref(args, { thisValue }) { @@ -44529,6 +44967,10 @@ BootstrapDataViewPrototype(realmRec); BootstrapDataView(realmRec); BootstrapJSON(realmRec); + BootstrapWeakMapPrototype(realmRec); + BootstrapWeakMap(realmRec); + BootstrapWeakSetPrototype(realmRec); + BootstrapWeakSet(realmRec); if (surroundingAgent.feature('WeakRefs')) { BootstrapWeakRefPrototype(realmRec); @@ -44604,9 +45046,7 @@ // 'encodeURIComponent', // Constructor Properties of the Global Object 'Array', 'ArrayBuffer', 'Boolean', 'BigInt', 'DataView', 'Date', 'Error', 'EvalError', 'Float32Array', 'Float64Array', 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Number', 'Object', 'Promise', 'Proxy', 'RangeError', 'ReferenceError', 'RegExp', 'Set', // 'SharedArrayBuffer', - 'String', 'Symbol', 'SyntaxError', 'TypeError', 'Uint8Array', 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'URIError', // 'WeakMap', - // 'WeakSet', - // Other Properties of the Global Object + 'String', 'Symbol', 'SyntaxError', 'TypeError', 'Uint8Array', 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'URIError', 'WeakMap', 'WeakSet', // Other Properties of the Global Object // 'Atomics', 'JSON', 'Math', 'Reflect'].forEach(name => { let _temp5 = DefinePropertyOrThrow(global, new Value(name), Descriptor({ @@ -44776,6 +45216,7 @@ const UnableToSeal = o => `Unable to seal object ${i(o)}`; const UnableToFreeze = o => `Unable to freeze object ${i(o)}`; const UnableToPreventExtensions = o => `Unable to prevent extensions on object ${i(o)}`; + const WeakCollectionNotObject = v => `${i(v)} is not a valid weak collectection entry object`; var messages = /*#__PURE__*/Object.freeze({ __proto__: null, @@ -44886,7 +45327,8 @@ TypedArrayTooSmall: TypedArrayTooSmall, UnableToSeal: UnableToSeal, UnableToFreeze: UnableToFreeze, - UnableToPreventExtensions: UnableToPreventExtensions + UnableToPreventExtensions: UnableToPreventExtensions, + WeakCollectionNotObject: WeakCollectionNotObject }); const FEATURES = Object.freeze([{ @@ -56504,15 +56946,22 @@ function mark() { // https://tc39.es/proposal-weakrefs/#sec-weakref-execution - // At any time, if an object obj is not live, an ECMAScript implementation may perform the following steps atomically: - // 1. For each WeakRef ref such that ref.[[WeakRefTarget]] is obj, - // a. Set ref.[[WeakRefTarget]] to empty. - // 2. For each FinalizationGroup fg such that fg.[[Cells]] contains cell, such that cell.[[WeakRefTarget]] is obj, - // a. Set cell.[[WeakRefTarget]] to empty. - // b. Optionally, perform ! HostCleanupFinalizationGroup(fg). + // At any time, if a set of objects S is not live, an ECMAScript implementation may perform the following steps automically: + // 1. For each obj os S, do + // a. For each WeakRef ref such that ref.[[WeakRefTarget]] is obj, + // i. Set ref.[[WeakRefTarget]] to empty. + // b. For each FinalizationGroup fg such that fg.[[Cells]] contains cell, such that cell.[[WeakRefTarget]] is obj, + // i. Set cell.[[WeakRefTarget]] to empty. + // ii. Optionally, perform ! HostCleanupFinalizationGroup(fg). + // c. For each WeakMap map such that map.WeakMapData contains a record r such that r.Key is obj, + // i. Remove r from map.WeakMapData. + // d. For each WeakSet set such that set.WeakSetData contains obj, + // i. Remove obj from WeakSetData. const marked = new Set(); const weakrefs = new Set(); const fgs = new Set(); + const weakmaps = new Set(); + const weaksets = new Set(); const markCb = O => { if (typeof O !== 'object' || O === null) { @@ -56527,41 +56976,76 @@ if ('WeakRefTarget' in O && !('HeldValue' in O)) { weakrefs.add(O); + markCb(O.properties); + markCb(O.Prototype); } else if ('Cells' in O) { fgs.add(O); + markCb(O.properties); + markCb(O.Prototype); O.Cells.forEach(cell => { markCb(cell.HeldValue); }); + } else if ('WeakMapData' in O) { + weakmaps.add(O); + markCb(O.properties); + markCb(O.Prototype); + } else if ('WeakSetData' in O) { + weaksets.add(O); + markCb(O.properties); + markCb(O.Prototype); } else if (O.mark) { O.mark(markCb); } }; + if (surroundingAgent.feature('WeakRefs')) { + ClearKeptObjects(); + } + markCb(surroundingAgent); - weakrefs.forEach(ref => { - if (!marked.has(ref.WeakRefTarget)) { - ref.WeakRefTarget = undefined; - } - }); - fgs.forEach(fg => { - let dirty = false; - fg.Cells.forEach(cell => { - if (!marked.has(cell.WeakRefTarget)) { - cell.WeakRefTarget = undefined; - dirty = true; + + if (surroundingAgent.feature('WeakRefs')) { + weakrefs.forEach(ref => { + if (!marked.has(ref.WeakRefTarget)) { + ref.WeakRefTarget = undefined; } }); + fgs.forEach(fg => { + let dirty = false; + fg.Cells.forEach(cell => { + if (!marked.has(cell.WeakRefTarget)) { + cell.WeakRefTarget = undefined; + dirty = true; + } + }); - if (dirty) { - let _temp = HostCleanupFinalizationGroup(fg); + if (dirty) { + let _temp = HostCleanupFinalizationGroup(fg); - Assert(!(_temp instanceof AbruptCompletion), "HostCleanupFinalizationGroup(fg)" + ' returned an abrupt completion'); - /* istanbul ignore if */ + Assert(!(_temp instanceof AbruptCompletion), "HostCleanupFinalizationGroup(fg)" + ' returned an abrupt completion'); + /* istanbul ignore if */ - if (_temp instanceof Completion) { - _temp = _temp.Value; + if (_temp instanceof Completion) { + _temp = _temp.Value; + } } - } + }); + } + + weakmaps.forEach(map => { + map.WeakMapData.forEach(r => { + if (!marked.has(r.Key)) { + r.Key = undefined; + r.Value = undefined; + } + }); + }); + weaksets.forEach(set => { + set.WeakSetData.forEach((obj, i) => { + if (!marked.has(obj)) { + set.WeakSetData[i] = undefined; + } + }); }); } @@ -56590,11 +57074,7 @@ HostReportErrors(result.Value); } - if (surroundingAgent.feature('WeakRefs')) { - ClearKeptObjects(); - mark(); - } - + mark(); surroundingAgent.executionContextStack.pop(newContext); } diff --git a/engine262.js.map b/engine262.js.map index 2a2c72eb..46eee55e 100644 --- a/engine262.js.map +++ b/engine262.js.map @@ -1 +1 @@ -{"version":3,"file":"engine262.js","sources":["../src/abstract-ops/notational-conventions.mjs","../src/ast.mjs","../src/helpers.mjs","../src/runtime-semantics/AdditiveExpression.mjs","../src/runtime-semantics/ArgumentListEvaluation.mjs","../src/runtime-semantics/ArrayLiteral.mjs","../src/runtime-semantics/ArrowFunction.mjs","../src/static-semantics/BoundNames.mjs","../src/static-semantics/ConstructorMethod.mjs","../src/static-semantics/ContainsExpression.mjs","../src/static-semantics/ContainsUseStrict.mjs","../src/static-semantics/DeclarationPart.mjs","../src/static-semantics/ExpectedArgumentCount.mjs","../src/static-semantics/ExportEntriesForModule.mjs","../src/static-semantics/ModuleRequests.mjs","../src/static-semantics/ExportEntries.mjs","../src/static-semantics/HasInitializer.mjs","../src/static-semantics/HasName.mjs","../src/static-semantics/ImportEntriesForModule.mjs","../src/static-semantics/ImportEntries.mjs","../src/static-semantics/ImportedLocalNames.mjs","../src/static-semantics/IsAnonymousFunctionDefinition.mjs","../src/static-semantics/IsConstantDeclaration.mjs","../src/static-semantics/IsDestructuring.mjs","../src/static-semantics/IsFunctionDefinition.mjs","../src/static-semantics/IsIdentifierRef.mjs","../src/static-semantics/IsInTailPosition.mjs","../src/static-semantics/IsSimpleParameterList.mjs","../src/static-semantics/IsStatic.mjs","../src/static-semantics/IsStrict.mjs","../src/static-semantics/TopLevelLexicallyDeclaredNames.mjs","../src/static-semantics/TopLevelVarDeclaredNames.mjs","../src/static-semantics/VarDeclaredNames.mjs","../src/static-semantics/LexicallyDeclaredNames.mjs","../src/static-semantics/LexicallyScopedDeclarations.mjs","../node_modules/nearley/lib/nearley.js","../src/grammar/Scientific.mjs","../src/grammar/StrNumericLiteral-gen.mjs","../src/static-semantics/MV.mjs","../src/static-semantics/NonConstructorMethodDefinitions.mjs","../src/static-semantics/TRV.mjs","../src/static-semantics/TV.mjs","../src/static-semantics/TemplateStrings.mjs","../src/static-semantics/TopLevelLexicallyScopedDeclarations.mjs","../src/static-semantics/VarScopedDeclarations.mjs","../src/static-semantics/TopLevelVarScopedDeclarations.mjs","../src/runtime-semantics/AssignmentExpression.mjs","../src/runtime-semantics/AsyncArrowFunction.mjs","../src/runtime-semantics/AsyncFunctionExpression.mjs","../src/runtime-semantics/AsyncGeneratorExpression.mjs","../src/runtime-semantics/AwaitExpression.mjs","../src/runtime-semantics/BindingInitialization.mjs","../src/runtime-semantics/BitwiseOperators.mjs","../src/runtime-semantics/BlockStatement.mjs","../src/runtime-semantics/BreakStatement.mjs","../src/runtime-semantics/BreakableStatement.mjs","../src/runtime-semantics/CallExpression.mjs","../node_modules/acorn/dist/acorn.mjs","../src/parse.mjs","../src/runtime-semantics/ClassDefinition.mjs","../src/runtime-semantics/CoalesceExpression.mjs","../src/runtime-semantics/ConditionalExpression.mjs","../src/runtime-semantics/ContinueStatement.mjs","../src/runtime-semantics/CreateDynamicFunction.mjs","../src/runtime-semantics/DebuggerStatement.mjs","../src/runtime-semantics/DefineMethod.mjs","../src/runtime-semantics/DestructuringAssignmentEvaluation.mjs","../src/runtime-semantics/EmptyStatement.mjs","../src/runtime-semantics/EqualityExpression.mjs","../src/runtime-semantics/EvaluateBody.mjs","../src/runtime-semantics/EvaluatePropertyAccess.mjs","../src/runtime-semantics/ExponentiationExpression.mjs","../src/runtime-semantics/ExpressionWithComma.mjs","../src/runtime-semantics/ExportDeclaration.mjs","../src/intrinsics/Bootstrap.mjs","../src/intrinsics/ForInIteratorPrototype.mjs","../src/runtime-semantics/ForStatement.mjs","../src/runtime-semantics/FunctionDeclaration.mjs","../src/runtime-semantics/FunctionExpression.mjs","../src/runtime-semantics/FunctionStatementList.mjs","../src/runtime-semantics/GeneratorExpression.mjs","../src/runtime-semantics/GetSubstitution.mjs","../src/runtime-semantics/GlobalDeclarationInstantiation.mjs","../src/runtime-semantics/HoistableDeclaration.mjs","../src/runtime-semantics/Identifier.mjs","../src/runtime-semantics/IfStatement.mjs","../src/runtime-semantics/ImportCall.mjs","../src/runtime-semantics/InstantiateFunctionObject.mjs","../src/runtime-semantics/IteratorBindingInitialization.mjs","../src/runtime-semantics/KeyedBindingInitialization.mjs","../src/runtime-semantics/LabelledStatement.mjs","../src/runtime-semantics/LexicalDeclaration.mjs","../src/runtime-semantics/Literal.mjs","../src/runtime-semantics/LogicalANDExpression.mjs","../src/runtime-semantics/LogicalORExpression.mjs","../src/runtime-semantics/MemberExpression.mjs","../src/runtime-semantics/MetaProperty.mjs","../src/grammar/numeric-string.mjs","../src/runtime-semantics/MV.mjs","../src/runtime-semantics/MultiplicativeExpression.mjs","../src/runtime-semantics/NamedEvaluation.mjs","../src/runtime-semantics/NewExpression.mjs","../src/runtime-semantics/NumberToBigInt.mjs","../src/runtime-semantics/ObjectLiteral.mjs","../src/runtime-semantics/OptionalExpression.mjs","../src/runtime-semantics/PropertyBindingInitialization.mjs","../src/runtime-semantics/PropertyDefinitionEvaluation.mjs","../src/runtime-semantics/PropertyName.mjs","../src/runtime-semantics/RegularExpressionLiteral.mjs","../src/runtime-semantics/RelationalOperators.mjs","../src/runtime-semantics/RestBindingInitialization.mjs","../src/runtime-semantics/ReturnStatement.mjs","../src/runtime-semantics/ShiftExpression.mjs","../src/runtime-semantics/StringPad.mjs","../src/runtime-semantics/SuperCall.mjs","../src/runtime-semantics/SuperProperty.mjs","../src/runtime-semantics/SwitchStatement.mjs","../src/runtime-semantics/TaggedTemplate.mjs","../src/runtime-semantics/TemplateLiteral.mjs","../src/runtime-semantics/ThisExpression.mjs","../src/runtime-semantics/ThrowStatement.mjs","../src/runtime-semantics/TrimString.mjs","../src/runtime-semantics/TryStatement.mjs","../src/runtime-semantics/UnaryExpression.mjs","../src/runtime-semantics/UpdateExpression.mjs","../src/runtime-semantics/VariableStatement.mjs","../src/runtime-semantics/WithStatement.mjs","../src/runtime-semantics/YieldExpression.mjs","../src/evaluator.mjs","../src/modules.mjs","../src/environment.mjs","../src/value.mjs","../src/intrinsics/ObjectPrototype.mjs","../src/intrinsics/Map.mjs","../src/intrinsics/Object.mjs","../src/intrinsics/ArrayPrototypeShared.mjs","../src/intrinsics/ArrayPrototype.mjs","../src/intrinsics/Array.mjs","../src/intrinsics/BigInt.mjs","../src/intrinsics/BigIntPrototype.mjs","../src/intrinsics/BooleanPrototype.mjs","../src/intrinsics/Boolean.mjs","../src/intrinsics/NumberPrototype.mjs","../src/intrinsics/Number.mjs","../src/intrinsics/FunctionPrototype.mjs","../src/intrinsics/Function.mjs","../src/intrinsics/SymbolPrototype.mjs","../src/intrinsics/Symbol.mjs","../src/intrinsics/Math.mjs","../src/intrinsics/DatePrototype.mjs","../src/intrinsics/Date.mjs","../src/intrinsics/RegExpStringIteratorPrototype.mjs","../src/intrinsics/RegExpPrototype.mjs","../src/intrinsics/RegExp.mjs","../src/intrinsics/PromisePrototype.mjs","../src/intrinsics/Promise.mjs","../src/intrinsics/Proxy.mjs","../src/intrinsics/Reflect.mjs","../src/intrinsics/StringIteratorPrototype.mjs","../src/intrinsics/StringPrototype.mjs","../src/intrinsics/String.mjs","../src/intrinsics/ErrorPrototype.mjs","../src/intrinsics/Error.mjs","../src/intrinsics/NativeError.mjs","../src/intrinsics/IteratorPrototype.mjs","../src/intrinsics/AsyncIteratorPrototype.mjs","../src/intrinsics/ArrayIteratorPrototype.mjs","../src/intrinsics/MapIteratorPrototype.mjs","../src/intrinsics/SetIteratorPrototype.mjs","../src/intrinsics/MapPrototype.mjs","../src/intrinsics/SetPrototype.mjs","../src/intrinsics/Set.mjs","../src/intrinsics/Generator.mjs","../src/intrinsics/GeneratorFunction.mjs","../src/intrinsics/GeneratorPrototype.mjs","../src/intrinsics/AsyncFunctionPrototype.mjs","../src/intrinsics/AsyncFunction.mjs","../src/intrinsics/AsyncGenerator.mjs","../src/intrinsics/AsyncGeneratorFunction.mjs","../src/intrinsics/AsyncGeneratorPrototype.mjs","../src/intrinsics/AsyncFromSyncIteratorPrototype.mjs","../src/intrinsics/ArrayBuffer.mjs","../src/intrinsics/ArrayBufferPrototype.mjs","../src/intrinsics/JSON.mjs","../src/intrinsics/eval.mjs","../src/intrinsics/isFinite.mjs","../src/intrinsics/isNaN.mjs","../src/intrinsics/parseFloat.mjs","../src/intrinsics/parseInt.mjs","../src/intrinsics/ThrowTypeError.mjs","../src/intrinsics/TypedArray.mjs","../src/intrinsics/TypedArrayPrototype.mjs","../src/intrinsics/TypedArrayConstructors.mjs","../src/intrinsics/TypedArrayPrototypes.mjs","../src/intrinsics/DataView.mjs","../src/intrinsics/DataViewPrototype.mjs","../src/intrinsics/WeakRefPrototype.mjs","../src/intrinsics/WeakRef.mjs","../src/intrinsics/FinalizationGroupPrototype.mjs","../src/intrinsics/FinalizationGroup.mjs","../src/intrinsics/FinalizationGroupCleanupIteratorPrototype.mjs","../src/realm.mjs","../src/messages.mjs","../src/engine.mjs","../src/completion.mjs","../src/abstract-ops/arguments-operations.mjs","../src/abstract-ops/array-objects.mjs","../src/abstract-ops/arraybuffer-objects.mjs","../src/abstract-ops/async-function-operations.mjs","../src/abstract-ops/async-generator-objects.mjs","../src/abstract-ops/data-types-and-values.mjs","../src/abstract-ops/dataview-objects.mjs","../src/abstract-ops/date-objects.mjs","../src/abstract-ops/execution-contexts.mjs","../src/abstract-ops/function-operations.mjs","../src/abstract-ops/generator-operations.mjs","../src/abstract-ops/global-object.mjs","../src/abstract-ops/immutable-prototype-objects.mjs","../src/abstract-ops/integer-indexed-objects.mjs","../src/abstract-ops/iterator-operations.mjs","../src/abstract-ops/module-namespace-exotic-objects.mjs","../src/abstract-ops/module-records.mjs","../src/abstract-ops/object-operations.mjs","../src/abstract-ops/objects.mjs","../src/abstract-ops/promise-operations.mjs","../src/abstract-ops/proxy-objects.mjs","../src/abstract-ops/reference-operations.mjs","../src/abstract-ops/regexp-objects.mjs","../src/abstract-ops/source-code.mjs","../src/abstract-ops/spec-types.mjs","../src/abstract-ops/string-objects.mjs","../src/abstract-ops/symbol-objects.mjs","../src/abstract-ops/testing-comparison.mjs","../src/abstract-ops/type-conversion.mjs","../src/abstract-ops/typedarray-objects.mjs","../src/abstract-ops/weak-operations.mjs","../src/inspect.mjs","../src/api.mjs"],"sourcesContent":["import { surroundingAgent } from '../engine.mjs';\nimport { Value, Type } from '../value.mjs';\n\nexport function Assert(invariant, source) {\n if (!invariant) {\n throw new TypeError(`Assert failed${source ? `: ${source}` : ''}`.trim());\n }\n}\n\n// 9.1.15 #sec-requireinternalslot\nexport function RequireInternalSlot(O, internalSlot) {\n if (Type(O) !== 'Object') {\n return surroundingAgent.Throw('TypeError', 'NotAnObject', O);\n }\n if (!(internalSlot in O)) {\n return surroundingAgent.Throw('TypeError', 'InternalSlotMissing', O, internalSlot);\n }\n}\n\nexport function sourceTextMatchedBy(node) {\n return new Value(node.sourceText());\n}\n\n// An ECMAScript Script syntactic unit may be processed using either unrestricted or strict mode syntax and semantics.\n// Code is interpreted as strict mode code in the following situations:\n//\n// - Global code is strict mode code if it begins with a Directive Prologue that contains a Use Strict Directive.\n//\n// - Module code is always strict mode code.\n//\n// - All parts of a ClassDeclaration or a ClassExpression are strict mode code.\n//\n// - Eval code is strict mode code if it begins with a Directive Prologue that contains a Use Strict Directive or\n// if the call to eval is a direct eval that is contained in strict mode code.\n//\n// - Function code is strict mode code if the associated FunctionDeclaration, FunctionExpression, GeneratorDeclaration,\n// GeneratorExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, AsyncGeneratorDeclaration,\n// AsyncGeneratorExpression, MethodDefinition, ArrowFunction, or AsyncArrowFunction is contained in strict mode code\n// or if the code that produces the value of the function's [[ECMAScriptCode]] internal slot begins with a Directive\n// Prologue that contains a Use Strict Directive.\n//\n// - Function code that is supplied as the arguments to the built-in Function, Generator, AsyncFunction, and\n// AsyncGenerator constructors is strict mode code if the last argument is a String that when processed is a\n// FunctionBody that begins with a Directive Prologue that contains a Use Strict Directive.\nexport function isStrictModeCode(node) {\n if (node.strict === true) {\n return true;\n }\n\n if (node.type === 'FunctionDeclaration' || node.type === 'FunctionExpression') {\n return isStrictModeCode(node.body);\n }\n\n return false;\n}\n","import { Assert } from './abstract-ops/notational-conventions.mjs';\n\n// #prod-NullLiteral\nexport function isNullLiteral(node) {\n return node.type === 'Literal' && node.value === null;\n}\n\n// #prod-BooleanLiteral\nexport function isBooleanLiteral(node) {\n return node.type === 'Literal' && typeof node.value === 'boolean';\n}\n\n// #prod-NumericLiteral\nexport function isNumericLiteral(node) {\n return node.type === 'Literal'\n && (typeof node.value === 'number' || typeof node.value === 'bigint');\n}\n\n// #prod-StringLiteral\nexport function isStringLiteral(node) {\n return node.type === 'Literal' && typeof node.value === 'string';\n}\n\nexport function isSpreadElement(node) {\n return node.type === 'SpreadElement';\n}\n\n// #prod-RegularExpressionLiteral\nexport function isRegularExpressionLiteral(node) {\n return node.type === 'Literal' && typeof node.regex === 'object';\n}\n\n// #prod-Identifier\n// Not exact, as we allow reserved words when appropriate. (This is more like\n// IdentifierReference.)\nexport function isIdentifier(node) {\n return node.type === 'Identifier';\n}\n\n// #prod-IdentifierReference\nexport const isIdentifierReference = isIdentifier;\n\n// #prod-IdentifierName\nexport const isIdentifierName = isIdentifier;\n\n// #prod-BindingIdentifier\nexport const isBindingIdentifier = isIdentifier;\n\n// #prod-LabelIdentifier\nexport const isLabelIdentifier = isIdentifier;\n\n// Used in #prod-PrimaryExpression\nexport function isThis(node) {\n return node.type === 'ThisExpression';\n}\n\n// #prod-Literal\nexport function isLiteral(node) {\n // Just checking node.type is not enough as RegularExpressionLiteral also\n // uses 'Literal' as node.type.\n return isNullLiteral(node)\n || isBooleanLiteral(node)\n || isNumericLiteral(node)\n || isStringLiteral(node);\n}\n\n// #prod-ArrayLiteral\nexport function isArrayLiteral(node) {\n return node.type === 'ArrayExpression';\n}\n\n// #prod-ObjectLiteral\nexport function isObjectLiteral(node) {\n return node.type === 'ObjectExpression';\n}\n\n// #prod-GeneratorMethod\nexport function isGeneratorMethod(node) {\n return (\n (node.type === 'Property' && !node.shorthand && node.method && node.kind === 'init')\n || (node.type === 'MethodDefinition' && node.kind === 'method')\n ) && isGeneratorExpression(node.value);\n}\n\n// #prod-AsyncMethod\nexport function isAsyncMethod(node) {\n return (\n (node.type === 'Property' && !node.shorthand && node.method && node.kind === 'init')\n || (node.type === 'MethodDefinition' && node.kind === 'method')\n ) && isAsyncFunctionExpression(node.value);\n}\n\n// #prod-AsyncGeneratorMethod\nexport function isAsyncGeneratorMethod(node) {\n return (\n (node.type === 'Property' && !node.shorthand && node.method && node.kind === 'init')\n || (node.type === 'MethodDefinition' && node.kind === 'method')\n ) && isAsyncGeneratorExpression(node.value);\n}\n\n// Used in #prod-MethodDefinition\nexport function isMethodDefinitionRegularFunction(node) {\n return (\n (node.type === 'Property' && !node.shorthand && node.method && node.kind === 'init')\n || (node.type === 'MethodDefinition' && node.kind === 'method')\n ) && isFunctionExpression(node.value);\n}\n\n// Used in #prod-MethodDefinition\nexport function isMethodDefinitionGetter(node) {\n return (\n (node.type === 'Property' && !node.shorthand && !node.method)\n || node.type === 'MethodDefinition'\n ) && node.kind === 'get';\n}\n\n// Used in #prod-MethodDefinition\nexport function isMethodDefinitionSetter(node) {\n return (\n (node.type === 'Property' && !node.shorthand && !node.method)\n || node.type === 'MethodDefinition'\n ) && node.kind === 'set';\n}\n\n// #prod-MethodDefinition\nexport function isMethodDefinition(node) {\n return isMethodDefinitionRegularFunction(node)\n || isGeneratorMethod(node)\n || isAsyncMethod(node)\n || isAsyncGeneratorMethod(node)\n || isMethodDefinitionGetter(node)\n || isMethodDefinitionSetter(node);\n}\n\n// Used in #prod-PropertyDefinition\nexport function isPropertyDefinitionIdentifierReference(node) {\n return node.type === 'Property' && node.shorthand && !node.method && !node.computed && node.kind === 'init';\n}\n\n// Used in #prod-PropertyDefinition\nexport function isPropertyDefinitionKeyValue(node) {\n return node.type === 'Property' && !node.shorthand && !node.method && node.kind === 'init';\n}\n\n// Used in #prod-PropertyDefinition\nexport function isPropertyDefinitionSpread(node) {\n return node.type === 'SpreadElement';\n}\n\n// #prod-FunctionExpression\nexport function isFunctionExpression(node) {\n return node.type === 'FunctionExpression'\n && !node.generator\n && !node.async;\n}\n\nexport function isFunctionExpressionWithBindingIdentifier(node) {\n return isFunctionExpression(node) && node.id !== null;\n}\n\nexport function isAsyncFunctionExpressionWithBindingIdentifier(node) {\n return isAsyncFunctionExpression(node) && node.id !== null;\n}\n\n// #prod-ClassExpression\nexport function isClassExpression(node) {\n return node.type === 'ClassExpression';\n}\n\n// #prod-GeneratorExpression\nexport function isGeneratorExpression(node) {\n return node.type === 'FunctionExpression'\n && node.generator\n && !node.async;\n}\n\n// #prod-AsyncFunctionExpression\nexport function isAsyncFunctionExpression(node) {\n return node.type === 'FunctionExpression'\n && !node.generator\n && node.async;\n}\n\n// #prod-AsyncGeneratorExpression\nexport function isAsyncGeneratorExpression(node) {\n return node.type === 'FunctionExpression'\n && node.generator\n && node.async;\n}\n\n// #prod-TemplateLiteral\nexport function isTemplateLiteral(node) {\n return node.type === 'TemplateLiteral';\n}\n\n// #prod-NoSubstitutionTemplate\nexport function isNoSubstitutionTemplate(node) {\n return isTemplateLiteral(node) && node.expressions.length === 0;\n}\n\n// #prod-SubstitutionTemplate\nexport function isSubstitutionTemplate(node) {\n return isTemplateLiteral(node) && node.expressions.length !== 0;\n}\n\nexport function unrollTemplateLiteral(TemplateLiteral) {\n const all = [TemplateLiteral.quasis[0]];\n for (let i = 1; i < TemplateLiteral.quasis.length; i += 1) {\n all.push(TemplateLiteral.expressions[i - 1]);\n all.push(TemplateLiteral.quasis[i]);\n }\n return all;\n}\n\nexport function isTaggedTemplate(node) {\n return node.type === 'TaggedTemplateExpression';\n}\n\n// Used in #prod-MemberExpression and #prod-CallExpression\nexport function isActualMemberExpression(node) {\n return node.type === 'MemberExpression' && node.object.type !== 'Super';\n}\n\n// Used in #prod-MemberExpression and #prod-CallExpression\nexport function isActualMemberExpressionWithBrackets(node) {\n return isActualMemberExpression(node) && node.computed;\n}\n\n// Used in #prod-MemberExpression and #prod-CallExpression\nexport function isActualMemberExpressionWithDot(node) {\n return isActualMemberExpression(node) && !node.computed;\n}\n\n// #prod-SuperProperty\nexport function isSuperProperty(node) {\n return node.type === 'MemberExpression' && node.object.type === 'Super';\n}\n\n// #prod-MetaProperty\nexport function isMetaProperty(node) {\n return node.type === 'MetaProperty';\n}\n\n// #prod-NewTarget\nexport function isNewTarget(node) {\n return isMetaProperty(node)\n && node.meta.name === 'new'\n && node.property.name === 'target';\n}\n\n// https://tc39.es/proposal-import-meta/#prod-ImportMeta\nexport function isImportMeta(node) {\n return isMetaProperty(node)\n && node.meta.name === 'import'\n && node.property.name === 'meta';\n}\n\n// Used in #prod-MemberExpression and #prod-NewExpression\nexport function isActualNewExpression(node) {\n return node.type === 'NewExpression';\n}\n\n// Used in #prod-CallExpression and #prod-CallMemberExpression\nexport function isActualCallExpression(node) {\n return node.type === 'CallExpression' && node.callee.type !== 'Super';\n}\n\n// #prod-SuperCall\nexport function isSuperCall(node) {\n return node.type === 'CallExpression' && node.callee.type === 'Super';\n}\n\n// #prod-ImportCall\nexport function isImportCall(node) {\n return node.type === 'ImportExpression';\n}\n\n// Used in #prod-UpdateExpression\nexport function isActualUpdateExpression(node) {\n return node.type === 'UpdateExpression';\n}\n\n// Used in #prod-UnaryExpression\nexport function isActualUnaryExpression(node) {\n return node.type === 'UnaryExpression';\n}\n\n// Used in #prod-UnaryExpression\nexport function isUnaryExpressionWithDelete(node) {\n return node.type === 'UnaryExpression' && node.operator === 'delete';\n}\n\n// Used in #prod-UnaryExpression\nexport function isUnaryExpressionWithVoid(node) {\n return node.type === 'UnaryExpression' && node.operator === 'void';\n}\n\n// Used in #prod-UnaryExpression\nexport function isUnaryExpressionWithTypeof(node) {\n return node.type === 'UnaryExpression' && node.operator === 'typeof';\n}\n\n// Used in #prod-UnaryExpression\nexport function isUnaryExpressionWithPlus(node) {\n return node.type === 'UnaryExpression' && node.operator === '+';\n}\n\n// Used in #prod-UnaryExpression\nexport function isUnaryExpressionWithMinus(node) {\n return node.type === 'UnaryExpression' && node.operator === '-';\n}\n\n// Used in #prod-UnaryExpression\nexport function isUnaryExpressionWithTilde(node) {\n return node.type === 'UnaryExpression' && node.operator === '~';\n}\n\n// Used in #prod-UnaryExpression\nexport function isUnaryExpressionWithBang(node) {\n return node.type === 'UnaryExpression' && node.operator === '!';\n}\n\n// #prod-AwaitExpression\nexport function isAwaitExpression(node) {\n return node.type === 'AwaitExpression';\n}\n\n// Used in #prod-ExponentiationExpression\nexport function isActualExponentiationExpression(node) {\n return node.type === 'BinaryExpression' && node.operator === '**';\n}\n\n// Used in #prod-MultiplicativeExpression\nexport function isActualMultiplicativeExpression(node) {\n return node.type === 'BinaryExpression'\n && (\n node.operator === '*'\n || node.operator === '/'\n || node.operator === '%'\n );\n}\n\n// Used in #prod-AdditiveExpression\nexport function isActualAdditiveExpression(node) {\n return node.type === 'BinaryExpression'\n && (node.operator === '+' || node.operator === '-');\n}\n\n// Used in #prod-AdditiveExpression\nexport function isAdditiveExpressionWithPlus(node) {\n return isActualAdditiveExpression(node) && node.operator === '+';\n}\n\n// Used in #prod-AdditiveExpression\nexport function isAdditiveExpressionWithMinus(node) {\n return isActualAdditiveExpression(node) && node.operator === '-';\n}\n\n// Used in #prod-ShiftExpression\nexport function isActualShiftExpression(node) {\n return node.type === 'BinaryExpression'\n && (\n node.operator === '<<'\n || node.operator === '>>'\n || node.operator === '>>>'\n );\n}\n\n// Used in #prod-RelationalExpression\nexport function isActualRelationalExpression(node) {\n return node.type === 'BinaryExpression'\n && (\n node.operator === '<'\n || node.operator === '>'\n || node.operator === '<='\n || node.operator === '>='\n || node.operator === 'instanceof'\n || node.operator === 'in'\n );\n}\n\n// Used in #prod-EqualityExpression\nexport function isActualEqualityExpression(node) {\n return node.type === 'BinaryExpression'\n && (\n node.operator === '=='\n || node.operator === '!='\n || node.operator === '==='\n || node.operator === '!=='\n );\n}\n\n// Used in #prod-BitwiseANDExpression\nexport function isActualBitwiseANDExpression(node) {\n return node.type === 'BinaryExpression' && node.operator === '&';\n}\n\n// Used in #prod-BitwiseXORExpression\nexport function isActualBitwiseXORExpression(node) {\n return node.type === 'BinaryExpression' && node.operator === '^';\n}\n\n// Used in #prod-BitwiseORExpression\nexport function isActualBitwiseORExpression(node) {\n return node.type === 'BinaryExpression' && node.operator === '|';\n}\n\n// Used in #prod-LogicalANDExpression\nexport function isActualLogicalANDExpression(node) {\n return node.type === 'LogicalExpression' && node.operator === '&&';\n}\n\n// Used in #prod-LogicalORExpression\nexport function isActualLogicalORExpression(node) {\n return node.type === 'LogicalExpression' && node.operator === '||';\n}\n\n// Used in #prod-ConditionalExpression\nexport function isActualConditionalExpression(node) {\n return node.type === 'ConditionalExpression';\n}\n\n// #prod-YieldExpression\nexport function isYieldExpression(node) {\n return node.type === 'YieldExpression';\n}\n\n// Used in #prod-YieldExpression.\nexport function isYieldExpressionWithStar(node) {\n return isYieldExpression(node) && node.delegate;\n}\n\n// #prod-ArrowFunction\nexport function isArrowFunction(node) {\n return node.type === 'ArrowFunctionExpression'\n && !node.async\n && !node.generator;\n}\n\n// #prod-AsyncArrowFunction\nexport function isAsyncArrowFunction(node) {\n return node.type === 'ArrowFunctionExpression'\n && node.async\n && !node.generator;\n}\n\n// Used in #prod-AssignmentExpression\nexport function isActualAssignmentExpression(node) {\n return node.type === 'AssignmentExpression';\n}\n\n// Used in #prod-AssignmentExpression\nexport function isAssignmentExpressionWithEquals(node) {\n return isActualAssignmentExpression(node) && node.operator === '=';\n}\n\n// Used in #prod-AssignmentExpression\nexport function isAssignmentExpressionWithAssignmentOperator(node) {\n return isActualAssignmentExpression(node) && node.operator !== '=';\n}\n\n// Used in #prod-Expression\nexport function isExpressionWithComma(node) {\n return node.type === 'SequenceExpression';\n}\n\nexport function isParenthesizedExpression(node) {\n return node.type === 'ParenthesizedExpression';\n}\n\n// #prod-CoalesceExpression\nexport function isActualCoalesceExpression(node) {\n return node.type === 'BinaryExpression' && node.operator === '??';\n}\n\n// #prod-OptionalExpression\nexport function isOptionalExpression(node) {\n return node.type === 'OptionalExpression';\n}\n\n// #prod-OptionalChain\nexport function isOptionalChain(node) {\n return node.type === 'OptionalChain';\n}\n\nexport function isOptionalChainWithOptionalChain(node) {\n return isOptionalChain(node) && node.base !== null;\n}\n\nexport function isOptionalChainWithExpression(node) {\n return isOptionalChain(node) && node.property && isExpression(node.property) && !isIdentifierReference(node.property);\n}\n\nexport function isOptionalChainWithIdentifierName(node) {\n return isOptionalChain(node) && node.property && isIdentifier(node.property);\n}\n\nexport function isOptionalChainWithArguments(node) {\n return isOptionalChain(node) && Array.isArray(node.arguments);\n}\n\n// #prod-Expression\nexport function isExpression(node) {\n return (\n // PrimaryExpression\n isThis(node)\n || isIdentifierReference(node)\n || isLiteral(node)\n || isArrayLiteral(node)\n || isObjectLiteral(node)\n || isFunctionExpression(node)\n || isClassExpression(node)\n || isGeneratorExpression(node)\n || isAsyncFunctionExpression(node)\n || isAsyncGeneratorExpression(node)\n || isRegularExpressionLiteral(node)\n || isTemplateLiteral(node)\n || isParenthesizedExpression(node)\n\n // LeftHandSideExpression (including MemberExpression, NewExpression, and\n // CallExpression)\n || isActualMemberExpression(node)\n || isOptionalExpression(node)\n || isSuperProperty(node)\n || isSuperCall(node)\n || isImportCall(node)\n || isMetaProperty(node)\n || isActualNewExpression(node)\n || isActualCallExpression(node)\n || isTaggedTemplate(node)\n\n // UpdateExpression\n || isActualUpdateExpression(node)\n\n // UnaryExpression\n || isActualUnaryExpression(node)\n || isAwaitExpression(node)\n\n // ExponentiationExpression\n || isActualExponentiationExpression(node)\n\n // MultiplicativeExpression\n || isActualMultiplicativeExpression(node)\n\n // AdditiveExpression\n || isActualAdditiveExpression(node)\n\n // ShiftExpression\n || isActualShiftExpression(node)\n\n // RelationalExpression\n || isActualRelationalExpression(node)\n\n // EqualityExpression\n || isActualEqualityExpression(node)\n\n // BitwiseANDExpression\n || isActualBitwiseANDExpression(node)\n\n // BitwiseXORExpression\n || isActualBitwiseXORExpression(node)\n\n // BitwiseORExpression\n || isActualBitwiseORExpression(node)\n\n // LogicalANDExpression\n || isActualLogicalANDExpression(node)\n\n // LogicalORExpression\n || isActualLogicalORExpression(node)\n\n // CoalesceExpression\n || isActualCoalesceExpression(node)\n\n // ConditionalExpression\n || isActualConditionalExpression(node)\n\n // AssignmentExpression\n || isYieldExpression(node)\n || isArrowFunction(node)\n || isAsyncArrowFunction(node)\n || isActualAssignmentExpression(node)\n\n // Expression\n || isExpressionWithComma(node)\n );\n}\n\n// #prod-ExpressionBody\nexport const isExpressionBody = isExpression;\n\n// Used in #prod-SingleNameBinding\nexport function isBindingIdentifierAndInitializer(node) {\n return node.type === 'AssignmentPattern' && isBindingIdentifier(node.left);\n}\n\n// #prod-SingleNameBinding\n//\n// Use isBindingPropertyWithSingleNameBinding() instead if SingleNameBinding is\n// used as a child of BindingProperty.\nexport function isSingleNameBinding(node) {\n return isBindingIdentifier(node) || isBindingIdentifierAndInitializer(node);\n}\n\n// Used in #prod-BindingElement\nexport function isBindingPatternAndInitializer(node) {\n return node.type === 'AssignmentPattern' && isBindingPattern(node.left);\n}\n\n// #prod-BindingElement\nexport function isBindingElement(node) {\n return isSingleNameBinding(node)\n || isBindingPattern(node)\n || isBindingPatternAndInitializer(node);\n}\n\n// #prod-FormalParameter\nexport const isFormalParameter = isBindingElement;\n\n// #prod-BindingRestElement\nexport function isBindingRestElement(node) {\n return node.type === 'RestElement';\n}\n\n// #prod-FunctionRestParameter\nexport const isFunctionRestParameter = isBindingRestElement;\n\n// #prod-BindingProperty\nexport function isBindingProperty(node) {\n // ESTree puts the SingleNameBinding in node.value.\n return node.type === 'Property' && isBindingElement(node.value);\n}\n\n// Used in #prod-BindingProperty.\nexport function isBindingPropertyWithSingleNameBinding(node) {\n return isBindingProperty(node) && node.shorthand;\n}\n\n// Used in #prod-BindingProperty.\nexport function isBindingPropertyWithColon(node) {\n return isBindingProperty(node) && !node.shorthand;\n}\n\n// #prod-BindingRestProperty\nexport function isBindingRestProperty(node) {\n return node.type === 'RestElement';\n}\n\n// #prod-BlockStatement\nexport function isBlockStatement(node) {\n return node.type === 'BlockStatement';\n}\n\n// #prod-BindingPattern\nexport function isBindingPattern(node) {\n return isObjectBindingPattern(node) || isArrayBindingPattern(node);\n}\n\n// #prod-ObjectBindingPattern\nexport function isObjectBindingPattern(node) {\n return node.type === 'ObjectPattern';\n}\n\nexport function isEmptyObjectBindingPattern(node) {\n return isObjectBindingPattern(node) && node.properties.length === 0;\n}\n\nexport function isObjectBindingPatternWithBindingPropertyList(node) {\n return isObjectBindingPattern(node)\n && node.properties.length > 0\n && !isBindingRestProperty(node.properties[node.properties.length - 1]);\n}\n\nexport function isObjectBindingPatternWithSingleBindingRestProperty(node) {\n return isObjectBindingPattern(node)\n && node.properties.length === 1\n && isBindingRestProperty(node.properties[0]);\n}\n\nexport function isObjectBindingPatternWithBindingPropertyListAndBindingRestProperty(node) {\n return isObjectBindingPattern(node)\n && node.properties.length >= 2\n && isBindingRestProperty(node.properties[node.properties.length - 1]);\n}\n\n// #prod-ArrayBindingPattern\nexport function isArrayBindingPattern(node) {\n return node.type === 'ArrayPattern';\n}\n\n// #prod-AssignmentPattern\nexport const isAssignmentPattern = isBindingPattern;\n\n// #prod-ObjectAssignmentPattern\nexport const isObjectAssignmentPattern = isObjectBindingPattern;\n\n// #prod-ArrayAssignmentPattern\nexport const isArrayAssignmentPattern = isArrayBindingPattern;\n\n// #prod-AssignmentRestProperty\nexport const isAssignmentRestProperty = isBindingRestElement;\n\n// #prod-Block\nexport const isBlock = isBlockStatement;\n\n// #prod-VariableStatement\nexport function isVariableStatement(node) {\n return node.type === 'VariableDeclaration' && node.kind === 'var';\n}\n\n// #prod-VariableDeclaration\nexport function isVariableDeclaration(node) {\n return node.type === 'VariableDeclarator';\n}\n\n// #prod-EmptyStatement\nexport function isEmptyStatement(node) {\n return node.type === 'EmptyStatement';\n}\n\n// #prod-ExpressionStatement\nexport function isExpressionStatement(node) {\n return node.type === 'ExpressionStatement';\n}\n\n// #prod-IfStatement\nexport function isIfStatement(node) {\n return node.type === 'IfStatement';\n}\n\n// #prod-BreakableStatement\nexport function isBreakableStatement(node) {\n return isIterationStatement(node) || isSwitchStatement(node);\n}\n\n// #prod-IterationStatement\nexport function isIterationStatement(node) {\n // for-await-of is ForOfStatement with await = true\n return node.type === 'DoWhileStatement'\n || node.type === 'WhileStatement'\n || node.type === 'ForStatement'\n || node.type === 'ForInStatement'\n || node.type === 'ForOfStatement';\n}\n\n// Used in #prod-IterationStatement\nexport function isDoWhileStatement(node) {\n return node.type === 'DoWhileStatement';\n}\n\n// Used in #prod-IterationStatement\nexport function isWhileStatement(node) {\n return node.type === 'WhileStatement';\n}\n\n// Used in #prod-IterationStatement\nexport function isForStatement(node) {\n return node.type === 'ForStatement';\n}\n\n// Used in #prod-IterationStatement\nexport function isForStatementWithExpression(node) {\n return isForStatement(node) && (node.init === null || isExpression(node.init));\n}\n\n// Used in #prod-IterationStatement\nexport function isForStatementWithVariableStatement(node) {\n return isForStatement(node) && isVariableStatement(node.init);\n}\n\n// Used in #prod-IterationStatement\nexport function isForStatementWithLexicalDeclaration(node) {\n return isForStatement(node) && isLexicalDeclaration(node.init);\n}\n\n// Used in #prod-IterationStatement\nexport function isForInStatement(node) {\n return node.type === 'ForInStatement';\n}\n\n// Used in #prod-IterationStatement\n// This covers cases like for ({ a } in b), in which case the { a } is in fact\n// parsed as an ObjectLiteral per spec.\nexport function isForInStatementWithExpression(node) {\n return isForInStatement(node) && node.left.type !== 'VariableDeclaration';\n}\n\n// Used in #prod-IterationStatement\nexport function isForInStatementWithVarForBinding(node) {\n return isForInStatement(node) && isVariableStatement(node.left)\n && !node.left.declarations[0].init;\n}\n\n// Used in #prod-IterationStatement\nexport function isForInStatementWithForDeclaration(node) {\n return isForInStatement(node) && isForDeclaration(node.left);\n}\n\n// Used in #prod-IterationStatement\nexport function isForOfStatement(node) {\n return node.type === 'ForOfStatement';\n}\n\n// Used in #prod-IterationStatement\n// This covers cases like for ({ a } of b), in which case the { a } is in fact\n// parsed as an ObjectLiteral per spec.\nexport function isForOfStatementWithExpression(node) {\n return isForOfStatement(node) && node.left.type !== 'VariableDeclaration';\n}\n\n// Used in #prod-IterationStatement\nexport function isForOfStatementWithVarForBinding(node) {\n return isForOfStatement(node) && isVariableStatement(node.left)\n && !node.left.declarations[0].init;\n}\n\n// Used in #prod-IterationStatement\nexport function isForOfStatementWithForDeclaration(node) {\n return isForOfStatement(node) && isForDeclaration(node.left);\n}\n\n// #prod-ForBinding\nexport function isForBinding(node) {\n return isBindingIdentifier(node) || isBindingPattern(node);\n}\n\n// #prod-SwitchStatement\nexport function isSwitchStatement(node) {\n return node.type === 'SwitchStatement';\n}\n\nexport function isSwitchCase(node) {\n return node.type === 'SwitchCase';\n}\n\n// #prod-ContinueStatement\nexport function isContinueStatement(node) {\n return node.type === 'ContinueStatement';\n}\n\n// #prod-BreakStatement\nexport function isBreakStatement(node) {\n return node.type === 'BreakStatement';\n}\n\n// #prod-ReturnStatement\nexport function isReturnStatement(node) {\n return node.type === 'ReturnStatement';\n}\n\n// #prod-WithStatement\nexport function isWithStatement(node) {\n return node.type === 'WithStatement';\n}\n\n// #prod-LabelledStatement\nexport function isLabelledStatement(node) {\n return node.type === 'LabeledStatement'; // sic\n}\n\n// #prod-ThrowStatement\nexport function isThrowStatement(node) {\n return node.type === 'ThrowStatement';\n}\n\n// #prod-TryStatement\nexport function isTryStatement(node) {\n return node.type === 'TryStatement';\n}\n\n// Used in #prod-TryStatement\nexport function isTryStatementWithCatch(node) {\n return isTryStatement(node) && node.handler !== null;\n}\n\n// Used in #prod-TryStatement\nexport function isTryStatementWithFinally(node) {\n return isTryStatement(node) && node.finalizer !== null;\n}\n\n// #prod-DebuggerStatement\nexport function isDebuggerStatement(node) {\n return node.type === 'DebuggerStatement';\n}\n\n// #prod-Statement\nexport function isStatement(node) {\n return isBlockStatement(node)\n || isVariableStatement(node)\n || isEmptyStatement(node)\n || isExpressionStatement(node)\n || isIfStatement(node)\n || isBreakableStatement(node)\n || isContinueStatement(node)\n || isBreakStatement(node)\n || isReturnStatement(node)\n || isWithStatement(node)\n || isLabelledStatement(node)\n || isThrowStatement(node)\n || isTryStatement(node)\n || isDebuggerStatement(node);\n}\n\n// #prod-Declaration\nexport function isDeclaration(node) {\n return isHoistableDeclaration(node)\n || isClassDeclaration(node)\n || isLexicalDeclaration(node);\n}\n\n// #prod-HoistableDeclaration\n// The other kinds of HoistableDeclarations are grouped under\n// FunctionDeclaration in ESTree.\nexport function isHoistableDeclaration(node) {\n return node.type === 'FunctionDeclaration';\n}\n\n// #prod-FunctionDeclaration\nexport function isFunctionDeclaration(node) {\n return node.type === 'FunctionDeclaration'\n && !node.generator\n && !node.async;\n}\n\n// #prod-GeneratorDeclaration\nexport function isGeneratorDeclaration(node) {\n return node.type === 'FunctionDeclaration'\n && node.generator\n && !node.async;\n}\n\n// #prod-AsyncFunctionDeclaration\nexport function isAsyncFunctionDeclaration(node) {\n return node.type === 'FunctionDeclaration'\n && !node.generator\n && node.async;\n}\n\n// #prod-AsyncGeneratorDeclaration\nexport function isAsyncGeneratorDeclaration(node) {\n return node.type === 'FunctionDeclaration'\n && node.generator\n && node.async;\n}\n\n// #prod-ClassDeclaration\nexport function isClassDeclaration(node) {\n return node.type === 'ClassDeclaration';\n}\n\n// #prod-LexicalDeclaration\nexport function isLexicalDeclaration(node) {\n return node.type === 'VariableDeclaration' && (node.kind === 'let' || node.kind === 'const');\n}\n\n// #prod-StatementListItem\nexport function isStatementListItem(node) {\n return isStatement(node) || isDeclaration(node);\n}\n\n// #prod-ForDeclaration\nexport const isForDeclaration = isLexicalDeclaration;\n\n// #prod-LexicalBinding\nexport function isLexicalBinding(node) {\n return node.type === 'VariableDeclarator';\n}\n\n// Used in #prod-ImportDeclaration\n//\n// Note:\n// import {} from 'abc';\n// is treated the same as\n// import 'abc';\n// and this method returns false with such constructs.\nexport function isImportDeclarationWithClause(node) {\n return isImportDeclaration(node) && node.specifiers.length !== 0;\n}\n\n// Used in #prod-ImportDeclaration\n//\n// Note:\n// import {} from 'abc';\n// is treated the same as\n// import 'abc';\n// and this method returns true with such constructs.\nexport function isImportDeclarationWithSpecifierOnly(node) {\n return isImportDeclaration(node) && node.specifiers.length === 0;\n}\n\n// #prod-ImportDeclaration\nexport function isImportDeclaration(node) {\n return node.type === 'ImportDeclaration';\n}\n\n// #prod-ImportedDefaultBinding\nexport function isImportedDefaultBinding(node) {\n return node.type === 'ImportDefaultSpecifier';\n}\n\n// #prod-NameSpaceImport\nexport function isNameSpaceImport(node) {\n return node.type === 'ImportNamespaceSpecifier';\n}\n\n// #prod-ImportSpecifier\nexport function isImportSpecifier(node) {\n return node.type === 'ImportSpecifier';\n}\n\n// Used in #prod-ExportDeclaration\nexport function isExportDeclarationWithStar(node) {\n return node.type === 'ExportAllDeclaration';\n}\n\n// Used in #prod-ExportDeclaration\nexport function isExportDeclarationWithExportAndFrom(node) {\n return node.type === 'ExportNamedDeclaration'\n && node.declaration === null\n && node.source !== null;\n}\n\n// Used in #prod-ExportDeclaration\nexport function isExportDeclarationWithExport(node) {\n return node.type === 'ExportNamedDeclaration'\n && node.declaration === null\n && node.source === null;\n}\n\n// Used in #prod-ExportDeclaration\nexport function isExportDeclarationWithVariable(node) {\n return node.type === 'ExportNamedDeclaration'\n && node.declaration !== null\n && isVariableStatement(node.declaration);\n}\n\n// Used in #prod-ExportDeclaration\nexport function isExportDeclarationWithDeclaration(node) {\n return node.type === 'ExportNamedDeclaration'\n && node.declaration !== null\n && isDeclaration(node.declaration);\n}\n\n// Used in #prod-ExportDeclaration\nexport function isExportDeclarationWithDefaultAndHoistable(node) {\n return node.type === 'ExportDefaultDeclaration' && isHoistableDeclaration(node.declaration);\n}\n\n// Used in #prod-ExportDeclaration\nexport function isExportDeclarationWithDefaultAndClass(node) {\n return node.type === 'ExportDefaultDeclaration' && isClassDeclaration(node.declaration);\n}\n\n// Used in #prod-ExportDeclaration\nexport function isExportDeclarationWithDefaultAndExpression(node) {\n return node.type === 'ExportDefaultDeclaration' && isExpression(node.declaration);\n}\n\n// #prod-ExportDeclaration\nexport function isExportDeclaration(node) {\n return isExportDeclarationWithStar(node)\n || isExportDeclarationWithExportAndFrom(node)\n || isExportDeclarationWithExport(node)\n || isExportDeclarationWithVariable(node)\n || isExportDeclarationWithDeclaration(node)\n || isExportDeclarationWithDefaultAndHoistable(node)\n || isExportDeclarationWithDefaultAndClass(node)\n || isExportDeclarationWithDefaultAndExpression(node);\n}\n\n// 14.1.1 #sec-directive-prologues-and-the-use-strict-directive\nexport function directivePrologueContainsUseStrictDirective(nodes) {\n for (const node of nodes) {\n if (isExpressionStatement(node) && isStringLiteral(node.expression)) {\n Assert(typeof node.directive === 'string');\n if (node.directive === 'use strict') {\n return true;\n }\n } else {\n Assert(typeof node.directive !== 'string');\n return false;\n }\n }\n return false;\n}\n","import { surroundingAgent } from './engine.mjs';\nimport { Type, Value, Descriptor } from './value.mjs';\nimport { ToString, DefinePropertyOrThrow, CreateBuiltinFunction } from './abstract-ops/all.mjs';\nimport { X, AwaitFulfilledFunctions } from './completion.mjs';\n\nfunction convertValueForKey(key) {\n switch (Type(key)) {\n case 'String':\n return key.stringValue();\n case 'Number':\n if (key.numberValue() === 0 && Object.is(key.numberValue(), -0)) {\n return key;\n }\n return key.numberValue();\n default:\n return key;\n }\n}\n\nexport class ValueMap extends Map {\n constructor(init) {\n super();\n if (init !== null && init !== undefined) {\n for (const [k, v] of init) {\n this.set(convertValueForKey(k), v);\n }\n }\n }\n\n get(key) {\n return super.get(convertValueForKey(key));\n }\n\n set(key, value) {\n return super.set(convertValueForKey(key), value);\n }\n\n has(key) {\n return super.has(convertValueForKey(key));\n }\n\n delete(key) {\n return super.delete(convertValueForKey(key));\n }\n\n * keys() {\n for (const [key] of this) {\n yield key;\n }\n }\n\n * values() {\n for (const [, value] of this) {\n yield value;\n }\n }\n\n entries() {\n return this[Symbol.iterator]();\n }\n\n forEach(cb) {\n for (const [key, value] of this) {\n cb(value, key, this);\n }\n }\n\n * [Symbol.iterator]() {\n for (const [key, value] of super.entries()) {\n if (typeof key === 'string' || typeof key === 'number') {\n yield [new Value(key), value];\n } else {\n yield [key, value];\n }\n }\n }\n\n mark(m) {\n for (const [k, v] of this.entries()) {\n m(k);\n m(v);\n }\n }\n}\n\nexport class ValueSet extends Set {\n constructor(init) {\n super();\n if (init !== undefined && init !== null) {\n for (const item of init) {\n this.add(item);\n }\n }\n }\n\n add(item) {\n return super.add(convertValueForKey(item));\n }\n\n has(item) {\n return super.has(convertValueForKey(item));\n }\n\n delete(item) {\n return super.delete(convertValueForKey(item));\n }\n\n keys() {\n return this[Symbol.iterator]();\n }\n\n values() {\n return this[Symbol.iterator]();\n }\n\n * [Symbol.iterator]() {\n for (const key of super.values()) {\n if (typeof key === 'string' || typeof key === 'number') {\n yield new Value(key);\n } else {\n yield key;\n }\n }\n }\n\n mark(m) {\n for (const v of this.values()) {\n m(v);\n }\n }\n}\n\nexport class OutOfRange extends RangeError {\n constructor(fn, detail) {\n super(`${fn}() argument out of range`);\n\n this.detail = detail;\n }\n}\n\nexport function unwind(iterator, maxSteps = 1) {\n let steps = 0;\n while (true) {\n const { done, value } = iterator.next('Unwind');\n if (done) {\n return value;\n }\n steps += 1;\n if (steps > maxSteps) {\n throw new RangeError('Max steps exceeded');\n }\n }\n}\n\nconst kSafeToResume = Symbol('kSameToResume');\n\nexport function handleInResume(fn, ...args) {\n const bound = () => fn(...args);\n bound[kSafeToResume] = true;\n return bound;\n}\n\nexport function resume(context, completion) {\n const { value } = context.codeEvaluationState.next(completion);\n if (typeof value === 'function' && value[kSafeToResume] === true) {\n return X(value());\n }\n return value;\n}\n\nexport class CallSite {\n constructor(context) {\n this.context = context;\n this.lastNode = null;\n this.constructCall = false;\n }\n\n clone(context = this.context) {\n const c = new CallSite(context);\n c.lastNode = this.lastNode;\n c.constructCall = this.constructCall;\n return c;\n }\n\n isTopLevel() {\n return this.context.Function === Value.null;\n }\n\n isConstructCall() {\n return this.constructCall;\n }\n\n isAsync() {\n if (this.context.Function !== Value.null) {\n return this.context.Function.ECMAScriptCode && this.context.Function.ECMAScriptCode.async;\n }\n return false;\n }\n\n isNative() {\n return !!this.context.Function.nativeFunction;\n }\n\n getFunctionName() {\n if (this.context.Function !== Value.null) {\n const name = this.context.Function.properties.get(new Value('name'));\n if (name) {\n return X(ToString(name.Value)).stringValue();\n }\n }\n return null;\n }\n\n getSpecifier() {\n if (this.context.ScriptOrModule !== Value.null) {\n return this.context.ScriptOrModule.HostDefined.specifier;\n }\n return null;\n }\n\n setLocation(node) {\n this.lastNode = node;\n }\n\n get lineNumber() {\n if (this.lastNode) {\n return this.lastNode.loc.start.line;\n }\n return null;\n }\n\n get columnNumber() {\n if (this.lastNode) {\n return this.lastNode.loc.start.column;\n }\n return null;\n }\n\n loc() {\n if (this.isNative()) {\n return 'native';\n }\n let out = '';\n const specifier = this.getSpecifier();\n if (specifier) {\n out += specifier;\n } else {\n out += '';\n }\n if (this.lineNumber !== null) {\n out += `:${this.lineNumber}`;\n if (this.columnNumber !== null) {\n out += `:${this.columnNumber}`;\n }\n }\n return out.trim();\n }\n\n toString() {\n const isAsync = this.isAsync();\n const functionName = this.getFunctionName();\n const isConstructCall = this.isConstructCall();\n const isMethodCall = !isConstructCall && !this.isTopLevel();\n\n let string = isAsync ? 'async ' : '';\n\n if (isConstructCall) {\n string += 'new ';\n }\n\n if (isMethodCall || isConstructCall) {\n if (functionName) {\n string += functionName;\n } else {\n string += '';\n }\n } else if (functionName) {\n string += functionName;\n } else {\n return `${string}${this.loc()}`;\n }\n\n return `${string} (${this.loc()})`;\n }\n}\n\nfunction captureAsyncStack(stack) {\n let promise = stack[0].context.promiseCapability.Promise;\n for (let i = 0; i < 10; i += 1) {\n if (promise.PromiseFulfillReactions.length !== 1) {\n return;\n }\n const [reaction] = promise.PromiseFulfillReactions;\n if (reaction.Handler.nativeFunction === AwaitFulfilledFunctions) {\n const asyncContext = reaction.Handler.AsyncContext;\n stack.push(asyncContext.callSite.clone());\n if ('PromiseState' in asyncContext.promiseCapability.Promise) {\n promise = asyncContext.promiseCapability.Promise;\n } else {\n return;\n }\n } else if (reaction.Capability !== Value.undefined) {\n if ('PromiseState' in reaction.Capability.Promise) {\n promise = reaction.Capability.Promise;\n } else {\n return;\n }\n }\n }\n}\n\nexport function captureStack(O) {\n const stack = [];\n for (let i = surroundingAgent.executionContextStack.length - 2; i >= 0; i -= 1) {\n const e = surroundingAgent.executionContextStack[i];\n if (e.VariableEnvironment === undefined && e.Function === Value.null) {\n break;\n }\n stack.push(e.callSite.clone());\n if (e.callSite.isAsync()) {\n i -= 1; // skip original execution context which has no useful information.\n }\n }\n\n if (stack.length > 0 && stack[0].context.promiseCapability) {\n captureAsyncStack(stack);\n }\n\n let cache = null;\n\n X(DefinePropertyOrThrow(O, new Value('stack'), Descriptor({\n Get: CreateBuiltinFunction(() => {\n if (cache === null) {\n let errorString = X(ToString(O)).stringValue();\n stack.forEach((s) => {\n errorString = `${errorString}\\n at ${s.toString()}`;\n });\n cache = new Value(errorString);\n }\n return cache;\n }, []),\n Set: CreateBuiltinFunction(([value = Value.undefined]) => {\n cache = value;\n return Value.undefined;\n }, []),\n Enumerable: Value.false,\n Configurable: Value.true,\n })));\n}\n","import { surroundingAgent } from '../engine.mjs';\nimport {\n isAdditiveExpressionWithMinus,\n isAdditiveExpressionWithPlus,\n} from '../ast.mjs';\nimport {\n GetValue,\n ToNumeric,\n ToPrimitive,\n ToString,\n} from '../abstract-ops/all.mjs';\nimport { Evaluate } from '../evaluator.mjs';\nimport { Q } from '../completion.mjs';\nimport {\n Type,\n TypeNumeric,\n Value,\n} from '../value.mjs';\nimport { OutOfRange } from '../helpers.mjs';\n\nexport function EvaluateBinopValues_AdditiveExpression_Plus(lval, rval) {\n const lprim = Q(ToPrimitive(lval));\n const rprim = Q(ToPrimitive(rval));\n if (Type(lprim) === 'String' || Type(rprim) === 'String') {\n const lstr = Q(ToString(lprim));\n const rstr = Q(ToString(rprim));\n return new Value(lstr.stringValue() + rstr.stringValue());\n }\n const lnum = Q(ToNumeric(lprim));\n const rnum = Q(ToNumeric(rprim));\n if (Type(lnum) !== Type(rnum)) {\n return surroundingAgent.Throw('TypeError', 'CannotMixBigInts');\n }\n const T = TypeNumeric(lnum);\n return T.add(lnum, rnum);\n}\n\n// 12.8.3.1 #sec-addition-operator-plus-runtime-semantics-evaluation\n// AdditiveExpression : AdditiveExpression + MultiplicativeExpression\nfunction* Evaluate_AdditiveExpression_Plus(AdditiveExpression, MultiplicativeExpression) {\n const lref = yield* Evaluate(AdditiveExpression);\n const lval = Q(GetValue(lref));\n const rref = yield* Evaluate(MultiplicativeExpression);\n const rval = Q(GetValue(rref));\n return EvaluateBinopValues_AdditiveExpression_Plus(lval, rval);\n}\n\nexport function EvaluateBinopValues_AdditiveExpression_Minus(lval, rval) {\n const lnum = Q(ToNumeric(lval));\n const rnum = Q(ToNumeric(rval));\n if (Type(lnum) !== Type(rnum)) {\n return surroundingAgent.Throw('TypeError', 'CannotMixBigInts');\n }\n const T = TypeNumeric(lnum);\n return T.subtract(lnum, rnum);\n}\n\n// 12.8.4.1 #sec-subtraction-operator-minus-runtime-semantics-evaluation\nfunction* Evaluate_AdditiveExpression_Minus(\n AdditiveExpression, MultiplicativeExpression,\n) {\n const lref = yield* Evaluate(AdditiveExpression);\n const lval = Q(GetValue(lref));\n const rref = yield* Evaluate(MultiplicativeExpression);\n const rval = Q(GetValue(rref));\n return EvaluateBinopValues_AdditiveExpression_Minus(lval, rval);\n}\n\nexport function* Evaluate_AdditiveExpression(AdditiveExpression) {\n switch (true) {\n case isAdditiveExpressionWithPlus(AdditiveExpression):\n return yield* Evaluate_AdditiveExpression_Plus(\n AdditiveExpression.left, AdditiveExpression.right,\n );\n case isAdditiveExpressionWithMinus(AdditiveExpression):\n return yield* Evaluate_AdditiveExpression_Minus(\n AdditiveExpression.left, AdditiveExpression.right,\n );\n\n default:\n throw new OutOfRange('Evaluate_AdditiveExpression', AdditiveExpression);\n }\n}\n","import { Evaluate } from '../evaluator.mjs';\nimport { Q } from '../completion.mjs';\nimport {\n isExpression,\n isNoSubstitutionTemplate,\n isSubstitutionTemplate,\n isTemplateLiteral,\n unrollTemplateLiteral,\n} from '../ast.mjs';\nimport { OutOfRange } from '../helpers.mjs';\nimport {\n Assert,\n GetIterator,\n GetValue,\n IteratorStep,\n IteratorValue,\n} from '../abstract-ops/all.mjs';\nimport { Value } from '../value.mjs';\nimport { GetTemplateObject } from './all.mjs';\n\n// 12.2.9.5 #sec-runtime-semantics-substitutionevaluation\n// TemplateSpans :\n// TemplateTail\n// TemplateMiddleList TemplateTail\n//\n// TemplateMiddleList :\n// TemplateMiddle Expression\n// TemplateMiddleList TemplateMiddle Expression\nfunction* SubstitutionEvaluation_TemplateSpans(TemplateSpans) {\n const preceding = [];\n for (let i = 1; i < TemplateSpans.length; i += 2) {\n const Expression = TemplateSpans[i];\n const nextRef = yield* Evaluate(Expression);\n const next = Q(GetValue(nextRef));\n preceding.push(next);\n }\n return preceding;\n}\n\n// 12.2.9.3 #sec-template-literals-runtime-semantics-argumentlistevaluation\n// TemplateLiteral : NoSubstitutionTemplate\n//\n// https://github.com/tc39/ecma262/pull/1402\n// TemplateLiteral : SubstitutionTemplate\nexport function* ArgumentListEvaluation_TemplateLiteral(TemplateLiteral) {\n switch (true) {\n case isNoSubstitutionTemplate(TemplateLiteral): {\n const templateLiteral = TemplateLiteral;\n const siteObj = GetTemplateObject(templateLiteral);\n return [siteObj];\n }\n\n case isSubstitutionTemplate(TemplateLiteral): {\n const templateLiteral = TemplateLiteral;\n const siteObj = GetTemplateObject(templateLiteral);\n const [/* TemplateHead */, first/* Expression */, ...rest/* TemplateSpans */] = unrollTemplateLiteral(templateLiteral);\n const firstSubRef = yield* Evaluate(first);\n const firstSub = Q(GetValue(firstSubRef));\n const restSub = Q(yield* SubstitutionEvaluation_TemplateSpans(rest));\n Assert(Array.isArray(restSub));\n return [siteObj, firstSub, ...restSub];\n }\n\n default:\n throw new OutOfRange('ArgumentListEvaluation_TemplateLiteral', TemplateLiteral);\n }\n}\n\n// 12.3.6.1 #sec-argument-lists-runtime-semantics-argumentlistevaluation\n// Arguments : `(` `)`\n// ArgumentList :\n// AssignmentExpression\n// `...` AssignmentExpression\n// ArgumentList `,` AssignmentExpression\n// ArgumentList `,` `...` AssignmentExpression\n//\n// (implicit)\n// Arguments :\n// `(` ArgumentList `)`\n// `(` ArgumentList `,` `)`\nexport function* ArgumentListEvaluation_Arguments(Arguments) {\n const precedingArgs = [];\n for (const AssignmentExpressionOrSpreadElement of Arguments) {\n if (AssignmentExpressionOrSpreadElement.type === 'SpreadElement') {\n const AssignmentExpression = AssignmentExpressionOrSpreadElement.argument;\n const spreadRef = yield* Evaluate(AssignmentExpression);\n const spreadObj = Q(GetValue(spreadRef));\n const iteratorRecord = Q(GetIterator(spreadObj));\n while (true) {\n const next = Q(IteratorStep(iteratorRecord));\n if (next === Value.false) {\n break;\n }\n const nextArg = Q(IteratorValue(next));\n precedingArgs.push(nextArg);\n }\n } else {\n const AssignmentExpression = AssignmentExpressionOrSpreadElement;\n Assert(isExpression(AssignmentExpression));\n const ref = yield* Evaluate(AssignmentExpression);\n const arg = Q(GetValue(ref));\n precedingArgs.push(arg);\n }\n }\n return precedingArgs;\n}\n\nexport function ArgumentListEvaluation(ArgumentsOrTemplateLiteral) {\n switch (true) {\n case isTemplateLiteral(ArgumentsOrTemplateLiteral):\n return ArgumentListEvaluation_TemplateLiteral(ArgumentsOrTemplateLiteral);\n\n case Array.isArray(ArgumentsOrTemplateLiteral):\n return ArgumentListEvaluation_Arguments(ArgumentsOrTemplateLiteral);\n\n default:\n throw new OutOfRange('ArgumentListEvaluation', ArgumentsOrTemplateLiteral);\n }\n}\n","import {\n ArrayCreate,\n CreateDataPropertyOrThrow,\n GetIterator,\n GetValue,\n IteratorStep,\n IteratorValue,\n Set,\n ToString,\n ToUint32,\n} from '../abstract-ops/all.mjs';\nimport {\n isExpression,\n isSpreadElement,\n} from '../ast.mjs';\nimport { Value } from '../value.mjs';\nimport { Q, X } from '../completion.mjs';\nimport { Evaluate } from '../evaluator.mjs';\nimport { OutOfRange } from '../helpers.mjs';\n\nfunction* ArrayAccumulation_SpreadElement(SpreadElement, array, nextIndex) {\n const spreadRef = yield* Evaluate(SpreadElement.argument);\n const spreadObj = Q(GetValue(spreadRef));\n const iteratorRecord = Q(GetIterator(spreadObj));\n while (true) {\n const next = Q(IteratorStep(iteratorRecord));\n if (next === Value.false) {\n return nextIndex;\n }\n const nextValue = Q(IteratorValue(next));\n const nextIndexStr = X(ToString(new Value(nextIndex)));\n X(CreateDataPropertyOrThrow(array, nextIndexStr, nextValue));\n nextIndex += 1;\n }\n}\n\nfunction* ArrayAccumulation_AssignmentExpression(AssignmentExpression, array, nextIndex) {\n const initResult = yield* Evaluate(AssignmentExpression);\n const initValue = Q(GetValue(initResult));\n const initIndex = X(ToString(new Value(nextIndex)));\n X(CreateDataPropertyOrThrow(array, initIndex, initValue));\n return nextIndex + 1;\n}\n\nfunction* ArrayAccumulation(ElementList, array, nextIndex) {\n let postIndex = nextIndex;\n for (const element of ElementList) {\n switch (true) {\n case !element:\n // Elision\n postIndex += 1;\n break;\n\n case isExpression(element):\n postIndex = Q(yield* ArrayAccumulation_AssignmentExpression(element, array, postIndex));\n break;\n\n case isSpreadElement(element):\n postIndex = Q(yield* ArrayAccumulation_SpreadElement(element, array, postIndex));\n break;\n\n default:\n throw new OutOfRange('ArrayAccumulation', element);\n }\n }\n return postIndex;\n}\n\n// 12.2.5.3 #sec-array-initializer-runtime-semantics-evaluation\n// ArrayLiteral :\n// `[` Elision `]`\n// `[` ElementList `]`\n// `[` ElementList `,` Elision `]`\nexport function* Evaluate_ArrayLiteral(ArrayLiteral) {\n const array = X(ArrayCreate(new Value(0)));\n const len = Q(yield* ArrayAccumulation(ArrayLiteral.elements, array, 0));\n X(Set(array, new Value('length'), ToUint32(new Value(len)), Value.false));\n // NOTE: The above Set cannot fail because of the nature of the object returned by ArrayCreate.\n return array;\n}\n","import {\n surroundingAgent,\n} from '../engine.mjs';\nimport { OrdinaryFunctionCreate, GetValue, sourceTextMatchedBy } from '../abstract-ops/all.mjs';\nimport { Q, X, ReturnCompletion } from '../completion.mjs';\nimport { Evaluate } from '../evaluator.mjs';\n\n// #sec-arrow-function-definitions-runtime-semantics-evaluation\n// ArrowFunction : ArrowParameters `=>` ConciseBody\nexport function Evaluate_ArrowFunction(ArrowFunction) {\n const { params: ArrowParameters } = ArrowFunction;\n const scope = surroundingAgent.runningExecutionContext.LexicalEnvironment;\n const parameters = ArrowParameters;\n const closure = X(OrdinaryFunctionCreate(surroundingAgent.intrinsic('%Function.prototype%'), parameters, ArrowFunction, 'lexical-this', scope));\n closure.SourceText = sourceTextMatchedBy(ArrowFunction);\n return closure;\n}\n\n// #sec-arrow-function-definitions-runtime-semantics-evaluation\n// ExpressionBody : AssignmentExpression\nexport function* Evaluate_ExpressionBody(ExpressionBody) {\n const AssignmentExpression = ExpressionBody;\n // 1. Let exprRef be the result of evaluating |AssignmentExpression|.\n const exprRef = yield* Evaluate(AssignmentExpression);\n // 2. Let exprValue be ? GetValue(exprRef).\n const exprValue = Q(GetValue(exprRef));\n // 3. Return Completion { [[Type]]: return, [[Value]]: exprValue, [[Target]]: empty }.\n return new ReturnCompletion(exprValue);\n}\n","import {\n isArrayBindingPattern,\n isBindingElement,\n isBindingIdentifier,\n isBindingIdentifierAndInitializer,\n isBindingPattern,\n isBindingPatternAndInitializer,\n isBindingProperty,\n isBindingPropertyWithColon,\n isBindingPropertyWithSingleNameBinding,\n isBindingRestElement,\n isBindingRestProperty,\n isClassDeclaration,\n isDeclaration,\n isExportDeclaration,\n isExportDeclarationWithDeclaration,\n isExportDeclarationWithDefaultAndClass,\n isExportDeclarationWithDefaultAndExpression,\n isExportDeclarationWithDefaultAndHoistable,\n isExportDeclarationWithExport,\n isExportDeclarationWithExportAndFrom,\n isExportDeclarationWithStar,\n isExportDeclarationWithVariable,\n isFormalParameter,\n isFunctionRestParameter,\n isHoistableDeclaration,\n isImportDeclaration,\n isImportDeclarationWithClause,\n isImportDeclarationWithSpecifierOnly,\n isLexicalDeclaration,\n isObjectBindingPattern,\n isSingleNameBinding,\n} from '../ast.mjs';\nimport { OutOfRange } from '../helpers.mjs';\n\n// 12.1.2 #sec-identifiers-static-semantics-boundnames\n// BindingIdentifier :\n// Identifier\n// `yield`\n// `await`\nexport function BoundNames_BindingIdentifier(BindingIdentifier) {\n return [BindingIdentifier.name];\n}\n\n// 13.3.1.2 #sec-let-and-const-declarations-static-semantics-boundnames\n// LexicalDeclaration : LetOrConst BindingList `;`\n// BindingList : BindingList `,` LexicalBinding\n// LexicalBinding :\n// BindingIdentifier Initializer\n// BindingPattern Initializer\n//\n// (implicit)\n// BindingList : LexicalBinding\nexport function BoundNames_LexicalDeclaration(LexicalDeclaration) {\n const names = [];\n for (const declarator of LexicalDeclaration.declarations) {\n switch (true) {\n case isBindingIdentifier(declarator.id):\n names.push(...BoundNames_BindingIdentifier(declarator.id));\n break;\n case isBindingPattern(declarator.id):\n names.push(...BoundNames_BindingPattern(declarator.id));\n break;\n default:\n throw new OutOfRange('BoundNames_LexicalDeclaration', LexicalDeclaration);\n }\n }\n return names;\n}\n\n// 13.3.2.1 #sec-variable-statement-static-semantics-boundnames\n// VariableDeclarationList : VariableDeclarationList `,` VariableDeclaration\n//\n// (implicit)\n// VariableDeclarationList : VariableDeclaration\nexport function BoundNames_VariableDeclarationList(VariableDeclarationList) {\n const names = [];\n for (const VariableDeclaration of VariableDeclarationList) {\n names.push(...BoundNames_VariableDeclaration(VariableDeclaration));\n }\n return names;\n}\n\n// 13.3.2.1 #sec-variable-statement-static-semantics-boundnames\n// VariableDeclaration :\n// BindingIdentifier Initializer\n// BindingPattern Initializer\nexport function BoundNames_VariableDeclaration(VariableDeclaration) {\n switch (true) {\n // FIXME: This condition is a hack, formalize it\n case VariableDeclaration.id === undefined:\n return [VariableDeclaration.name];\n case isBindingIdentifier(VariableDeclaration.id):\n return BoundNames_BindingIdentifier(VariableDeclaration.id);\n case isBindingPattern(VariableDeclaration.id):\n return BoundNames_BindingPattern(VariableDeclaration.id);\n default:\n throw new OutOfRange('BoundNames_VariableDeclaration', VariableDeclaration);\n }\n}\n\n// (implicit)\n// VariableStatement : `var` VariableDeclarationList `;`\nexport function BoundNames_VariableStatement(VariableStatement) {\n return BoundNames_VariableDeclarationList(VariableStatement.declarations);\n}\n\n// 13.3.3.1 #sec-destructuring-binding-patterns-static-semantics-boundnames\n// SingleNameBinding : BindingIdentifier Initializer\n//\n// (implicit)\n// SingleNameBinding : BindingIdentifier\nexport function BoundNames_SingleNameBinding(SingleNameBinding) {\n switch (true) {\n case isBindingIdentifier(SingleNameBinding):\n return BoundNames_BindingIdentifier(SingleNameBinding);\n case isBindingIdentifierAndInitializer(SingleNameBinding):\n return BoundNames_BindingIdentifier(SingleNameBinding.left);\n default:\n throw new OutOfRange('BoundNames_SingleNameBinding', SingleNameBinding);\n }\n}\n\n// 13.3.3.1 #sec-destructuring-binding-patterns-static-semantics-boundnames\n// BindingElement : BindingPattern Initializer\n//\n// (implicit)\n// BindingElement :\n// SingleNameBinding\n// BindingPattern\nexport function BoundNames_BindingElement(BindingElement) {\n switch (true) {\n case isSingleNameBinding(BindingElement):\n return BoundNames_SingleNameBinding(BindingElement);\n case isBindingPattern(BindingElement):\n return BoundNames_BindingPattern(BindingElement);\n case isBindingPatternAndInitializer(BindingElement):\n return BoundNames_BindingPattern(BindingElement.left);\n default:\n throw new OutOfRange('BoundNames_BindingElement', BindingElement);\n }\n}\n\n// (implicit)\n// BindingRestElement :\n// `...` BindingIdentifier\n// `...` BindingPattern\nexport function BoundNames_BindingRestElement(BindingRestElement) {\n switch (true) {\n case isBindingIdentifier(BindingRestElement.argument):\n return BoundNames_BindingIdentifier(BindingRestElement.argument);\n case isBindingPattern(BindingRestElement.argument):\n return BoundNames_BindingPattern(BindingRestElement.argument);\n default:\n throw new OutOfRange('BoundNames_BindingRestElement argument', BindingRestElement.argument);\n }\n}\n\n// 13.3.3.1 #sec-destructuring-binding-patterns-static-semantics-boundnames\n// ArrayBindingPattern :\n// `[` Elision `]`\n// `[` Elision BindingRestElement `]`\n// `[` BindingElementList `,` Elision `]`\n// `[` BindingElementList `,` Elision BindingRestElement `]`\n// BindingElementList : BindingElementList `,` BindingElisionElement\n// BindingElisionElement : Elision BindingElement\nexport function BoundNames_ArrayBindingPattern(ArrayBindingPattern) {\n const names = [];\n for (const BindingElisionElementOrBindingRestElement of ArrayBindingPattern.elements) {\n switch (true) {\n case BindingElisionElementOrBindingRestElement === null:\n // This is an elision.\n break;\n\n case isBindingElement(BindingElisionElementOrBindingRestElement): {\n const BindingElement = BindingElisionElementOrBindingRestElement;\n names.push(...BoundNames_BindingElement(BindingElement));\n break;\n }\n case isBindingRestElement(BindingElisionElementOrBindingRestElement): {\n const BindingRestElement = BindingElisionElementOrBindingRestElement;\n names.push(...BoundNames_BindingRestElement(BindingRestElement));\n break;\n }\n default:\n throw new OutOfRange('BoundNames_ArrayBindingPattern element', BindingElisionElementOrBindingRestElement);\n }\n }\n return names;\n}\n\n// 13.3.3.1 #sec-destructuring-binding-patterns-static-semantics-boundnames\n// BindingProperty : PropertyName `:` BindingElement\n//\n// (implicit)\n// BindingProperty : SingleNameBinding\nexport function BoundNames_BindingProperty(BindingProperty) {\n switch (true) {\n case isBindingPropertyWithSingleNameBinding(BindingProperty):\n return BoundNames_SingleNameBinding(BindingProperty.value);\n case isBindingPropertyWithColon(BindingProperty):\n return BoundNames_BindingElement(BindingProperty.value);\n default:\n throw new OutOfRange('BoundNames_BindingProperty', BindingProperty);\n }\n}\n\n// (implicit)\n// BindingRestProperty : `...` BindingIdentifier\nexport function BoundNames_BindingRestProperty(BindingRestProperty) {\n if (!isBindingIdentifier(BindingRestProperty.argument)) {\n throw new OutOfRange('BoundNames_BindingRestProperty argument', BindingRestProperty.argument);\n }\n return BoundNames_BindingIdentifier(BindingRestProperty.argument);\n}\n\n// 13.3.3.1 #sec-destructuring-binding-patterns-static-semantics-boundnames\n// ObjectBindingPattern :\n// `{` `}`\n// `{` BindingRestProperty `}`\n// BindingPropertyList : BindingPropertyList `,` BindingProperty\n//\n// (implicit)\n// ObjectBindingPattern :\n// `{` BindingPropertyList `}`\n// `{` BindingPropertyList `,` `}`\n// `{` BindingPropertyList `,` BindingRestProperty `}`\nfunction BoundNames_ObjectBindingPattern(ObjectBindingPattern) {\n const names = [];\n for (const BindingPropertyOrBindingRestProperty of ObjectBindingPattern.properties) {\n switch (true) {\n case isBindingProperty(BindingPropertyOrBindingRestProperty): {\n const BindingProperty = BindingPropertyOrBindingRestProperty;\n names.push(...BoundNames_BindingProperty(BindingProperty));\n break;\n }\n case isBindingRestProperty(BindingPropertyOrBindingRestProperty): {\n const BindingRestProperty = BindingPropertyOrBindingRestProperty;\n names.push(...BoundNames_BindingRestProperty(BindingRestProperty));\n break;\n }\n default:\n throw new OutOfRange('BoundNames_ObjectBindingPattern property', BindingPropertyOrBindingRestProperty);\n }\n }\n return names;\n}\n\n// (implicit)\n// BindingPattern :\n// ObjectBindingPattern\n// ArrayBindingPattern\nfunction BoundNames_BindingPattern(BindingPattern) {\n switch (true) {\n case isObjectBindingPattern(BindingPattern):\n return BoundNames_ObjectBindingPattern(BindingPattern);\n case isArrayBindingPattern(BindingPattern):\n return BoundNames_ArrayBindingPattern(BindingPattern);\n default:\n throw new OutOfRange('BoundNames_BindingPattern', BindingPattern);\n }\n}\n\n// 13.7.5.2 #sec-for-in-and-for-of-statements-static-semantics-boundnames\n// ForDeclaration : LetOrConst ForBinding\nexport function BoundNames_ForDeclaration(ForDeclaration) {\n const ForBinding = ForDeclaration.declarations[0].id;\n return BoundNames_ForBinding(ForBinding);\n}\n\nfunction BoundNames_BindingIdentifierOrBindingPattern(\n targetTypeForErrorMessage,\n BindingIdentifierOrBindingPattern,\n) {\n switch (true) {\n case isBindingIdentifier(BindingIdentifierOrBindingPattern):\n return BoundNames_BindingIdentifier(BindingIdentifierOrBindingPattern);\n case isBindingPattern(BindingIdentifierOrBindingPattern):\n return BoundNames_BindingPattern(BindingIdentifierOrBindingPattern);\n default:\n throw new OutOfRange(`BoundNames_BindingIdentifierOrBindingPattern ${targetTypeForErrorMessage}`, BindingIdentifierOrBindingPattern);\n }\n}\n\n// (implicit)\n// ForBinding :\n// BindingIdentifier\n// BindingPattern\nexport function BoundNames_ForBinding(node) {\n return BoundNames_BindingIdentifierOrBindingPattern('ForBinding', node);\n}\n\n// (implicit)\n// CatchParameter :\n// BindingIdentifier\n// BindingPattern\nexport function BoundNames_CatchParameter(node) {\n return BoundNames_BindingIdentifierOrBindingPattern('CatchParameter', node);\n}\n\n// (implicit)\n// FormalParameter : BindingElement\nexport const BoundNames_FormalParameter = BoundNames_BindingElement;\n\n// (implicit)\n// FunctionRestParameter : BindingRestElement\nexport const BoundNames_FunctionRestParameter = BoundNames_BindingRestElement;\n\n// 14.1.3 #sec-function-definitions-static-semantics-boundnames\n// FormalParameters :\n// [empty]\n// FormalParameterList `,` FunctionRestParameter\n//\n// FormalParameterList :\n// FormalParameterList `,` FormalParameter\n//\n// (implicit)\n// FormalParameters :\n// FunctionRestParameter\n// FormalParameterList\n// FormalParameterList `,`\n//\n// FormalParameterList : FormalParameter\nexport function BoundNames_FormalParameters(FormalParameters) {\n const names = [];\n for (const FormalParameterOrFunctionRestParameter of FormalParameters) {\n switch (true) {\n case isFormalParameter(FormalParameterOrFunctionRestParameter):\n names.push(...BoundNames_FormalParameter(FormalParameterOrFunctionRestParameter));\n break;\n\n case isFunctionRestParameter(FormalParameterOrFunctionRestParameter):\n names.push(...BoundNames_FunctionRestParameter(FormalParameterOrFunctionRestParameter));\n break;\n\n default:\n throw new OutOfRange('BoundNames_FormalParameters element', FormalParameterOrFunctionRestParameter);\n }\n }\n return names;\n}\n\n// 14.1.3 #sec-function-definitions-static-semantics-boundnames\n// FunctionDeclaration :\n// `function` BindingIdentifier `(` FormalParameters `)` `{` FunctionBody `}`\n// `function` `(` FormalParameters `)` `{` FunctionBody `}`\n//\n// 14.4.2 #sec-generator-function-definitions-static-semantics-boundnames\n// GeneratorDeclaration :\n// `function` `*` BindingIdentifier `(` FormalParameters `)` `{` GeneratorBody `}`\n// `function` `*` `(` FormalParameters `)` `{` GeneratorBody `}`\n//\n// 14.5.2 #sec-async-generator-function-definitions-static-semantics-boundnames\n// AsyncGeneratorDeclaration :\n// `async` `function` `*` BindingIdentifier `(` FormalParameters `)` `{` AsyncGeneratorBody `}`\n// `async` `function` `*` `(` FormalParameters `)` `{` AsyncGeneratorBody `}`\n//\n// 14.7.2 #sec-async-function-definitions-static-semantics-BoundNames\n// AsyncFunctionDeclaration :\n// `async` [no LineTerminator here] `function` BindingIdentifier `(` FormalParameters `)`\n// `{` AsyncFunctionBody `}`\n// `async` [no LineTerminator here] `function` `(` FormalParameters `)`\n// `{` AsyncFunctionBody `}`\n//\n// (implicit)\n// HoistableDeclaration :\n// FunctionDeclaration\n// GeneratorDeclaration\n// AsyncFunctionDeclaration\n// AsyncGeneratorDeclaration\nexport function BoundNames_HoistableDeclaration(HoistableDeclaration) {\n if (HoistableDeclaration.id === null) {\n return ['*default*'];\n }\n return BoundNames_BindingIdentifier(HoistableDeclaration.id);\n}\n\nexport const BoundNames_FunctionDeclaration = BoundNames_HoistableDeclaration;\nexport const BoundNames_GeneratorDeclaration = BoundNames_HoistableDeclaration;\nexport const BoundNames_AsyncFunctionDeclaration = BoundNames_HoistableDeclaration;\nexport const BoundNames_AsyncGeneratorDeclaration = BoundNames_HoistableDeclaration;\n\n// 14.6.2 #sec-class-definitions-static-semantics-boundnames\n// ClassDeclaration :\n// `class` BindingIdentifier ClassTail\n// `class` ClassTail\nexport function BoundNames_ClassDeclaration(ClassDeclaration) {\n if (ClassDeclaration.id === null) {\n return ['*default*'];\n }\n return BoundNames_BindingIdentifier(ClassDeclaration.id);\n}\n\n// (implicit)\n// Declaration :\n// HoistableDeclaration\n// ClassDeclaration\n// LexicalDeclaration\nexport function BoundNames_Declaration(Declaration) {\n switch (true) {\n case isHoistableDeclaration(Declaration):\n return BoundNames_HoistableDeclaration(Declaration);\n case isClassDeclaration(Declaration):\n return BoundNames_ClassDeclaration(Declaration);\n case isLexicalDeclaration(Declaration):\n return BoundNames_LexicalDeclaration(Declaration);\n default:\n throw new OutOfRange('BoundNames_Declaration', Declaration);\n }\n}\n\n// (implict)\n// ImportedBinding : BindingIdentifier\nexport const BoundNames_ImportedBinding = BoundNames_BindingIdentifier;\n\n// 15.2.2.2 #sec-imports-static-semantics-boundnames\n// ImportDeclaration :\n// `import` ImportClause FromClause `;`\n// `import` ModuleSpecifier `;`\nexport function BoundNames_ImportDeclaration(ImportDeclaration) {\n switch (true) {\n case isImportDeclarationWithClause(ImportDeclaration):\n // return BoundNames_ImportClause(ImportDeclaration.specifiers);\n return ImportDeclaration.specfiers.map((s) => s.local);\n\n case isImportDeclarationWithSpecifierOnly(ImportDeclaration):\n return [];\n\n default:\n throw new OutOfRange('BoundNames_ImportDeclaration', ImportDeclaration);\n }\n}\n\n// 15.2.3.2 #sec-exports-static-semantics-boundnames\n// ExportDeclaration :\n// `export` `*` FromClause `;`\n// `export` ExportClause FromClause `;`\n// `export` ExportClause `;`\n// `export` VariableStatement\n// `export` Declaration\n// `export` `default` HoistableDeclaration\n// `export` `default` ClassDeclaration\n// `export` `default` AssignmentExpression `;`\nexport function BoundNames_ExportDeclaration(ExportDeclaration) {\n switch (true) {\n case isExportDeclarationWithStar(ExportDeclaration):\n case isExportDeclarationWithExportAndFrom(ExportDeclaration):\n case isExportDeclarationWithExport(ExportDeclaration):\n return [];\n case isExportDeclarationWithVariable(ExportDeclaration):\n return BoundNames_VariableStatement(ExportDeclaration.declaration);\n case isExportDeclarationWithDeclaration(ExportDeclaration):\n return BoundNames_Declaration(ExportDeclaration.declaration);\n case isExportDeclarationWithDefaultAndHoistable(ExportDeclaration): {\n const declarationNames = BoundNames_HoistableDeclaration(ExportDeclaration.declaration);\n if (!declarationNames.includes('*default*')) {\n declarationNames.push('*default*');\n }\n return declarationNames;\n }\n case isExportDeclarationWithDefaultAndClass(ExportDeclaration): {\n const declarationNames = BoundNames_ClassDeclaration(ExportDeclaration.declaration);\n if (!declarationNames.includes('*default*')) {\n declarationNames.push('*default*');\n }\n return declarationNames;\n }\n case isExportDeclarationWithDefaultAndExpression(ExportDeclaration):\n return ['*default*'];\n default:\n throw new OutOfRange('BoundNames_ExportDeclaration', ExportDeclaration);\n }\n}\n\n// (implicit)\n// ModuleItem :\n// ImportDeclaration\n// ExportDeclaration\n// StatementListItem\n//\n// StatementListItem : Declaration\nexport function BoundNames_ModuleItem(ModuleItem) {\n switch (true) {\n case isImportDeclaration(ModuleItem):\n return BoundNames_ImportDeclaration(ModuleItem);\n\n case isExportDeclaration(ModuleItem):\n return BoundNames_ExportDeclaration(ModuleItem);\n\n case isDeclaration(ModuleItem):\n return BoundNames_Declaration(ModuleItem);\n\n default:\n throw new OutOfRange('BoundNames_ModuleItem', ModuleItem);\n }\n}\n","// 14.6.3 #sec-static-semantics-constructormethod\n// ClassElementList :\n// ClassElement\n// ClassElementList ClassElement\nfunction ConstructorMethod_ClassElementList(ClassElementList) {\n return ClassElementList.find((ClassElement) => ClassElement.kind === 'constructor');\n}\n\n// (implicit)\n// ClassBody : ClassElementList\nexport const ConstructorMethod_ClassBody = ConstructorMethod_ClassElementList;\n","import {\n isArrayBindingPattern,\n isBindingElement,\n isBindingIdentifier,\n isBindingIdentifierAndInitializer,\n isBindingPattern,\n isBindingPatternAndInitializer,\n isBindingProperty,\n isBindingPropertyWithColon,\n isBindingPropertyWithSingleNameBinding,\n isBindingRestElement,\n isBindingRestProperty,\n isFormalParameter,\n isFunctionRestParameter,\n isObjectBindingPattern,\n isSingleNameBinding,\n} from '../ast.mjs';\nimport { OutOfRange } from '../helpers.mjs';\n\n// 13.3.3.2 #sec-destructuring-binding-patterns-static-semantics-containsexpression\n// SingleNameBinding :\n// BindingIdentifier\n// BindingIdentifier Initializer\nexport function ContainsExpression_SingleNameBinding(SingleNameBinding) {\n switch (true) {\n case isBindingIdentifier(SingleNameBinding):\n return false;\n case isBindingIdentifierAndInitializer(SingleNameBinding):\n return true;\n default:\n throw new OutOfRange('ContainsExpression_SingleNameBinding', SingleNameBinding);\n }\n}\n\n// 13.3.3.2 #sec-destructuring-binding-patterns-static-semantics-containsexpression\n// BindingElement : BindingPattern Initializer\n//\n// (implicit)\n// BindingElement :\n// SingleNameBinding\n// BindingPattern\nexport function ContainsExpression_BindingElement(BindingElement) {\n switch (true) {\n case isSingleNameBinding(BindingElement):\n return ContainsExpression_SingleNameBinding(BindingElement);\n case isBindingPattern(BindingElement):\n return ContainsExpression_BindingPattern(BindingElement);\n case isBindingPatternAndInitializer(BindingElement):\n return true;\n default:\n throw new OutOfRange('ContainsExpression_BindingElement', BindingElement);\n }\n}\n\n// 13.3.3.2 #sec-destructuring-binding-patterns-static-semantics-containsexpression\n// BindingRestElement :\n// `...` BindingIdentifier\n// `...` BindingPattern\nexport function ContainsExpression_BindingRestElement(BindingRestElement) {\n switch (true) {\n case isBindingIdentifier(BindingRestElement.argument):\n return false;\n case isBindingPattern(BindingRestElement.argument):\n return ContainsExpression_BindingPattern(BindingRestElement.argument);\n default:\n throw new OutOfRange('ContainsExpression_BindingRestElement', BindingRestElement);\n }\n}\n\n// 13.3.3.2 #sec-destructuring-binding-patterns-static-semantics-containsexpression\n// ArrayBindingPattern :\n// `[` Elision `]`\n// `[` Elision BindingRestElement `]`\n// `[` BindingElementList `,` Elision `]`\n// `[` BindingElementList `,` Elision BindingRestElement `]`\n// BindingElementList : BindingElementList `,` BindingElisionElement\n// BindingElisionElement : Elision BindingElement\n//\n// (implicit)\n// BindingElementList : BindingElisionElement\n// BindingElisionElement : BindingElement\nexport function ContainsExpression_ArrayBindingPattern(ArrayBindingPattern) {\n for (const BindingElisionElementOrBindingRestElement of ArrayBindingPattern.elements) {\n switch (true) {\n case BindingElisionElementOrBindingRestElement === null:\n // This is an elision.\n break;\n\n case isBindingElement(BindingElisionElementOrBindingRestElement): {\n const BindingElement = BindingElisionElementOrBindingRestElement;\n const has = ContainsExpression_BindingElement(BindingElement);\n if (has === true) return true;\n break;\n }\n case isBindingRestElement(BindingElisionElementOrBindingRestElement): {\n const BindingRestElement = BindingElisionElementOrBindingRestElement;\n const has = ContainsExpression_BindingRestElement(BindingRestElement);\n if (has === true) return true;\n break;\n }\n default:\n throw new OutOfRange('ContainsExpression_ArrayBindingPattern element', BindingElisionElementOrBindingRestElement);\n }\n }\n return false;\n}\n\n// 13.3.3.2 #sec-destructuring-binding-patterns-static-semantics-containsexpression\n// BindingProperty : PropertyName `:` BindingElement\n//\n// (implicit)\n// BindingProperty : SingleNameBinding\nexport function ContainsExpression_BindingProperty(BindingProperty) {\n switch (true) {\n case isBindingPropertyWithColon(BindingProperty): {\n const has = BindingProperty.computed;\n if (has === true) return true;\n return ContainsExpression_BindingElement(BindingProperty.value);\n }\n\n case isBindingPropertyWithSingleNameBinding(BindingProperty):\n return ContainsExpression_SingleNameBinding(BindingProperty.value);\n\n default:\n throw new OutOfRange('ContainsExpression_BindingProperty', BindingProperty);\n }\n}\n\n// https://github.com/tc39/ecma262/pull/1301\n// BindingRestProperty : `...` BindingIdentifier\nexport function ContainsExpression_BindingRestProperty(BindingRestProperty) {\n if (!isBindingIdentifier(BindingRestProperty.argument)) {\n throw new OutOfRange('ContainsExpression_BindingRestProperty argument', BindingRestProperty.argument);\n }\n return false;\n}\n\n// 13.3.3.2 #sec-destructuring-binding-patterns-static-semantics-containsexpression\n// ObjectBindingPattern : `{` `}`\n//\n// BindingPropertyList : BindingPropertyList `,` BindingProperty\n//\n// (implicit)\n// ObjectBindingPattern :\n// `{` BindingRestProperty `}`\n// `{` BindingPropertyList `}`\n// `{` BindingPropertyList `,` `}`\n//\n// BindingPropertyList : BindingProperty\n//\n// https://github.com/tc39/ecma262/pull/1301\n// ObjectBindingPattern : `{` BindingPropertyList `,` BindingRestProperty `}`\nexport function ContainsExpression_ObjectBindingPattern(ObjectBindingPattern) {\n for (const prop of ObjectBindingPattern.properties) {\n switch (true) {\n case isBindingProperty(prop): {\n const BindingProperty = prop;\n const has = ContainsExpression_BindingProperty(BindingProperty);\n if (has === true) return true;\n break;\n }\n\n case isBindingRestProperty(prop): {\n const BindingRestProperty = prop;\n const has = ContainsExpression_BindingRestProperty(BindingRestProperty);\n if (has === true) return true;\n break;\n }\n\n default:\n throw new OutOfRange('ContainsExpression_ObjectBindingPattern property', prop);\n }\n }\n return false;\n}\n\n// (implicit)\n// BindingPattern :\n// ObjectBindingPattern\n// ArrayBindingPattern\nfunction ContainsExpression_BindingPattern(BindingPattern) {\n switch (true) {\n case isObjectBindingPattern(BindingPattern):\n return ContainsExpression_ObjectBindingPattern(BindingPattern);\n case isArrayBindingPattern(BindingPattern):\n return ContainsExpression_ArrayBindingPattern(BindingPattern);\n default:\n throw new OutOfRange('ContainsExpression_BindingPattern', BindingPattern);\n }\n}\n\n// (implicit)\n// FormalParameter : BindingElement\nexport const ContainsExpression_FormalParameter = ContainsExpression_BindingElement;\n\n// (implicit)\n// FunctionRestParameter : BindingRestElement\nexport const ContainsExpression_FunctionRestParameter = ContainsExpression_BindingRestElement;\n\n// 14.1.5 #sec-function-definitions-static-semantics-containsexpression\n// FormalParameters :\n// [empty]\n// FormalParameterList `,` FunctionRestParameter\n//\n// FormalParameterList :\n// FormalParameterList `,` FormalParameter\n//\n// (implicit)\n// FormalParameters :\n// FunctionRestParameter\n// FormalParameterList\n// FormalParameterList `,`\n//\n// FormalParameterList : FormalParameter\nexport function ContainsExpression_FormalParameters(FormalParameters) {\n for (const FormalParameterOrFunctionRestParameter of FormalParameters) {\n switch (true) {\n case isFormalParameter(FormalParameterOrFunctionRestParameter):\n if (ContainsExpression_FormalParameter(FormalParameterOrFunctionRestParameter) === true) {\n return true;\n }\n break;\n\n case isFunctionRestParameter(FormalParameterOrFunctionRestParameter):\n if (ContainsExpression_FunctionRestParameter(FormalParameterOrFunctionRestParameter) === true) {\n return true;\n }\n break;\n\n default:\n throw new OutOfRange('ContainsExpression_FormalParameters element', FormalParameterOrFunctionRestParameter);\n }\n }\n return false;\n}\n","import {\n directivePrologueContainsUseStrictDirective,\n isBlockStatement,\n isExpressionBody,\n} from '../ast.mjs';\nimport { OutOfRange } from '../helpers.mjs';\n\n// 14.1.6 #sec-function-definitions-static-semantics-containsusestrict\n// FunctionBody : FunctionStatementList\nexport function ContainsUseStrict_FunctionBody(FunctionBody) {\n return directivePrologueContainsUseStrictDirective(FunctionBody);\n}\n\n// 14.2.5 #sec-arrow-function-definitions-static-semantics-containsusestrict\n// ConciseBody : ExpressionBody\n//\n// (implicit)\n// ConciseBody : `{` FunctionBody `}`\nexport function ContainsUseStrict_ConciseBody(ConciseBody) {\n switch (true) {\n case isExpressionBody(ConciseBody):\n return false;\n case isBlockStatement(ConciseBody):\n return ContainsUseStrict_FunctionBody(ConciseBody.body);\n default:\n throw new OutOfRange('ContainsUseStrict_ConciseBody', ConciseBody);\n }\n}\n","// 13.1.4 #sec-static-semantics-declarationpart\n// HoistableDeclaration :\n// FunctionDeclaration\n// GeneratorDeclaration\n// AsyncFunctionDeclaration\n// AsyncGeneratorDeclaration\n// Declaration :\n// ClassDeclaration\n// LexicalDeclaration\n//\n// (implicit)\n// Declaration : HoistableDeclaration\n//\n// What a weird set of static semantics…\nexport function DeclarationPart_Declaration(Declaration) {\n return Declaration;\n}\n\nexport const DeclarationPart_HoistableDeclaration = DeclarationPart_Declaration;\nexport const DeclarationPart_FunctionDeclaration = DeclarationPart_Declaration;\nexport const DeclarationPart_GeneratorDeclaration = DeclarationPart_Declaration;\nexport const DeclarationPart_AsyncFunctionDeclaration = DeclarationPart_Declaration;\nexport const DeclarationPart_AsyncGeneratorDeclaration = DeclarationPart_Declaration;\nexport const DeclarationPart_ClassDeclaration = DeclarationPart_Declaration;\nexport const DeclarationPart_LexicalDeclaration = DeclarationPart_Declaration;\n","import { Assert } from '../abstract-ops/all.mjs';\nimport {\n isBindingElement,\n isFunctionRestParameter,\n} from '../ast.mjs';\nimport { HasInitializer_BindingElement } from './all.mjs';\n\n// 14.1.7 #sec-function-definitions-static-semantics-expectedargumentcount\n// FormalParameters :\n// [empty]\n// FormalParameterList `,` FunctionRestParameter\n//\n// FormalParameterList : FormalParameterList `,` FormalParameter\n//\n// (implicit)\n// FormalParameters :\n// FunctionRestParameter\n// FormalParameterList\n// FormalParameterList `,`\n//\n// FormalParameterList : FormalParameter\nexport function ExpectedArgumentCount_FormalParameters(FormalParameters) {\n if (FormalParameters.length === 0) {\n return 0;\n }\n\n let count = 0;\n for (const FormalParameter of FormalParameters.slice(0, -1)) {\n Assert(isBindingElement(FormalParameter));\n const BindingElement = FormalParameter;\n if (HasInitializer_BindingElement(BindingElement)) {\n return count;\n }\n count += 1;\n }\n\n const last = FormalParameters[FormalParameters.length - 1];\n if (isFunctionRestParameter(last)) {\n return count;\n }\n Assert(isBindingElement(last));\n if (HasInitializer_BindingElement(last)) {\n return count;\n }\n return count + 1;\n}\n\n// 14.2.6 #sec-arrow-function-definitions-static-semantics-expectedargumentcount\n// ArrowParameters : BindingIdentifier\n//\n// (implicit)\n// ArrowParameters : CoverParenthesizedExpressionAndArrowParameterList\n// ArrowFormalParameters : `(` UniqueFormalParameters `)`\n// UniqueFormalParameters : FormalParameters\nexport const ExpectedArgumentCount_ArrowParameters = ExpectedArgumentCount_FormalParameters;\n\n// 14.3.3 #sec-method-definitions-static-semantics-expectedargumentcount\n// PropertySetParameterList : FormalParameter\n//\n// Not implemented. Use ExpectedArgumentCount_FormalParameters instead.\n\n// 14.8.6 #sec-async-arrow-function-definitions-static-semantics-ExpectedArgumentCount\n// AsyncArrowBindingIdentifier : BindingIdentifier\n//\n// Not implemented. Use ExpectedArgumentCount_ArrowParameters instead.\n\nexport const ExpectedArgumentCount = ExpectedArgumentCount_FormalParameters;\n","import { ExportEntryRecord } from '../modules.mjs';\nimport { Value } from '../value.mjs';\n\n// 15.2.3.6 #sec-static-semantics-exportentriesformodule\n// ExportList : ExportList `,` ExportSpecifier\n//\n// (implicit)\n// ExportList : ExportSpecifier\nexport function ExportEntriesForModule_ExportList(ExportList, module) {\n const specs = [];\n for (const ExportSpecifier of ExportList) {\n specs.push(...ExportEntriesForModule_ExportSpecifier(ExportSpecifier, module));\n }\n return specs;\n}\n\n// 15.2.3.6 #sec-static-semantics-exportentriesformodule\n// ExportClause : `{` `}`\n//\n// (implicit)\n// ExportClause :\n// `{` ExportList `}`\n// `{` ExportList `,` `}`\nexport const ExportEntriesForModule_ExportClause = ExportEntriesForModule_ExportList;\n\n// 15.2.3.6 #sec-static-semantics-exportentriesformodule\n// ExportSpecifier :\n// IdentifierName\n// IdentifierName `as` IdentifierName\nexport function ExportEntriesForModule_ExportSpecifier(ExportSpecifier, module) {\n const sourceName = new Value(ExportSpecifier.local.name);\n const exportName = new Value(ExportSpecifier.exported.name);\n let localName;\n let importName;\n if (module === Value.null) {\n localName = sourceName;\n importName = Value.null;\n } else {\n localName = Value.null;\n importName = sourceName;\n }\n return [new ExportEntryRecord({\n ModuleRequest: module,\n ImportName: importName,\n LocalName: localName,\n ExportName: exportName,\n })];\n}\n","import {\n isExportDeclaration,\n isExportDeclarationWithDeclaration,\n isExportDeclarationWithDefaultAndClass,\n isExportDeclarationWithDefaultAndExpression,\n isExportDeclarationWithDefaultAndHoistable,\n isExportDeclarationWithExport,\n isExportDeclarationWithExportAndFrom,\n isExportDeclarationWithStar,\n isExportDeclarationWithVariable,\n isImportDeclaration,\n isStatementListItem,\n} from '../ast.mjs';\nimport { Value } from '../value.mjs';\nimport { OutOfRange } from '../helpers.mjs';\n\n// 15.2.1.10 #sec-module-semantics-static-semantics-modulerequests\n// ModuleItemList : ModuleItemList ModuleItem\n//\n// (implicit)\n// ModuleItemList : ModuleItem\nexport function ModuleRequests_ModuleItemList(ModuleItemList) {\n const moduleNames = new Set();\n for (const ModuleItem of ModuleItemList) {\n for (const additionalName of ModuleRequests_ModuleItem(ModuleItem)) {\n moduleNames.add(additionalName);\n }\n }\n return [...moduleNames];\n}\n\n// (implicit)\n// ModuleBody : ModuleItemList\nexport const ModuleRequests_ModuleBody = ModuleRequests_ModuleItemList;\n\n// 15.2.1.10 #sec-module-semantics-static-semantics-modulerequests\n// Module : [empty]\n//\n// (implicit)\n// Module : ModuleBody\nexport const ModuleRequests_Module = ModuleRequests_ModuleBody;\n\n// 15.2.1.10 #sec-module-semantics-static-semantics-modulerequests\n// ModuleItem : StatementListItem\n//\n// (implicit)\n// ModuleItem : ImportDeclaration\n// ModuleItem : ExportDeclaration\nexport function ModuleRequests_ModuleItem(ModuleItem) {\n switch (true) {\n case isStatementListItem(ModuleItem):\n return [];\n\n case isImportDeclaration(ModuleItem):\n return ModuleRequests_ImportDeclaration(ModuleItem);\n\n case isExportDeclaration(ModuleItem):\n return ModuleRequests_ExportDeclaration(ModuleItem);\n\n default:\n throw new OutOfRange('ModuleRequests_ModuleItem', ModuleItem);\n }\n}\n\n// 15.2.2.5 #sec-imports-static-semantics-modulerequests\n// ImportDeclaration : `import` ImportClause FromClause `;`\nexport function ModuleRequests_ImportDeclaration(ImportDeclaration) {\n const { source: FromClause } = ImportDeclaration;\n return ModuleRequests_FromClause(FromClause);\n}\n\n// 15.2.2.5 #sec-imports-static-semantics-modulerequests\n// ModuleSpecifier : StringLiteral\n//\n// (implicit)\n// FromClause : `from` ModuleSpecifier\nexport function ModuleRequests_FromClause(FromClause) {\n return [new Value(FromClause.value)];\n}\n\n// 15.2.3.9 #sec-exports-static-semantics-modulerequests\n// ExportDeclaration :\n// `export` `*` FromClause `;`\n// `export` ExportClause FromClause `;`\n// `export` ExportClause `;`\n// `export` VariableStatement\n// `export` Declaration\n// `export` `default` HoistableDeclaration\n// `export` `default` ClassDeclaration\n// `export` `default` AssignmentExpression `;`\nexport function ModuleRequests_ExportDeclaration(ExportDeclaration) {\n switch (true) {\n case isExportDeclarationWithStar(ExportDeclaration):\n case isExportDeclarationWithExportAndFrom(ExportDeclaration):\n return ModuleRequests_FromClause(ExportDeclaration.source);\n\n case isExportDeclarationWithExport(ExportDeclaration):\n case isExportDeclarationWithVariable(ExportDeclaration):\n case isExportDeclarationWithDeclaration(ExportDeclaration):\n case isExportDeclarationWithDefaultAndHoistable(ExportDeclaration):\n case isExportDeclarationWithDefaultAndClass(ExportDeclaration):\n case isExportDeclarationWithDefaultAndExpression(ExportDeclaration):\n return [];\n\n default:\n throw new OutOfRange('ModuleRequests_ExportDeclaration', ExportDeclaration);\n }\n}\n","import { Assert } from '../abstract-ops/notational-conventions.mjs';\nimport {\n isExportDeclaration,\n isExportDeclarationWithStar,\n isExportDeclarationWithExportAndFrom,\n isExportDeclarationWithExport,\n isExportDeclarationWithVariable,\n isExportDeclarationWithDeclaration,\n isExportDeclarationWithDefaultAndHoistable,\n isExportDeclarationWithDefaultAndClass,\n isExportDeclarationWithDefaultAndExpression,\n isImportDeclaration,\n isStatementListItem,\n} from '../ast.mjs';\nimport { OutOfRange } from '../helpers.mjs';\nimport { ExportEntryRecord } from '../modules.mjs';\nimport { Value } from '../value.mjs';\nimport {\n BoundNames_ClassDeclaration,\n BoundNames_Declaration,\n BoundNames_HoistableDeclaration,\n BoundNames_VariableStatement,\n} from './BoundNames.mjs';\nimport { ExportEntriesForModule_ExportClause } from './ExportEntriesForModule.mjs';\nimport { ModuleRequests_FromClause } from './ModuleRequests.mjs';\n\n// 15.2.1.7 #sec-module-semantics-static-semantics-exportentries\n// ModuleItemList : ModuleItemList ModuleItem\n//\n// (implicit)\n// ModuleItemList : ModuleItem\nexport function ExportEntries_ModuleItemList(ModuleItemList) {\n const entries = [];\n for (const ModuleItem of ModuleItemList) {\n entries.push(...ExportEntries_ModuleItem(ModuleItem));\n }\n return entries;\n}\n\n// (implicit)\n// ModuleBody : ModuleItemList\nexport const ExportEntries_ModuleBody = ExportEntries_ModuleItemList;\n\n// 15.2.1.7 #sec-module-semantics-static-semantics-exportentries\n// Module : [empty]\n//\n// (implicit)\n// Module : ModuleBody\nexport const ExportEntries_Module = ExportEntries_ModuleBody;\n\n// 15.2.1.7 #sec-module-semantics-static-semantics-exportentries\n// ModuleItem :\n// ImportDeclaration\n// StatementListItem\n//\n// (implicit)\n// ModuleItem : ExportDeclaration\nexport function ExportEntries_ModuleItem(ModuleItem) {\n switch (true) {\n case isImportDeclaration(ModuleItem):\n case isStatementListItem(ModuleItem):\n return [];\n\n case isExportDeclaration(ModuleItem):\n return ExportEntries_ExportDeclaration(ModuleItem);\n\n default:\n throw new OutOfRange('ExportEntries_ModuleItem', ModuleItem);\n }\n}\n\n// 15.2.3.5 #sec-exports-static-semantics-exportentries\n// ExportDeclaration :\n// `export` `*` FromClause `;`\n// `export` ExportClause FromClause `;`\n// `export` ExportClause `;`\n// `export` VariableStatement\n// `export` Declaration\n// `export` `default` HoistableDeclaration\n// `export` `default` ClassDeclaration\n// `export` `default` AssignmentExpression `;`\nexport function ExportEntries_ExportDeclaration(ExportDeclaration) {\n switch (true) {\n case isExportDeclarationWithStar(ExportDeclaration): {\n const FromClause = ExportDeclaration.source;\n const modules = ModuleRequests_FromClause(FromClause);\n Assert(modules.length === 1);\n const [module] = modules;\n const entry = new ExportEntryRecord({\n ModuleRequest: module,\n ImportName: new Value('*'),\n LocalName: Value.null,\n ExportName: Value.null,\n });\n return [entry];\n }\n\n case isExportDeclarationWithExportAndFrom(ExportDeclaration): {\n const {\n specifiers: ExportClause,\n source: FromClause,\n } = ExportDeclaration;\n const modules = ModuleRequests_FromClause(FromClause);\n Assert(modules.length === 1);\n const [module] = modules;\n return ExportEntriesForModule_ExportClause(ExportClause, module);\n }\n\n case isExportDeclarationWithExport(ExportDeclaration): {\n const ExportClause = ExportDeclaration.specifiers;\n return ExportEntriesForModule_ExportClause(ExportClause, Value.null);\n }\n\n case isExportDeclarationWithVariable(ExportDeclaration): {\n const VariableStatement = ExportDeclaration.declaration;\n const entries = [];\n const names = BoundNames_VariableStatement(VariableStatement);\n for (const name of names) {\n entries.push(new ExportEntryRecord({\n ModuleRequest: Value.null,\n ImportName: Value.null,\n LocalName: new Value(name),\n ExportName: new Value(name),\n }));\n }\n return entries;\n }\n\n case isExportDeclarationWithDeclaration(ExportDeclaration): {\n const Declaration = ExportDeclaration.declaration;\n const entries = [];\n const names = BoundNames_Declaration(Declaration);\n for (const name of names) {\n entries.push(new ExportEntryRecord({\n ModuleRequest: Value.null,\n ImportName: Value.null,\n LocalName: new Value(name),\n ExportName: new Value(name),\n }));\n }\n return entries;\n }\n\n case isExportDeclarationWithDefaultAndHoistable(ExportDeclaration): {\n const HoistableDeclaration = ExportDeclaration.declaration;\n const names = BoundNames_HoistableDeclaration(HoistableDeclaration);\n Assert(names.length === 1);\n const [localName] = names;\n return [new ExportEntryRecord({\n ModuleRequest: Value.null,\n ImportName: Value.null,\n LocalName: new Value(localName),\n ExportName: new Value('default'),\n })];\n }\n\n case isExportDeclarationWithDefaultAndClass(ExportDeclaration): {\n const ClassDeclaration = ExportDeclaration.declaration;\n const names = BoundNames_ClassDeclaration(ClassDeclaration);\n Assert(names.length === 1);\n const [localName] = names;\n return [new ExportEntryRecord({\n ModuleRequest: Value.null,\n ImportName: Value.null,\n LocalName: new Value(localName),\n ExportName: new Value('default'),\n })];\n }\n\n case isExportDeclarationWithDefaultAndExpression(ExportDeclaration):\n return [new ExportEntryRecord({\n ModuleRequest: Value.null,\n ImportName: Value.null,\n LocalName: new Value('*default*'),\n ExportName: new Value('default'),\n })];\n\n default:\n throw new OutOfRange('ExportEntries_ExportDeclaration', ExportDeclaration);\n }\n}\n","import {\n isBindingIdentifier,\n isBindingIdentifierAndInitializer,\n isBindingPattern,\n isBindingPatternAndInitializer,\n isSingleNameBinding,\n} from '../ast.mjs';\nimport { OutOfRange } from '../helpers.mjs';\n\n// 13.3.3.3 #sec-destructuring-binding-patterns-static-semantics-hasinitializer\n// SingleNameBinding :\n// BindingIdentifier\n// BindingIdentifier Initializer\nexport function HasInitializer_SingleNameBinding(SingleNameBinding) {\n switch (true) {\n case isBindingIdentifier(SingleNameBinding):\n return false;\n\n case isBindingIdentifierAndInitializer(SingleNameBinding):\n return true;\n\n default:\n throw new OutOfRange('HasInitializer_SingleNameBinding', SingleNameBinding);\n }\n}\n\n// 13.3.3.3 #sec-destructuring-binding-patterns-static-semantics-hasinitializer\n// BindingElement :\n// BindingPattern\n// BindingPattern Initializer\n//\n// (implicit)\n// BindingElement : SingleNameBinding\nexport function HasInitializer_BindingElement(BindingElement) {\n switch (true) {\n case isBindingPattern(BindingElement):\n return false;\n\n case isBindingPatternAndInitializer(BindingElement):\n return true;\n\n case isSingleNameBinding(BindingElement):\n return HasInitializer_SingleNameBinding(BindingElement);\n\n default:\n throw new OutOfRange('HasInitializer_BindingElement', BindingElement);\n }\n}\n\n// 14.1.8 #sec-function-definitions-static-semantics-hasinitializer\n// FormalParameterList : FormalParameterList `,` FormalParameter\n// is implemented directly as part of ExpectedArgumentCount for FormalParameters.\n","import {\n isArrowFunction,\n isAsyncArrowFunction,\n isAsyncFunctionExpression,\n isAsyncGeneratorExpression,\n isClassExpression,\n isFunctionExpression,\n isGeneratorExpression,\n isParenthesizedExpression,\n} from '../ast.mjs';\nimport { OutOfRange } from '../helpers.mjs';\nimport { IsFunctionDefinition_Expression } from './all.mjs';\n\n// 12.2.1.2 #sec-semantics-static-semantics-hasname\n// PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList\n//\n// 14.1.9 #sec-function-definitions-static-semantics-hasname\n// FunctionExpression :\n// `function` `(` FormalParameters `)` `{` FunctionBody `}`\n// `function` BindingIdentifier `(` FormalParameters `)` `{` FunctionBody `}`\n//\n// 14.2.7 #sec-arrow-function-definitions-static-semantics-hasname\n// ArrowFunction : ArrowParameters `=>` ConciseBody\n//\n// 14.4.6 #sec-generator-function-definitions-static-semantics-hasname\n// GeneratorExpression :\n// `function` `*` `(` FormalParameters `)` `{` GeneratorBody `}`\n// `function` `*` BindingIdentifier `(` FormalParameters `)` `{` GeneratorBody `}`\n//\n// 14.5.6 #sec-async-generator-function-definitions-static-semantics-hasname\n// AsyncGeneratorExpression :\n// `async` `function` `*` `(` FormalParameters `)` `{` AsyncGeneratorBody `}`\n// `async` `function` `*` BindingIdentifier `(` FormalParameters `)` `{` AsyncGeneratorBody `}`\n//\n// 14.6.6 #sec-class-definitions-static-semantics-hasname\n// ClassExpression :\n// `class` ClassTail\n// `class` BindingIdentifier ClassTail\n//\n// 14.7.6 #sec-async-function-definitions-static-semantics-HasName\n// AsyncFunctionExpression :\n// `async` [no LineTerminator here] `function` `(` FormalParameters `)`\n// `{` AsyncFunctionBody `}`\n// `async` [no LineTerminator here] `function` BindingIdentifier `(` FormalParameters `)`\n// `{` AsyncFunctionBody `}`\n//\n// 14.8.7 #sec-async-arrow-function-definitions-static-semantics-HasName\n// AsyncArrowFunction:\n// `async` [no LineTerminator here] AsyncArrowBindingIdentifier [no LineTerminator here]\n// `=>` AsyncConciseBody\n// CoverCallExpressionAndAsyncArrowHead [no LineTerminator here] `=>` AsyncConciseBody\n//\n// (implicit)\n// ParenthesizedExpression : `(` Expression `)`\n//\n// PrimaryExpression :\n// FunctionExpression\n// ClassExpression\n// GeneratorExpression\n// AsyncFunctionExpression\n// AsyncGeneratorExpression\n// ArrowFunction\n//\n// MemberExpression : PrimaryExpression\n//\n// (From MemberExpression to ConditionalExpression omitted.)\n//\n// AssignmentExpression :\n// ConditionalExpression\n// ArrowFunction\n// AsyncArrowFunction\n//\n// Expression : AssignmentExpression\nexport function HasName_Expression(Expression) {\n switch (true) {\n case isFunctionExpression(Expression):\n case isGeneratorExpression(Expression):\n case isAsyncGeneratorExpression(Expression):\n case isClassExpression(Expression):\n case isAsyncFunctionExpression(Expression):\n return Expression.id !== null;\n\n case isArrowFunction(Expression):\n case isAsyncArrowFunction(Expression):\n return false;\n\n case isParenthesizedExpression(Expression): {\n const expr = Expression.expression;\n if (!IsFunctionDefinition_Expression(expr)) {\n return false;\n }\n return HasName_Expression(expr);\n }\n\n default:\n throw new OutOfRange('HasName_Expression', Expression);\n }\n}\n","import { Assert } from '../abstract-ops/notational-conventions.mjs';\nimport {\n isImportedDefaultBinding,\n isNameSpaceImport,\n isImportSpecifier,\n} from '../ast.mjs';\nimport { OutOfRange } from '../helpers.mjs';\nimport { ImportEntryRecord } from '../modules.mjs';\nimport { Value } from '../value.mjs';\nimport { BoundNames_ImportedBinding } from './BoundNames.mjs';\n\n// 15.2.2.4 #sec-static-semantics-importentriesformodule\n// ImportClause :\n// ImportedDefaultBinding `,` NameSpaceImport\n// ImportedDefaultBinding `,` NamedImports\n//\n// NamedImports : `{` `}`\n//\n// ImportsList : ImportsList `,` ImportSpecifier\n//\n// (implicit)\n// ImportClause :\n// ImportedDefaultBinding\n// NameSpaceImport\n// NamedImports\n//\n// NamedImports :\n// `{` ImportsList `}`\n// `{` ImportsList `,` `}`\n//\n// ImportsList : ImportSpecifier\nexport function ImportEntriesForModule_ImportClause(ImportClause, module) {\n const entries = [];\n for (const binding of ImportClause) {\n switch (true) {\n case isImportedDefaultBinding(binding):\n entries.push(...ImportEntriesForModule_ImportedDefaultBinding(binding, module));\n break;\n\n case isNameSpaceImport(binding):\n entries.push(...ImportEntriesForModule_NameSpaceImport(binding, module));\n break;\n\n case isImportSpecifier(binding):\n entries.push(...ImportEntriesForModule_ImportSpecifier(binding, module));\n break;\n\n default:\n throw new OutOfRange('ImportEntriesForModule_ImportClause binding', binding);\n }\n }\n return entries;\n}\n\n// 15.2.2.4 #sec-static-semantics-importentriesformodule\n// ImportedDefaultBinding : ImportedBinding\nexport function ImportEntriesForModule_ImportedDefaultBinding(ImportedDefaultBinding, module) {\n const ImportedBinding = ImportedDefaultBinding.local;\n const localNames = BoundNames_ImportedBinding(ImportedBinding);\n Assert(localNames.length === 1);\n const [localName] = localNames;\n const defaultEntry = new ImportEntryRecord({\n ModuleRequest: module,\n ImportName: new Value('default'),\n LocalName: new Value(localName),\n });\n return [defaultEntry];\n}\n\n// 15.2.2.4 #sec-static-semantics-importentriesformodule\n// NameSpaceImport : `*` `as` ImportedBinding\nexport function ImportEntriesForModule_NameSpaceImport(NameSpaceImport, module) {\n const ImportedBinding = NameSpaceImport.local;\n const localNames = BoundNames_ImportedBinding(ImportedBinding);\n Assert(localNames.length === 1);\n const [localName] = localNames;\n const entry = new ImportEntryRecord({\n ModuleRequest: module,\n ImportName: new Value('*'),\n LocalName: new Value(localName),\n });\n return [entry];\n}\n\n// 15.2.2.4 #sec-static-semantics-importentriesformodule\n// ImportSpecifier :\n// ImportedBinding\n// IdentifierName `as` ImportedBinding\nexport function ImportEntriesForModule_ImportSpecifier(ImportSpecifier, module) {\n const {\n imported: IdentifierName,\n local: ImportedBinding,\n } = ImportSpecifier;\n\n const importName = IdentifierName.name;\n const localName = ImportedBinding.name;\n\n const entry = new ImportEntryRecord({\n ModuleRequest: module,\n ImportName: new Value(importName),\n LocalName: new Value(localName),\n });\n return [entry];\n}\n","import { Assert } from '../abstract-ops/notational-conventions.mjs';\nimport {\n isExportDeclaration,\n isImportDeclaration,\n isImportDeclarationWithClause,\n isImportDeclarationWithSpecifierOnly,\n isStatementListItem,\n} from '../ast.mjs';\nimport { OutOfRange } from '../helpers.mjs';\nimport { ImportEntriesForModule_ImportClause } from './ImportEntriesForModule.mjs';\nimport { ModuleRequests_FromClause } from './ModuleRequests.mjs';\n\n// 15.2.1.8 #sec-module-semantics-static-semantics-importentries\n// ModuleItemList : ModuleItemList ModuleItem\n//\n// (implicit)\n// ModuleItemList : ModuleItem\nexport function ImportEntries_ModuleItemList(ModuleItemList) {\n const entries = [];\n for (const ModuleItem of ModuleItemList) {\n entries.push(...ImportEntries_ModuleItem(ModuleItem));\n }\n return entries;\n}\n\n// (implicit)\n// ModuleBody : ModuleItemList\nexport const ImportEntries_ModuleBody = ImportEntries_ModuleItemList;\n\n// 15.2.1.8 #sec-module-semantics-static-semantics-importentries\n// Module : [empty]\n//\n// (implicit)\n// Module : ModuleBody\nexport const ImportEntries_Module = ImportEntries_ModuleBody;\n\n// 15.2.1.8 #sec-module-semantics-static-semantics-importentries\n// ModuleItem :\n// ExportDeclaration\n// StatementListItem\n//\n// (implicit)\n// ModuleItem : ImportDeclaration\nexport function ImportEntries_ModuleItem(ModuleItem) {\n switch (true) {\n case isExportDeclaration(ModuleItem):\n case isStatementListItem(ModuleItem):\n return [];\n\n case isImportDeclaration(ModuleItem):\n return ImportEntries_ImportDeclaration(ModuleItem);\n\n default:\n throw new OutOfRange('ImportEntries_ModuleItem', ModuleItem);\n }\n}\n\n// 15.2.2.3 #sec-imports-static-semantics-importentries\n// ImportDeclaration :\n// `import` ImportClause FromClause `;`\n// `import` ModuleSpecifier `;`\nexport function ImportEntries_ImportDeclaration(ImportDeclaration) {\n switch (true) {\n case isImportDeclarationWithClause(ImportDeclaration): {\n const {\n specifiers: ImportClause,\n source: FromClause,\n } = ImportDeclaration;\n const reqs = ModuleRequests_FromClause(FromClause);\n Assert(reqs.length === 1);\n const [module] = reqs;\n return ImportEntriesForModule_ImportClause(ImportClause, module);\n }\n\n case isImportDeclarationWithSpecifierOnly(ImportDeclaration):\n return [];\n\n default:\n throw new OutOfRange('ImportEntries_ImportDeclaration', ImportDeclaration);\n }\n}\n","// 15.2.1.9 #sec-importedlocalnames\nexport function ImportedLocalNames(importEntries) {\n const localNames = [];\n for (const i of importEntries) {\n localNames.push(i.LocalName);\n }\n return localNames;\n}\n","import {\n HasName_Expression,\n IsFunctionDefinition_Expression,\n} from './all.mjs';\n\n// 14.1.10 #sec-isanonymousfunctiondefinition\nexport function IsAnonymousFunctionDefinition(expr) {\n if (IsFunctionDefinition_Expression(expr) === false) {\n return false;\n }\n const hasName = HasName_Expression(expr);\n if (hasName === true) {\n return false;\n }\n return true;\n}\n","export function IsConstantDeclaration(node) {\n return node.kind === 'const';\n}\n","import { Assert } from '../abstract-ops/notational-conventions.mjs';\nimport {\n isBindingIdentifier,\n isBindingPattern,\n isExpression,\n} from '../ast.mjs';\nimport { OutOfRange } from '../helpers.mjs';\n\n// 12.3.1.4 #sec-static-semantics-static-semantics-isdestructuring\n// MemberExpression :\n// PrimaryExpression\n// MemberExpression `[` Expression `]`\n// MemberExpression `.` IdentifierName\n// MemberExpression TemplateLiteral\n// SuperProperty\n// MetaProperty\n// `new` MemberExpression Arguments\n//\n// NewExpression : `new` NewExpression\n//\n// LeftHandSideExpression : CallExpression\n//\n// (implicit)\n// NewExpression : MemberExpression\n//\n// LeftHandSideExpression : NewExpression\nexport function IsDestructuring_LeftHandSideExpression(LeftHandSideExpression) {\n switch (true) {\n case isExpression(LeftHandSideExpression):\n Assert(!isBindingPattern(LeftHandSideExpression));\n return false;\n\n case isBindingPattern(LeftHandSideExpression):\n return true;\n\n default:\n throw new OutOfRange('IsDestructuring_LeftHandSideExpression', LeftHandSideExpression);\n }\n}\n\n// 13.7.5.6 #sec-for-in-and-for-of-statements-static-semantics-isdestructuring\n// ForDeclaration : LetOrConst ForBinding\nexport function IsDestructuring_ForDeclaration(ForDeclaration) {\n return IsDestructuring_ForBinding(ForDeclaration.declarations[0].id);\n}\n\n// 13.7.5.6 #sec-for-in-and-for-of-statements-static-semantics-isdestructuring\n// ForBinding :\n// BindingIdentifier\n// BindingPattern\nexport function IsDestructuring_ForBinding(ForBinding) {\n switch (true) {\n case isBindingIdentifier(ForBinding):\n return false;\n case isBindingPattern(ForBinding):\n return true;\n default:\n throw new OutOfRange('IsDestructuring_ForBinding', ForBinding);\n }\n}\n","import {\n isArrowFunction,\n isAsyncArrowFunction,\n isAsyncFunctionExpression,\n isAsyncGeneratorExpression,\n isClassExpression,\n isFunctionExpression,\n isGeneratorExpression,\n isParenthesizedExpression,\n} from '../ast.mjs';\n\n// At the time of implementation, only the following productions return true\n// for this static semantic:\n//\n// 12.15.2 #sec-assignment-operators-static-semantics-isfunctiondefinition\n// AssignmentExpression :\n// ArrowFunction\n// AsyncArrowFunction\n//\n// 14.1.12 #sec-function-definitions-static-semantics-isfunctiondefinition\n// FunctionExpression :\n// `function` BindingIdentifier `(` FormalParameters `)` `{` FunctionBody `}`\n//\n// 14.4.8 #sec-generator-function-definitions-static-semantics-isfunctiondefinition\n// GeneratorExpression :\n// `function` `*` BindingIdentifier `(` FormalParameters `)` `{` GeneratorBody `}`\n//\n// 14.5.8 #sec-async-generator-function-definitions-static-semantics-isfunctiondefinition\n// AsyncGeneratorExpression :\n// `async` `function` `*` BindingIdentifier `(` FormalParameters `)` `{` AsyncGeneratorBody `}`\n//\n// 14.6.8 #sec-class-definitions-static-semantics-isfunctiondefinition\n// ClassExpression : `class` BindingIdentifier_opt ClassTail\n//\n// 14.7.8 #sec-async-function-definitions-static-semantics-IsFunctionDefinition\n// AsyncFunctionExpression :\n// `async` [no LineTerminator here] `function` `(` FormalParameters `)`\n// `{` AsyncFunctionBody `}`\n// `async` [no LineTerminator here] `function` BindingIdentifier `(` FormalParameters `)`\n// `{` AsyncFunctionBody `}`\n//\n// The following sections contain other special cases for\n// ParenthesizedExpressions:\n//\n// 12.2.1.3 #sec-semantics-static-semantics-isfunctiondefinition\n// PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList\n//\n// 12.2.10.2 #sec-grouping-operator-static-semantics-isfunctiondefinition\n// ParenthesizedExpression : `(` Expression `)`\n//\n// All other explicit and implicit productions return false, including those\n// specified at the following anchors:\n//\n// 12.2.1.3 #sec-semantics-static-semantics-isfunctiondefinition\n// 12.3.1.3 #sec-static-semantics-static-semantics-isfunctiondefinition\n// 12.4.2 #sec-update-expressions-static-semantics-isfunctiondefinition\n// 12.5.1 #sec-unary-operators-static-semantics-isfunctiondefinition\n// 12.6.1 #sec-exp-operator-static-semantics-isfunctiondefinition\n// 12.7.1 #sec-multiplicative-operators-static-semantics-isfunctiondefinition\n// 12.8.1 #sec-additive-operators-static-semantics-isfunctiondefinition\n// 12.9.1 #sec-bitwise-shift-operators-static-semantics-isfunctiondefinition\n// 12.10.1 #sec-relational-operators-static-semantics-isfunctiondefinition\n// 12.11.1 #sec-equality-operators-static-semantics-isfunctiondefinition\n// 12.12.1 #sec-binary-bitwise-operators-static-semantics-isfunctiondefinition\n// 12.13.1 #sec-binary-logical-operators-static-semantics-isfunctiondefinition\n// 12.14.1 #sec-conditional-operator-static-semantics-isfunctiondefinition\n// 12.15.2 #sec-assignment-operators-static-semantics-isfunctiondefinition\n// 12.16.1 #sec-comma-operator-static-semantics-isfunctiondefinition\nexport function IsFunctionDefinition_Expression(Expression) {\n if (isParenthesizedExpression(Expression)) {\n const expr = Expression.expression;\n return IsFunctionDefinition_Expression(expr);\n }\n return isArrowFunction(Expression)\n || isAsyncArrowFunction(Expression)\n || isFunctionExpression(Expression)\n || isGeneratorExpression(Expression)\n || isAsyncGeneratorExpression(Expression)\n || isClassExpression(Expression)\n || isAsyncFunctionExpression(Expression);\n}\n","import {\n isIdentifierReference,\n} from '../ast.mjs';\n\n// 12.2.1.4 #sec-semantics-static-semantics-isidentifierref\n// PrimaryExpression :\n// IdentifierReference\n// ... (omitted)\n//\n// 12.3.1.5 #sec-static-semantics-static-semantics-isidentifierref\n// ... (omitted)\nexport function IsIdentifierRef(node) {\n return isIdentifierReference(node);\n}\n","// 14.9.1 #sec-isintailposition\n// TODO(TCO)\nexport function IsInTailPosition() {\n return false;\n}\n","import {\n isBindingIdentifier,\n isBindingIdentifierAndInitializer,\n isBindingPattern,\n isBindingPatternAndInitializer,\n isFunctionRestParameter,\n isSingleNameBinding,\n} from '../ast.mjs';\nimport { OutOfRange } from '../helpers.mjs';\n\n// 13.3.3.4 #sec-destructuring-binding-patterns-static-semantics-issimpleparameterlist\n// BindingElement :\n// BindingPattern\n// BindingPattern Initializer\n//\n// (implicit)\n// BindingElement : SingleNameBinding\nexport function IsSimpleParameterList_BindingElement(BindingElement) {\n switch (true) {\n case isSingleNameBinding(BindingElement):\n return IsSimpleParameterList_SingleNameBinding(BindingElement);\n\n case isBindingPattern(BindingElement):\n case isBindingPatternAndInitializer(BindingElement):\n return false;\n\n default:\n throw new OutOfRange('IsSimpleParameterList_BindingElement', BindingElement);\n }\n}\n\n// 13.3.3.4 #sec-destructuring-binding-patterns-static-semantics-issimpleparameterlist\n// SingleNameBinding :\n// BindingIdentifier\n// BindingIdentifier Initializer\nexport function IsSimpleParameterList_SingleNameBinding(SingleNameBinding) {\n switch (true) {\n case isBindingIdentifier(SingleNameBinding):\n return true;\n case isBindingIdentifierAndInitializer(SingleNameBinding):\n return false;\n default:\n throw new OutOfRange('IsSimpleParameterList_SingleNameBinding', SingleNameBinding);\n }\n}\n\n// 14.1.13 #sec-function-definitions-static-semantics-issimpleparameterlist\n// FormalParameters :\n// [empty]\n// FormalParameterList `,` FunctionRestParameter\n//\n// (implicit)\n// FormalParameters :\n// FormalParameterList\n// FormalParameterList `,`\n//\n// https://github.com/tc39/ecma262/pull/1301\n// FormalParameters : FunctionRestParameter\nexport function IsSimpleParameterList_FormalParameters(FormalParameters) {\n if (FormalParameters.length === 0) {\n return true;\n }\n if (isFunctionRestParameter(FormalParameters[FormalParameters.length - 1])) {\n return false;\n }\n return IsSimpleParameterList_FormalParameterList(FormalParameters);\n}\n\n// 14.1.13 #sec-function-definitions-static-semantics-issimpleparameterlist\n// FormalParameterList :\n// FormalParameter\n// FormalParameterList `,` FormalParameter\nexport function IsSimpleParameterList_FormalParameterList(FormalParameterList) {\n for (const FormalParameter of FormalParameterList) {\n if (IsSimpleParameterList_FormalParameter(FormalParameter) === false) {\n return false;\n }\n }\n return true;\n}\n\n// TODO(TimothyGu): does not need to be explicitly declared\n// 14.1.13 #sec-function-definitions-static-semantics-issimpleparameterlist\n// FormalParameter : BindingElement\nexport const IsSimpleParameterList_FormalParameter = IsSimpleParameterList_BindingElement;\n","// 14.6.9 #sec-static-semantics-isstatic\n// ClassElement :\n// MethodDefinition\n// `static` MethodDefinition\n// `;`\nexport function IsStatic_ClassElement(ClassElement) {\n return ClassElement.static;\n}\n","import { isStrictModeCode } from '../abstract-ops/all.mjs';\n\nexport function IsStrict(node) {\n return isStrictModeCode(node);\n}\n","import {\n isDeclaration,\n isHoistableDeclaration,\n isStatement,\n} from '../ast.mjs';\nimport {\n BoundNames_Declaration,\n} from './BoundNames.mjs';\n\n// 13.2.7 #sec-block-static-semantics-toplevellexicallydeclarednames\n// StatementList : StatementList StatementListItem\n//\n// (implicit)\n// StatementList : StatementListItem\nexport function TopLevelLexicallyDeclaredNames_StatementList(StatementList) {\n const names = [];\n for (const StatementListItem of StatementList) {\n names.push(...TopLevelLexicallyDeclaredNames_StatementListItem(StatementListItem));\n }\n return names;\n}\n\n// 13.2.7 #sec-block-static-semantics-toplevellexicallydeclarednames\n// StatementListItem :\n// Statement\n// Declaration\nexport function TopLevelLexicallyDeclaredNames_StatementListItem(StatementListItem) {\n switch (true) {\n case isStatement(StatementListItem):\n return [];\n case isDeclaration(StatementListItem):\n if (isHoistableDeclaration(StatementListItem)) {\n return [];\n }\n return BoundNames_Declaration(StatementListItem);\n default:\n throw new TypeError(`Unexpected StatementListItem: ${StatementListItem.type}`);\n }\n}\n","import {\n isDeclaration,\n isFunctionDeclaration,\n isHoistableDeclaration,\n isLabelledStatement,\n isStatement,\n} from '../ast.mjs';\nimport {\n BoundNames_FunctionDeclaration,\n BoundNames_HoistableDeclaration,\n} from './BoundNames.mjs';\nimport { VarDeclaredNames_Statement } from './VarDeclaredNames.mjs';\n\n// 13.2.9 #sec-block-static-semantics-toplevelvardeclarednames\n// StatementList : StatementList StatementListItem\nexport function TopLevelVarDeclaredNames_StatementList(StatementList) {\n const names = [];\n for (const StatementListItem of StatementList) {\n names.push(...TopLevelVarDeclaredNames_StatementListItem(StatementListItem));\n }\n return names;\n}\n\n// 13.2.9 #sec-block-static-semantics-toplevelvardeclarednames\n// StatementListItem :\n// Declaration\n// Statement\nexport function TopLevelVarDeclaredNames_StatementListItem(StatementListItem) {\n switch (true) {\n case isDeclaration(StatementListItem):\n if (isHoistableDeclaration(StatementListItem)) {\n return BoundNames_HoistableDeclaration(StatementListItem);\n }\n return [];\n case isStatement(StatementListItem):\n if (isLabelledStatement(StatementListItem)) {\n return TopLevelVarDeclaredNames_LabelledStatement(StatementListItem);\n }\n return VarDeclaredNames_Statement(StatementListItem);\n default:\n throw new TypeError(`Unexpected StatementListItem: ${StatementListItem.type}`);\n }\n}\n\n// 13.13.10 #sec-labelled-statements-static-semantics-toplevelvardeclarednames\n// LabelledStatement : LabelIdentifier `:` LabelledItem\nexport function TopLevelVarDeclaredNames_LabelledStatement(LabelledStatement) {\n return TopLevelVarDeclaredNames_LabelledItem(LabelledStatement.body);\n}\n\n// 13.13.10 #sec-labelled-statements-static-semantics-toplevelvardeclarednames\n// LabelledItem :\n// Statement\n// FunctionDeclaration\nexport function TopLevelVarDeclaredNames_LabelledItem(LabelledItem) {\n switch (true) {\n case isStatement(LabelledItem):\n if (isLabelledStatement(LabelledItem)) {\n return TopLevelVarDeclaredNames_LabelledItem(LabelledItem.body);\n }\n return VarDeclaredNames_Statement(LabelledItem);\n case isFunctionDeclaration(LabelledItem):\n return BoundNames_FunctionDeclaration(LabelledItem);\n default:\n throw new TypeError(`Unexpected LabelledItem: ${LabelledItem.type}`);\n }\n}\n","import {\n isBlockStatement,\n isBreakStatement,\n isContinueStatement,\n isDebuggerStatement,\n isDeclaration,\n isEmptyStatement,\n isExportDeclaration,\n isExportDeclarationWithVariable,\n isExpressionBody,\n isExpressionStatement,\n isFunctionDeclaration,\n isIfStatement,\n isImportDeclaration,\n isIterationStatement,\n isLabelledStatement,\n isReturnStatement,\n isStatement,\n isSwitchStatement,\n isThrowStatement,\n isTryStatement,\n isVariableStatement,\n isWithStatement,\n} from '../ast.mjs';\nimport {\n BoundNames_ForBinding,\n BoundNames_VariableDeclarationList,\n BoundNames_VariableStatement,\n} from './BoundNames.mjs';\nimport {\n TopLevelVarDeclaredNames_StatementList,\n} from './TopLevelVarDeclaredNames.mjs';\n\n// 13.1.5 #sec-statement-semantics-static-semantics-vardeclarednames\n// Statement :\n// EmptyStatement\n// ExpressionStatement\n// ContinueStatement\n// ContinueStatement\n// BreakStatement\n// ReturnStatement\n// ThrowStatement\n// DebuggerStatement\n//\n// (implicit)\n// Statement :\n// BlockStatement\n// VariableStatement\n// IfStatement\n// BreakableStatement\n// WithStatement\n// LabelledStatement\n// TryStatement\n// BreakableStatement :\n// IterationStatement\n// SwitchStatement\nexport function VarDeclaredNames_Statement(Statement) {\n switch (true) {\n case isEmptyStatement(Statement):\n case isExpressionStatement(Statement):\n case isContinueStatement(Statement):\n case isBreakStatement(Statement):\n case isReturnStatement(Statement):\n case isThrowStatement(Statement):\n case isDebuggerStatement(Statement):\n return [];\n\n case isBlockStatement(Statement):\n return VarDeclaredNames_BlockStatement(Statement);\n case isVariableStatement(Statement):\n return VarDeclaredNames_VariableStatement(Statement);\n case isIfStatement(Statement):\n return VarDeclaredNames_IfStatement(Statement);\n case isWithStatement(Statement):\n return VarDeclaredNames_WithStatement(Statement);\n case isLabelledStatement(Statement):\n return VarDeclaredNames_LabelledStatement(Statement);\n case isTryStatement(Statement):\n return VarDeclaredNames_TryStatement(Statement);\n case isIterationStatement(Statement):\n return VarDeclaredNames_IterationStatement(Statement);\n case isSwitchStatement(Statement):\n return VarDeclaredNames_SwitchStatement(Statement);\n\n default:\n throw new TypeError(`Invalid Statement: ${Statement.type}`);\n }\n}\n\n// 13.2.11 #sec-block-static-semantics-vardeclarednames\n// StatementList : StatementList StatementListItem\n//\n// (implicit)\n// StatementList : StatementListItem\nexport function VarDeclaredNames_StatementList(StatementList) {\n const names = [];\n for (const StatementListItem of StatementList) {\n names.push(...VarDeclaredNames_StatementListItem(StatementListItem));\n }\n return names;\n}\n\n// 13.2.11 #sec-block-static-semantics-vardeclarednames\n// Block : `{` `}`\n//\n// (implicit)\n// Block : `{` StatementList `}`\nexport function VarDeclaredNames_Block(Block) {\n return VarDeclaredNames_StatementList(Block.body);\n}\n\n// (implicit)\n// BlockStatement : Block\nexport const VarDeclaredNames_BlockStatement = VarDeclaredNames_Block;\n\n// 13.2.11 #sec-block-static-semantics-vardeclarednames\n// StatementListItem : Declaration\n//\n// (implicit)\n// StatementListItem : Statement\nexport function VarDeclaredNames_StatementListItem(StatementListItem) {\n switch (true) {\n case isDeclaration(StatementListItem):\n return [];\n case isStatement(StatementListItem):\n return VarDeclaredNames_Statement(StatementListItem);\n default:\n throw new TypeError(`Unexpected StatementListItem: ${StatementListItem.type}`);\n }\n}\n\n// 13.3.2.2 #sec-variable-statement-static-semantics-vardeclarednames\n// VariableStatement : `var` VariableDeclarationList `;`\nexport const VarDeclaredNames_VariableStatement = BoundNames_VariableStatement;\n\n// 13.6.5 #sec-if-statement-static-semantics-vardeclarednames\n// IfStatement :\n// `if` `(` Expression `)` Statement `else` Statement\n// `if` `(` Expression `)` Statement\nexport function VarDeclaredNames_IfStatement(IfStatement) {\n if (IfStatement.alternate) {\n return [\n ...VarDeclaredNames_Statement(IfStatement.consequent),\n ...VarDeclaredNames_Statement(IfStatement.alternate),\n ];\n }\n return VarDeclaredNames_Statement(IfStatement.consequent);\n}\n\n// 13.7.2.4 #sec-do-while-statement-static-semantics-vardeclarednames\n// IterationStatement : `do` Statement `while` `(` Expression `)` `;`\n//\n// 13.7.3.4 #sec-while-statement-static-semantics-vardeclarednames\n// IterationStatement : `while` `(` Expression `)` Statement\n//\n// 13.7.4.5 #sec-for-statement-static-semantics-vardeclarednames\n// IterationStatement :\n// `for` `(` Expression `;` Expression `;` Expression `)` Statement\n// `for` `(` `var` VariableDeclarationList `;` Expression `;` Expression `)` Statement\n// `for` `(` LexicalDeclaration Expression `;` Expression `)` Statement\n//\n// 13.7.5.7 #sec-for-in-and-for-of-statements-static-semantics-vardeclarednames\n// IterationStatement :\n// `for` `(` LeftHandSideExpression `in` Expression `)` Statement\n// `for` `(` `var` ForBinding `in` Expression `)` Statement\n// `for` `(` ForDeclaration `in` Expression `)` Statement\n// `for` `(` LeftHandSideExpression `of` AssignmentExpression `)` Statement\n// `for` `await` `(` LeftHandSideExpression `of` AssignmentExpression `)` Statement\n// `for` `(` `var` ForBinding `of` AssignmentExpression `)` Statement\n// `for` `await` `(` `var` ForBinding `of` AssignmentExpression `)` Statement\n// `for` `(` ForDeclaration `of` Expression `)` Statement\n// `for` `await` `(` ForDeclaration `of` Expression `)` Statement\nexport function VarDeclaredNames_IterationStatement(IterationStatement) {\n let namesFromBinding = [];\n switch (IterationStatement.type) {\n case 'DoWhileStatement':\n case 'WhileStatement':\n break;\n case 'ForStatement':\n if (IterationStatement.init && isVariableStatement(IterationStatement.init)) {\n const VariableDeclarationList = IterationStatement.init.declarations;\n namesFromBinding = BoundNames_VariableDeclarationList(\n VariableDeclarationList,\n );\n }\n break;\n case 'ForInStatement':\n case 'ForOfStatement':\n // https://github.com/tc39/ecma262/pull/1284\n if (isVariableStatement(IterationStatement.left)) {\n const ForBinding = IterationStatement.left.declarations[0].id;\n namesFromBinding = BoundNames_ForBinding(ForBinding);\n }\n break;\n default:\n throw new TypeError(`Invalid IterationStatement: ${IterationStatement.type}`);\n }\n return [\n ...namesFromBinding,\n ...VarDeclaredNames_Statement(IterationStatement.body),\n ];\n}\n\n// 13.11.6 #sec-with-statement-static-semantics-varscopeddeclarations\n// WithStatement : `with` `(` Expression `)` Statement\nexport function VarDeclaredNames_WithStatement(WithStatement) {\n return VarDeclaredNames_Statement(WithStatement.body);\n}\n\n// 13.12.7 #sec-switch-statement-static-semantics-vardeclarednames\n// SwitchStatement : `switch` `(` Expression `)` CaseBlock\nexport function VarDeclaredNames_SwitchStatement(SwitchStatement) {\n return VarDeclaredNames_CaseBlock(SwitchStatement.cases);\n}\n\n// 13.12.7 #sec-switch-statement-static-semantics-vardeclarednames\n// CaseBlock :\n// `{` `}`\n// `{` CaseClauses_opt DefaultClause CaseClauses_opt `}`\n// CaseClauses : CaseClauses CaseClause\n// CaseClause : `case` Expression `:` StatementList_opt\n// DefaultClause : `default` `:` StatementList_opt\n//\n// (implicit)\n// CaseBlock : `{` CaseClauses `}`\n// CaseClauses : CaseClause\nexport function VarDeclaredNames_CaseBlock(CaseBlock) {\n const names = [];\n for (const CaseClauseOrDefaultClause of CaseBlock) {\n names.push(...VarDeclaredNames_StatementList(CaseClauseOrDefaultClause.consequent));\n }\n return names;\n}\n\n// 13.13.12 #sec-labelled-statements-static-semantics-vardeclarednames\n// LabelledStatement : LabelIdentifier `:` LabelledItem\n// LabelledItem : FunctionDeclaration\n//\n// (implicit)\n// LabelledItem : Statement\nexport function VarDeclaredNames_LabelledStatement(LabelledStatement) {\n const LabelledItem = LabelledStatement.body;\n switch (true) {\n case isFunctionDeclaration(LabelledItem):\n return [];\n case isStatement(LabelledItem):\n return VarDeclaredNames_Statement(LabelledItem);\n default:\n throw new TypeError(`Invalid LabelledItem: ${LabelledItem.type}`);\n }\n}\n\n// 13.15.5 #sec-try-statement-static-semantics-vardeclarednames\n// TryStatement :\n// `try` Block Catch\n// `try` Block Finally\n// `try` Block Catch Finally\n// Catch : `catch` `(` CatchParameter `)` Block\n//\n// (implicit)\n// Catch : `catch` Block\n// Finally : `finally` Block\nexport function VarDeclaredNames_TryStatement(TryStatement) {\n const namesBlock = VarDeclaredNames_Block(TryStatement.block);\n const namesCatch = TryStatement.handler !== null\n ? VarDeclaredNames_Block(TryStatement.handler.body) : [];\n const namesFinally = TryStatement.finalizer !== null\n ? VarDeclaredNames_Block(TryStatement.finalizer) : [];\n return [\n ...namesBlock,\n ...namesCatch,\n ...namesFinally,\n ];\n}\n\n// 14.1.16 #sec-function-definitions-static-semantics-vardeclarednames\n// FunctionStatementList :\n// [empty]\n// StatementList\nexport const VarDeclaredNames_FunctionStatementList = TopLevelVarDeclaredNames_StatementList;\n\n// (implicit)\n// FunctionBody : FunctionStatementList\nexport const VarDeclaredNames_FunctionBody = VarDeclaredNames_FunctionStatementList;\n\n// (implicit)\n// GeneratorBody : FunctionBody\nexport const VarDeclaredNames_GeneratorBody = VarDeclaredNames_FunctionBody;\n\n// (implicit)\n// AsyncFunctionBody : FunctionBody\nexport const VarDeclaredNames_AsyncFunctionBody = VarDeclaredNames_FunctionBody;\n\n// 14.2.12 #sec-arrow-function-definitions-static-semantics-vardeclarednames\n// ConciseBody : ExpressionBody\n//\n// (implicit)\n// ConciseBody : `{` FunctionBody `}`\nexport function VarDeclaredNames_ConciseBody(ConciseBody) {\n switch (true) {\n case isExpressionBody(ConciseBody):\n return [];\n case isBlockStatement(ConciseBody):\n return VarDeclaredNames_FunctionBody(ConciseBody.body);\n default:\n throw new TypeError(`Unexpected ConciseBody: ${ConciseBody.type}`);\n }\n}\n\n// 14.8.11 #sec-async-arrow-function-definitions-static-semantics-VarDeclaredNames\n// AsyncConciseBody : [lookahead ≠ `{`] ExpressionBody\n//\n// (implicit)\n// AsyncConciseBody : `{` AsyncFunctionBody `}`\n// AsyncFunctionBody : FunctionBody\nexport const VarDeclaredNames_AsyncConciseBody = VarDeclaredNames_ConciseBody;\n\n// 15.1.5 #sec-scripts-static-semantics-vardeclarednames\n// ScriptBody : StatementList\nexport const VarDeclaredNames_ScriptBody = TopLevelVarDeclaredNames_StatementList;\n\n// (implicit)\n// Script :\n// [empty]\n// ScriptBody\nexport const VarDeclaredNames_Script = VarDeclaredNames_ScriptBody;\n\n// 15.2.1.13 #sec-module-semantics-static-semantics-vardeclarednames\n// ModuleItemList : ModuleItemList ModuleItem\n//\n// (implicit)\n// ModuleItemList : ModuleItem\nexport function VarDeclaredNames_ModuleItemList(ModuleItemList) {\n const names = [];\n for (const ModuleItem of ModuleItemList) {\n names.push(...VarDeclaredNames_ModuleItem(ModuleItem));\n }\n return names;\n}\n\n// (implicit)\n// ModuleBody : ModuleItemList\nexport const VarDeclaredNames_ModuleBody = VarDeclaredNames_ModuleItemList;\n\n// 15.2.1.13 #sec-module-semantics-static-semantics-vardeclarednames\n// Module : [empty]\n//\n// (implicit)\n// Module : ModuleBody\nexport const VarDeclaredNames_Module = VarDeclaredNames_ModuleBody;\n\n// 15.2.1.13 #sec-module-semantics-static-semantics-vardeclarednames\n// ModuleItem :\n// ImportDeclaration\n// ExportDeclaration\n//\n// (implicit)\n// ModuleItem : StatementListItem\nexport function VarDeclaredNames_ModuleItem(ModuleItem) {\n switch (true) {\n case isImportDeclaration(ModuleItem):\n return [];\n case isExportDeclaration(ModuleItem):\n if (isExportDeclarationWithVariable(ModuleItem)) {\n return BoundNames_VariableStatement(ModuleItem.declaration);\n }\n return [];\n default:\n return VarDeclaredNames_StatementListItem(ModuleItem);\n }\n}\n","import {\n isBlockStatement,\n isDeclaration,\n isExpressionBody,\n isFunctionDeclaration,\n isLabelledStatement,\n isStatement,\n} from '../ast.mjs';\nimport {\n TopLevelLexicallyDeclaredNames_StatementList,\n} from './TopLevelLexicallyDeclaredNames.mjs';\nimport {\n BoundNames_Declaration,\n BoundNames_FunctionDeclaration,\n} from './BoundNames.mjs';\nimport {\n VarDeclaredNames_StatementListItem,\n} from './VarDeclaredNames.mjs';\n\n// 13.2.5 #sec-block-static-semantics-lexicallydeclarednames\n// StatementList : StatementList StatementListItem\n//\n// (implicit)\n// StatementList : StatementListItem\nexport function LexicallyDeclaredNames_StatementList(StatementList) {\n const names = [];\n for (const StatementListItem of StatementList) {\n names.push(...LexicallyDeclaredNames_StatementListItem(StatementListItem));\n }\n return names;\n}\n\n// 13.2.5 #sec-block-static-semantics-lexicallydeclarednames\n// StatementListItem :\n// Statement\n// Declaration\nexport function LexicallyDeclaredNames_StatementListItem(StatementListItem) {\n switch (true) {\n case isStatement(StatementListItem):\n if (isLabelledStatement(StatementListItem)) {\n return LexicallyDeclaredNames_LabelledStatement(StatementListItem);\n }\n return VarDeclaredNames_StatementListItem(StatementListItem);\n case isDeclaration(StatementListItem):\n return BoundNames_Declaration(StatementListItem);\n default:\n throw new TypeError(`Unexpected StatementListItem: ${StatementListItem.type}`);\n }\n}\n\n// 13.13.10 #sec-labelled-statements-static-semantics-toplevelvardeclarednames\n// LabelledStatement : LabelIdentifier `:` LabelledItem\nexport function LexicallyDeclaredNames_LabelledStatement(LabelledStatement) {\n return LexicallyDeclaredNames_LabelledItem(LabelledStatement.body);\n}\n\n// 13.13.10 #sec-labelled-statements-static-semantics-toplevelvardeclarednames\n// LabelledItem :\n// Statement\n// FunctionDeclaration\nexport function LexicallyDeclaredNames_LabelledItem(LabelledItem) {\n switch (true) {\n case isStatement(LabelledItem):\n return [];\n case isFunctionDeclaration(LabelledItem):\n return BoundNames_FunctionDeclaration(LabelledItem);\n default:\n throw new TypeError(`Unexpected LabelledItem: ${LabelledItem.type}`);\n }\n}\n\n// 14.1.14 #sec-function-definitions-static-semantics-lexicallydeclarednames\n// FunctionStatementList :\n// [empty]\n// StatementList\nexport const\n LexicallyDeclaredNames_FunctionStatementList = TopLevelLexicallyDeclaredNames_StatementList;\n\n// (implicit)\n// FunctionBody : FunctionStatementList\nexport const LexicallyDeclaredNames_FunctionBody = LexicallyDeclaredNames_FunctionStatementList;\n\n// (implicit)\n// GeneratorBody : FunctionBody\nexport const LexicallyDeclaredNames_GeneratorBody = LexicallyDeclaredNames_FunctionBody;\n\n// (implicit)\n// AsyncFunctionBody : FunctionBody\nexport const LexicallyDeclaredNames_AsyncFunctionBody = LexicallyDeclaredNames_FunctionBody;\n\n// (implicit)\n// AsyncGeneratorBody : FunctionBody\nexport const LexicallyDeclaredNames_AsyncGeneratorBody = LexicallyDeclaredNames_FunctionBody;\n\n// 14.2.10 #sec-arrow-function-definitions-static-semantics-lexicallydeclarednames\n// ConciseBody : ExpressionBody\n//\n// (implicit)\n// ConciseBody : `{` FunctionBody `}`\nexport function LexicallyDeclaredNames_ConciseBody(ConciseBody) {\n switch (true) {\n case isExpressionBody(ConciseBody):\n return [];\n case isBlockStatement(ConciseBody):\n return LexicallyDeclaredNames_FunctionBody(ConciseBody.body);\n default:\n throw new TypeError(`Unexpected ConciseBody: ${ConciseBody.type}`);\n }\n}\n\n// 14.8.9 #sec-async-arrow-function-definitions-static-semantics-LexicallyDeclaredNames\n// AsyncConciseBody : [lookahead ≠ `{`] ExpressionBody\n//\n// (implicit)\n// AsyncConciseBody : `{` AsyncFunctionBody `}`\n// AsyncFunctionBody : FunctionBody\nexport const LexicallyDeclaredNames_AsyncConciseBody = LexicallyDeclaredNames_ConciseBody;\n\n// 15.1.3 #sec-scripts-static-semantics-lexicallydeclarednames\n// ScriptBody : StatementList\nexport const LexicallyDeclaredNames_ScriptBody = TopLevelLexicallyDeclaredNames_StatementList;\n","import {\n isBlockStatement,\n isDeclaration,\n isExpressionBody,\n isFunctionDeclaration,\n isLabelledStatement,\n isStatement,\n isSwitchCase,\n isImportDeclaration,\n isExportDeclaration,\n isExportDeclarationWithStar,\n isExportDeclarationWithVariable,\n isExportDeclarationWithDeclaration,\n isExportDeclarationWithExport,\n isExportDeclarationWithExportAndFrom,\n isExportDeclarationWithDefaultAndHoistable,\n isExportDeclarationWithDefaultAndClass,\n isExportDeclarationWithDefaultAndExpression,\n isStatementListItem,\n} from '../ast.mjs';\nimport { OutOfRange } from '../helpers.mjs';\nimport {\n DeclarationPart_Declaration,\n DeclarationPart_HoistableDeclaration,\n TopLevelLexicallyScopedDeclarations_StatementList,\n} from './all.mjs';\n\n// 13.2.6 #sec-block-static-semantics-lexicallyscopeddeclarations\n// StatementList : StatementList StatementListItem\n//\n// (implicit)\n// StatementList : StatementListItem\nexport function LexicallyScopedDeclarations_StatementList(StatementList) {\n const declarations = [];\n for (const StatementListItem of StatementList) {\n declarations.push(...LexicallyScopedDeclarations_StatementListItem(StatementListItem));\n }\n return declarations;\n}\n\n// 13.2.6 #sec-block-static-semantics-lexicallyscopeddeclarations\n// StatementListItem :\n// Statement\n// Declaration\nexport function LexicallyScopedDeclarations_StatementListItem(StatementListItem) {\n switch (true) {\n case isStatement(StatementListItem):\n if (isLabelledStatement(StatementListItem)) {\n return LexicallyScopedDeclarations_LabelledStatement(StatementListItem);\n }\n return [];\n case isDeclaration(StatementListItem):\n return [DeclarationPart_Declaration(StatementListItem)];\n case isSwitchCase(StatementListItem):\n return LexicallyScopedDeclarations_StatementList(StatementListItem.consequent);\n default:\n throw new TypeError(`Unexpected StatementListItem: ${StatementListItem.type}`);\n }\n}\n\n// 13.13.7 #sec-labelled-statements-static-semantics-lexicallyscopeddeclarations\n// LabelledStatement : LabelIdentifier `:` LabelledItem\nexport function LexicallyScopedDeclarations_LabelledStatement(LabelledStatement) {\n return LexicallyScopedDeclarations_LabelledItem(LabelledStatement.body);\n}\n\n// 13.13.7 #sec-labelled-statements-static-semantics-lexicallyscopeddeclarations\n// LabelledItem :\n// Statement\n// FunctionDeclaration\nexport function LexicallyScopedDeclarations_LabelledItem(LabelledItem) {\n switch (true) {\n case isStatement(LabelledItem):\n return [];\n case isFunctionDeclaration(LabelledItem):\n return [LabelledItem];\n default:\n throw new TypeError(`Unexpected LabelledItem: ${LabelledItem.type}`);\n }\n}\n\n// 14.1.14 #sec-function-definitions-static-semantics-lexicallydeclarednames\n// FunctionStatementList :\n// [empty]\n// StatementList\nexport const // eslint-disable-next-line max-len\n LexicallyScopedDeclarations_FunctionStatementList = TopLevelLexicallyScopedDeclarations_StatementList;\n\n// (implicit)\n// FunctionBody : FunctionStatementList\nexport const LexicallyScopedDeclarations_FunctionBody = LexicallyScopedDeclarations_FunctionStatementList;\n\n// (implicit)\n// GeneratorBody : FunctionBody\n// AsyncFunctionBody : FunctionBody\nexport const LexicallyScopedDeclarations_GeneratorBody = LexicallyScopedDeclarations_FunctionBody;\nexport const LexicallyScopedDeclarations_AsyncFunctionBody = LexicallyScopedDeclarations_FunctionBody;\n\n// 14.2.11 #sec-arrow-function-definitions-static-semantics-lexicallyscopeddeclarations\n// ConciseBody : ExpressionBody\n//\n// (implicit)\n// ConciseBody : `{` FunctionBody `}`\nexport function LexicallyScopedDeclarations_ConciseBody(ConciseBody) {\n switch (true) {\n case isExpressionBody(ConciseBody):\n return [];\n case isBlockStatement(ConciseBody):\n return LexicallyScopedDeclarations_FunctionBody(ConciseBody.body);\n default:\n throw new TypeError(`Unexpected ConciseBody: ${ConciseBody.type}`);\n }\n}\n\n// 14.8.10 #sec-async-arrow-function-definitions-static-semantics-LexicallyScopedDeclarations\n// AsyncConciseBody : [lookahead ≠ `{`] ExpressionBody\n//\n// (implicit)\n// AsyncConciseBody : `{` AsyncFunctionBody `}`\n// AsyncFunctionBody : FunctionBody\nexport const LexicallyScopedDeclarations_AsyncConciseBody = LexicallyScopedDeclarations_ConciseBody;\n\n// 15.1.4 #sec-scripts-static-semantics-lexicallyscopeddeclarations\n// ScriptBody : StatementList\nexport const LexicallyScopedDeclarations_ScriptBody = TopLevelLexicallyScopedDeclarations_StatementList;\n\n// 15.2.3.8 #sec-exports-static-semantics-lexicallyscopeddeclarations\n// ExportDeclaration :\n// `export` `*` FromClause `;`\n// `export` ExportClause FromClause `;`\n// `export` ExportClause `;`\n// `export` VariableStatement\n// `export` Declaration\n// `export` `default` HoistableDeclaration\n// `export` `default` ClassDeclaration\n// `export` `default` AssignmentExpression `;`\nexport function LexicallyScopedDeclarations_ExportDeclaration(ExportDeclaration) {\n switch (true) {\n case isExportDeclarationWithStar(ExportDeclaration):\n case isExportDeclarationWithExportAndFrom(ExportDeclaration):\n case isExportDeclarationWithExport(ExportDeclaration):\n case isExportDeclarationWithVariable(ExportDeclaration):\n return [];\n case isExportDeclarationWithDeclaration(ExportDeclaration):\n return [DeclarationPart_Declaration(ExportDeclaration.declaration)];\n case isExportDeclarationWithDefaultAndHoistable(ExportDeclaration):\n return [DeclarationPart_HoistableDeclaration(ExportDeclaration.declaration)];\n case isExportDeclarationWithDefaultAndClass(ExportDeclaration):\n return [ExportDeclaration.declaration];\n case isExportDeclarationWithDefaultAndExpression(ExportDeclaration):\n return [ExportDeclaration];\n default:\n throw new OutOfRange('LexicallyScopedDeclarations_ExportDeclaration', ExportDeclaration);\n }\n}\n\n// 15.2.1.12 #sec-module-semantics-static-semantics-lexicallyscopeddeclarations\n// ModuleItem : ImportDeclaration\n//\n// (implicit)\n// ModuleItem :\n// ExportDeclaration\n// StatementListItem\nexport function LexicallyScopedDeclarations_ModuleItem(ModuleItem) {\n switch (true) {\n case isImportDeclaration(ModuleItem):\n return [];\n case isExportDeclaration(ModuleItem):\n return LexicallyScopedDeclarations_ExportDeclaration(ModuleItem);\n case isStatementListItem(ModuleItem):\n return LexicallyScopedDeclarations_StatementListItem(ModuleItem);\n default:\n throw new OutOfRange('LexicallyScopedDeclarations_ModuleItem', ModuleItem);\n }\n}\n\n// 15.2.1.12 #sec-module-semantics-static-semantics-lexicallyscopeddeclarations\n// ModuleItemList : ModuleItemList ModuleItem\n//\n// (implicit)\n// ModuleItemList : ModuleItem\nexport function LexicallyScopedDeclarations_ModuleItemList(ModuleItemList) {\n const declarations = [];\n for (const ModuleItem of ModuleItemList) {\n declarations.push(...LexicallyScopedDeclarations_ModuleItem(ModuleItem));\n }\n return declarations;\n}\n\n// (implicit)\n// ModuleBody : ModuleItemList\nexport const LexicallyScopedDeclarations_ModuleBody = LexicallyScopedDeclarations_ModuleItemList;\n\n// 15.2.1.12 #sec-module-semantics-static-semantics-lexicallyscopeddeclarations\n// Module : [empty]\n//\n// (implicit)\n// Module : ModuleBody\nexport const LexicallyScopedDeclarations_Module = LexicallyScopedDeclarations_ModuleBody;\n","(function(root, factory) {\n if (typeof module === 'object' && module.exports) {\n module.exports = factory();\n } else {\n root.nearley = factory();\n }\n}(this, function() {\n\n function Rule(name, symbols, postprocess) {\n this.id = ++Rule.highestId;\n this.name = name;\n this.symbols = symbols; // a list of literal | regex class | nonterminal\n this.postprocess = postprocess;\n return this;\n }\n Rule.highestId = 0;\n\n Rule.prototype.toString = function(withCursorAt) {\n function stringifySymbolSequence (e) {\n return e.literal ? JSON.stringify(e.literal) :\n e.type ? '%' + e.type : e.toString();\n }\n var symbolSequence = (typeof withCursorAt === \"undefined\")\n ? this.symbols.map(stringifySymbolSequence).join(' ')\n : ( this.symbols.slice(0, withCursorAt).map(stringifySymbolSequence).join(' ')\n + \" ● \"\n + this.symbols.slice(withCursorAt).map(stringifySymbolSequence).join(' ') );\n return this.name + \" → \" + symbolSequence;\n }\n\n\n // a State is a rule at a position from a given starting point in the input stream (reference)\n function State(rule, dot, reference, wantedBy) {\n this.rule = rule;\n this.dot = dot;\n this.reference = reference;\n this.data = [];\n this.wantedBy = wantedBy;\n this.isComplete = this.dot === rule.symbols.length;\n }\n\n State.prototype.toString = function() {\n return \"{\" + this.rule.toString(this.dot) + \"}, from: \" + (this.reference || 0);\n };\n\n State.prototype.nextState = function(child) {\n var state = new State(this.rule, this.dot + 1, this.reference, this.wantedBy);\n state.left = this;\n state.right = child;\n if (state.isComplete) {\n state.data = state.build();\n }\n return state;\n };\n\n State.prototype.build = function() {\n var children = [];\n var node = this;\n do {\n children.push(node.right.data);\n node = node.left;\n } while (node.left);\n children.reverse();\n return children;\n };\n\n State.prototype.finish = function() {\n if (this.rule.postprocess) {\n this.data = this.rule.postprocess(this.data, this.reference, Parser.fail);\n }\n };\n\n\n function Column(grammar, index) {\n this.grammar = grammar;\n this.index = index;\n this.states = [];\n this.wants = {}; // states indexed by the non-terminal they expect\n this.scannable = []; // list of states that expect a token\n this.completed = {}; // states that are nullable\n }\n\n\n Column.prototype.process = function(nextColumn) {\n var states = this.states;\n var wants = this.wants;\n var completed = this.completed;\n\n for (var w = 0; w < states.length; w++) { // nb. we push() during iteration\n var state = states[w];\n\n if (state.isComplete) {\n state.finish();\n if (state.data !== Parser.fail) {\n // complete\n var wantedBy = state.wantedBy;\n for (var i = wantedBy.length; i--; ) { // this line is hot\n var left = wantedBy[i];\n this.complete(left, state);\n }\n\n // special-case nullables\n if (state.reference === this.index) {\n // make sure future predictors of this rule get completed.\n var exp = state.rule.name;\n (this.completed[exp] = this.completed[exp] || []).push(state);\n }\n }\n\n } else {\n // queue scannable states\n var exp = state.rule.symbols[state.dot];\n if (typeof exp !== 'string') {\n this.scannable.push(state);\n continue;\n }\n\n // predict\n if (wants[exp]) {\n wants[exp].push(state);\n\n if (completed.hasOwnProperty(exp)) {\n var nulls = completed[exp];\n for (var i = 0; i < nulls.length; i++) {\n var right = nulls[i];\n this.complete(state, right);\n }\n }\n } else {\n wants[exp] = [state];\n this.predict(exp);\n }\n }\n }\n }\n\n Column.prototype.predict = function(exp) {\n var rules = this.grammar.byName[exp] || [];\n\n for (var i = 0; i < rules.length; i++) {\n var r = rules[i];\n var wantedBy = this.wants[exp];\n var s = new State(r, 0, this.index, wantedBy);\n this.states.push(s);\n }\n }\n\n Column.prototype.complete = function(left, right) {\n var copy = left.nextState(right);\n this.states.push(copy);\n }\n\n\n function Grammar(rules, start) {\n this.rules = rules;\n this.start = start || this.rules[0].name;\n var byName = this.byName = {};\n this.rules.forEach(function(rule) {\n if (!byName.hasOwnProperty(rule.name)) {\n byName[rule.name] = [];\n }\n byName[rule.name].push(rule);\n });\n }\n\n // So we can allow passing (rules, start) directly to Parser for backwards compatibility\n Grammar.fromCompiled = function(rules, start) {\n var lexer = rules.Lexer;\n if (rules.ParserStart) {\n start = rules.ParserStart;\n rules = rules.ParserRules;\n }\n var rules = rules.map(function (r) { return (new Rule(r.name, r.symbols, r.postprocess)); });\n var g = new Grammar(rules, start);\n g.lexer = lexer; // nb. storing lexer on Grammar is iffy, but unavoidable\n return g;\n }\n\n\n function StreamLexer() {\n this.reset(\"\");\n }\n\n StreamLexer.prototype.reset = function(data, state) {\n this.buffer = data;\n this.index = 0;\n this.line = state ? state.line : 1;\n this.lastLineBreak = state ? -state.col : 0;\n }\n\n StreamLexer.prototype.next = function() {\n if (this.index < this.buffer.length) {\n var ch = this.buffer[this.index++];\n if (ch === '\\n') {\n this.line += 1;\n this.lastLineBreak = this.index;\n }\n return {value: ch};\n }\n }\n\n StreamLexer.prototype.save = function() {\n return {\n line: this.line,\n col: this.index - this.lastLineBreak,\n }\n }\n\n StreamLexer.prototype.formatError = function(token, message) {\n // nb. this gets called after consuming the offending token,\n // so the culprit is index-1\n var buffer = this.buffer;\n if (typeof buffer === 'string') {\n var nextLineBreak = buffer.indexOf('\\n', this.index);\n if (nextLineBreak === -1) nextLineBreak = buffer.length;\n var line = buffer.substring(this.lastLineBreak, nextLineBreak)\n var col = this.index - this.lastLineBreak;\n message += \" at line \" + this.line + \" col \" + col + \":\\n\\n\";\n message += \" \" + line + \"\\n\"\n message += \" \" + Array(col).join(\" \") + \"^\"\n return message;\n } else {\n return message + \" at index \" + (this.index - 1);\n }\n }\n\n\n function Parser(rules, start, options) {\n if (rules instanceof Grammar) {\n var grammar = rules;\n var options = start;\n } else {\n var grammar = Grammar.fromCompiled(rules, start);\n }\n this.grammar = grammar;\n\n // Read options\n this.options = {\n keepHistory: false,\n lexer: grammar.lexer || new StreamLexer,\n };\n for (var key in (options || {})) {\n this.options[key] = options[key];\n }\n\n // Setup lexer\n this.lexer = this.options.lexer;\n this.lexerState = undefined;\n\n // Setup a table\n var column = new Column(grammar, 0);\n var table = this.table = [column];\n\n // I could be expecting anything.\n column.wants[grammar.start] = [];\n column.predict(grammar.start);\n // TODO what if start rule is nullable?\n column.process();\n this.current = 0; // token index\n }\n\n // create a reserved token for indicating a parse fail\n Parser.fail = {};\n\n Parser.prototype.feed = function(chunk) {\n var lexer = this.lexer;\n lexer.reset(chunk, this.lexerState);\n\n var token;\n while (token = lexer.next()) {\n // We add new states to table[current+1]\n var column = this.table[this.current];\n\n // GC unused states\n if (!this.options.keepHistory) {\n delete this.table[this.current - 1];\n }\n\n var n = this.current + 1;\n var nextColumn = new Column(this.grammar, n);\n this.table.push(nextColumn);\n\n // Advance all tokens that expect the symbol\n var literal = token.text !== undefined ? token.text : token.value;\n var value = lexer.constructor === StreamLexer ? token.value : token;\n var scannable = column.scannable;\n for (var w = scannable.length; w--; ) {\n var state = scannable[w];\n var expect = state.rule.symbols[state.dot];\n // Try to consume the token\n // either regex or literal\n if (expect.test ? expect.test(value) :\n expect.type ? expect.type === token.type\n : expect.literal === literal) {\n // Add it\n var next = state.nextState({data: value, token: token, isToken: true, reference: n - 1});\n nextColumn.states.push(next);\n }\n }\n\n // Next, for each of the rules, we either\n // (a) complete it, and try to see if the reference row expected that\n // rule\n // (b) predict the next nonterminal it expects by adding that\n // nonterminal's start state\n // To prevent duplication, we also keep track of rules we have already\n // added\n\n nextColumn.process();\n\n // If needed, throw an error:\n if (nextColumn.states.length === 0) {\n // No states at all! This is not good.\n var message = this.lexer.formatError(token, \"invalid syntax\") + \"\\n\";\n message += \"Unexpected \" + (token.type ? token.type + \" token: \" : \"\");\n message += JSON.stringify(token.value !== undefined ? token.value : token) + \"\\n\";\n var err = new Error(message);\n err.offset = this.current;\n err.token = token;\n throw err;\n }\n\n // maybe save lexer state\n if (this.options.keepHistory) {\n column.lexerState = lexer.save()\n }\n\n this.current++;\n }\n if (column) {\n this.lexerState = lexer.save()\n }\n\n // Incrementally keep track of results\n this.results = this.finish();\n\n // Allow chaining, for whatever it's worth\n return this;\n };\n\n Parser.prototype.save = function() {\n var column = this.table[this.current];\n column.lexerState = this.lexerState;\n return column;\n };\n\n Parser.prototype.restore = function(column) {\n var index = column.index;\n this.current = index;\n this.table[index] = column;\n this.table.splice(index + 1);\n this.lexerState = column.lexerState;\n\n // Incrementally keep track of results\n this.results = this.finish();\n };\n\n // nb. deprecated: use save/restore instead!\n Parser.prototype.rewind = function(index) {\n if (!this.options.keepHistory) {\n throw new Error('set option `keepHistory` to enable rewinding')\n }\n // nb. recall column (table) indicies fall between token indicies.\n // col 0 -- token 0 -- col 1\n this.restore(this.table[index]);\n };\n\n Parser.prototype.finish = function() {\n // Return the possible parsings\n var considerations = [];\n var start = this.grammar.start;\n var column = this.table[this.table.length - 1]\n column.states.forEach(function (t) {\n if (t.rule.name === start\n && t.dot === t.rule.symbols.length\n && t.reference === 0\n && t.data !== Parser.fail) {\n considerations.push(t);\n }\n });\n return considerations.map(function(c) {return c.data; });\n };\n\n return {\n Parser: Parser,\n Grammar: Grammar,\n Rule: Rule,\n };\n\n}));\n","/* eslint-disable no-bitwise */\n\n// Divide a non-negative `num` by a positive `den`. The quotient is rounded to\n// its nearest integer, or the even integer if there are two equally near\n// integer.\nfunction roundQuotientBigInt(num, den) {\n const quo = num / den;\n const rem = num % den;\n const rem2 = rem * 2n;\n if (rem2 > den || (rem2 === den && quo % 2n !== 0n)) {\n return quo + 1n;\n } else {\n return quo;\n }\n}\n\nconst throwawayArray = new Float64Array(1);\nconst throwawayArrayInt = new Uint32Array(throwawayArray.buffer);\n\n// Find out if the host's [[BigEndian]] is true or false, by checking the\n// representation for -0.\nthrowawayArray[0] = -0;\nconst float64High = throwawayArrayInt[0] === 0 ? 1 : 0;\n\n// Return x * 2 ** exp where x is a Number, and exp is an integer.\n//\n// Derived from\n// https://github.com/JuliaMath/openlibm/blob/0f22aeb0a9104c52106f42ce1fa8ebe96fb498f1/src/s_scalbn.c.\n//\n// License:\n//\n// Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n// Developed at SunPro, a Sun Microsystems, Inc. business.\n// Permission to use, copy, modify, and distribute this\n// software is freely granted, provided that this notice\n// is preserved.\nfunction scalb(x, exp) {\n if (x === 0 || exp === 0 || !Number.isFinite(x)) {\n return x;\n }\n if (exp >= 2000) {\n return x * Infinity;\n } else if (exp <= -2000) {\n return x * 0;\n }\n\n throwawayArray[0] = x;\n let origExp = (throwawayArrayInt[float64High] >>> 20) & 0x7ff;\n if (origExp === 0) {\n // x is denormalized. Multiply x by 2**54 (1 + number of mantissa bits),\n // and correspondingly reduce exp by 54.\n throwawayArray[0] *= 18014398509481984;\n exp -= 54;\n if (exp === 0) return throwawayArray[0];\n origExp = (throwawayArrayInt[float64High] >>> 20) & 0x7ff;\n }\n const newExp = origExp + exp;\n if (newExp > 0x7fe) {\n // Overflow. Return Infinity, but of the appropriate sign.\n return throwawayArray[0] * Infinity;\n }\n if (newExp > 0) {\n // Normalized, okay.\n throwawayArrayInt[float64High] ^= (origExp ^ newExp) << 20;\n return throwawayArray[0];\n }\n if (newExp <= -54) {\n // Underflow. Return 0, but of the appropriate sign.\n return throwawayArray[0] * 0;\n }\n // Denormalized result. Add 54 to newExp and multiply the resultant number by\n // 2**-54.\n throwawayArrayInt[float64High] ^= (origExp ^ (newExp + 54)) << 20;\n return throwawayArray[0] * 5.55111512312578270212e-17;\n}\n\n// Return the minimum number of bits it takes to store `bint`. This function\n// assumes a host implementation on which a BigInt value cannot exceed 2^(4n),\n// where n is the maximum length of a String value on that host (usually around\n// 2^31, but can be up to 2^53 - 1 by spec).\nfunction bitLengthBigInt(bint) {\n if (bint < 0n) {\n bint = -bint;\n }\n let increment = 0;\n if (bint > ((1n << 32n) - 1n)) {\n // This number is larger than 2^32 - 1, which is just huge. Let's form an\n // estimate of how many bits it requires first, accurate to the nearest\n // multiple of log2(16) = 4, by converting it to a hexadecimal string and\n // measuring the resulting length.\n const hexLength = bint.toString(16).length;\n const estimatedBitLength = (hexLength - 1) * 4;\n increment += estimatedBitLength;\n bint >>= BigInt(estimatedBitLength);\n }\n // As we are sure that bint is within the range of an unsigned 32-bit\n // integer, we can use Math.clz32().\n return 32 - Math.clz32(Number(bint)) + increment;\n}\n\nfunction approximateLog10BigInt(bint) {\n return bint.toString(10).length;\n}\n\n// Number of mantissa bits in a IEEE 754-2008 binary64 value.\nconst MANTISSA_BITS = 53;\n\n// A class representing a decimal number in scientific notation, or otherwise\n// known as a decimal floating-point number.\nexport default class Scientific {\n constructor(num, exp = 0n) {\n if (typeof num !== 'bigint') { // eslint-disable-line valid-typeof\n throw new TypeError('Numerator must be a BigInt');\n }\n if (typeof exp !== 'bigint') { // eslint-disable-line valid-typeof\n throw new TypeError('Numerator must be a BigInt');\n }\n this.num = num;\n this.exp = exp;\n }\n\n negate() {\n return new this.constructor(-this.num, this.exp);\n }\n\n convExp(exp) {\n if (this.exp === exp) {\n return this;\n } else if (this.exp > exp) {\n return new this.constructor(this.num * (10n ** (this.exp - exp)), exp);\n }\n throw new RangeError('Requested exponent must be less than or equal to the current exponent');\n }\n\n expAdd(e) {\n return new this.constructor(this.num, this.exp + e);\n }\n\n addSci(sci) {\n const expectedExp = this.exp < sci.exp ? this.exp : sci.exp;\n const conv1 = this.convExp(expectedExp);\n const conv2 = sci.convExp(expectedExp);\n return new this.constructor(conv1.num + conv2.num, expectedExp);\n }\n\n // Derived from \"Easy Accurate Reading and Writing of Floating-Point Numbers\"\n // by Aubrey Jaffer, .\n toNumber() {\n if (this.num === 0n) {\n return 0;\n }\n\n if (this.num < 0) {\n return -new this.constructor(-this.num, this.exp).toNumber();\n }\n\n let { num, exp } = this;\n\n // According to V8, the \"Maximum number of significant digits in decimal\n // representation\" for a binary64 value is 772. See [1]. Let's first make\n // sure we have a reasonably small this.num (≤ 10**800) while not losing\n // accuracy, so that we can fast-path numbers with astronomical exponents.\n //\n // [1]: https://cs.chromium.org/chromium/src/v8/src/conversions.cc?l=565-571&rcl=dadf4cbe89c1e9ee9fed6181216cb4d3ba647a68\n const approximateDecimalDigits = approximateLog10BigInt(this.num);\n if (approximateDecimalDigits > 800) {\n const comp = BigInt(approximateDecimalDigits - 800);\n // We don't care about rounding as we still have quite a large margin of\n // error.\n num /= 10n ** comp;\n exp += comp;\n }\n\n if (exp > 310n) {\n // Largest possible value is < 2e308.\n return Infinity;\n } else if (exp < -1150n) {\n // Smallest possible value is 5e-324, but num may be at most 1e801, so we\n // are slightly more careful and only fast-path truly miniscule\n // exponents.\n return 0;\n }\n\n const expNum = Number(exp);\n if (expNum >= 0) {\n const numScaled = num * (5n ** exp);\n const bex = bitLengthBigInt(numScaled) - MANTISSA_BITS;\n if (bex <= 0) {\n return scalb(Number(numScaled), expNum);\n }\n const quo = roundQuotientBigInt(numScaled, 1n << BigInt(bex));\n return scalb(Number(quo), bex + expNum);\n }\n const scl = 5n ** -exp;\n let mantlen = MANTISSA_BITS;\n let bex = bitLengthBigInt(num) - bitLengthBigInt(scl) - mantlen;\n const tmp = bex + expNum + 1021 + mantlen;\n if (tmp < 0) {\n bex -= tmp + 1;\n mantlen += tmp;\n }\n const numScaled = num << BigInt(-bex);\n let quo = roundQuotientBigInt(numScaled, scl);\n if (bitLengthBigInt(quo) > mantlen) {\n bex += 1;\n quo = roundQuotientBigInt(numScaled, scl << 1n);\n }\n return scalb(Number(quo), bex + expNum);\n }\n}\n","// Generated automatically by nearley, version 2.19.0\n// http://github.com/Hardmath123/nearley\nfunction id(x) { return x[0]; }\n\nimport Scientific from './Scientific.mjs';\nfunction c(val) {\n return () => val;\n}\nlet Lexer = undefined;\nlet ParserRules = [\n {\"name\": \"StrNumericLiteral\", \"symbols\": [\"StrDecimalLiteral\"], \"postprocess\": ([StrDecimalLiteral]) => StrDecimalLiteral},\n {\"name\": \"StrNumericLiteral\", \"symbols\": [\"BinaryIntegerLiteral\"], \"postprocess\": ([BinaryIntegerLiteral]) => BinaryIntegerLiteral},\n {\"name\": \"StrNumericLiteral\", \"symbols\": [\"OctalIntegerLiteral\"], \"postprocess\": ([OctalIntegerLiteral]) => OctalIntegerLiteral},\n {\"name\": \"StrNumericLiteral\", \"symbols\": [\"HexIntegerLiteral\"], \"postprocess\": ([HexIntegerLiteral]) => HexIntegerLiteral},\n {\"name\": \"StrDecimalLiteral\", \"symbols\": [\"StrUnsignedDecimalLiteral\"], \"postprocess\": ([StrUnsignedDecimalLiteral]) => StrUnsignedDecimalLiteral},\n {\"name\": \"StrDecimalLiteral\", \"symbols\": [{\"literal\":\"+\"}, \"StrUnsignedDecimalLiteral\"], \"postprocess\": ([_, StrUnsignedDecimalLiteral]) => StrUnsignedDecimalLiteral},\n {\"name\": \"StrDecimalLiteral\", \"symbols\": [{\"literal\":\"-\"}, \"StrUnsignedDecimalLiteral\"], \"postprocess\": ([_, StrUnsignedDecimalLiteral]) => StrUnsignedDecimalLiteral.negate()},\n {\"name\": \"StrUnsignedDecimalLiteral$string$1\", \"symbols\": [{\"literal\":\"I\"}, {\"literal\":\"n\"}, {\"literal\":\"f\"}, {\"literal\":\"i\"}, {\"literal\":\"n\"}, {\"literal\":\"i\"}, {\"literal\":\"t\"}, {\"literal\":\"y\"}], \"postprocess\": function joiner(d) {return d.join('');}},\n {\"name\": \"StrUnsignedDecimalLiteral\", \"symbols\": [\"StrUnsignedDecimalLiteral$string$1\"], \"postprocess\": () => new Scientific(1n, 10000n)},\n {\"name\": \"StrUnsignedDecimalLiteral\", \"symbols\": [\"DecimalDigits\", {\"literal\":\".\"}], \"postprocess\": ([[DecimalDigits]]) => new Scientific(DecimalDigits)},\n {\"name\": \"StrUnsignedDecimalLiteral\", \"symbols\": [\"DecimalDigits\", {\"literal\":\".\"}, \"DecimalDigits\"], \"postprocess\": ([[first], _, [second, n]]) => new Scientific(first).addSci(new Scientific(second, -n))},\n {\"name\": \"StrUnsignedDecimalLiteral\", \"symbols\": [\"DecimalDigits\", {\"literal\":\".\"}, \"ExponentPart\"], \"postprocess\": ([[DecimalDigits], _, e]) => new Scientific(DecimalDigits, e)},\n {\"name\": \"StrUnsignedDecimalLiteral\", \"symbols\": [\"DecimalDigits\", {\"literal\":\".\"}, \"DecimalDigits\", \"ExponentPart\"], \"postprocess\": ([[first], _, [second, n], e]) => (new Scientific(first).addSci(new Scientific(second, -n))).expAdd(e)},\n {\"name\": \"StrUnsignedDecimalLiteral\", \"symbols\": [{\"literal\":\".\"}, \"DecimalDigits\"], \"postprocess\": ([_, [DecimalDigits, n]]) => new Scientific(DecimalDigits, -n)},\n {\"name\": \"StrUnsignedDecimalLiteral\", \"symbols\": [{\"literal\":\".\"}, \"DecimalDigits\", \"ExponentPart\"], \"postprocess\": ([_, [DecimalDigits, n], e]) => new Scientific(DecimalDigits, e - n)},\n {\"name\": \"StrUnsignedDecimalLiteral\", \"symbols\": [\"DecimalDigits\"], \"postprocess\": ([[DecimalDigits]]) => new Scientific(DecimalDigits)},\n {\"name\": \"StrUnsignedDecimalLiteral\", \"symbols\": [\"DecimalDigits\", \"ExponentPart\"], \"postprocess\": ([[DecimalDigits], e]) => new Scientific(DecimalDigits, e)},\n {\"name\": \"NumericLiteral\", \"symbols\": [\"DecimalLiteral\"], \"postprocess\": ([DecimalLiteral]) => DecimalLiteral},\n {\"name\": \"NumericLiteral\", \"symbols\": [\"BinaryIntegerLiteral\"], \"postprocess\": ([BinaryIntegerLiteral]) => BinaryIntegerLiteral},\n {\"name\": \"NumericLiteral\", \"symbols\": [\"OctalIntegerLiteral\"], \"postprocess\": ([OctalIntegerLiteral]) => OctalIntegerLiteral},\n {\"name\": \"NumericLiteral\", \"symbols\": [\"HexIntegerLiteral\"], \"postprocess\": ([HexIntegerLiteral]) => HexIntegerLiteral},\n {\"name\": \"DecimalLiteral\", \"symbols\": [\"DecimalIntegerLiteral\", {\"literal\":\".\"}], \"postprocess\": ([DecimalIntegerLiteral]) => new Scientific(DecimalIntegerLiteral)},\n {\"name\": \"DecimalLiteral\", \"symbols\": [\"DecimalIntegerLiteral\", {\"literal\":\".\"}, \"DecimalDigits\"], \"postprocess\": ([DecimalIntegerLiteral, _, [DecimalDigits, n]]) => new Scientific(DecimalIntegerLiteral).addSci(new Scientific(DecimalDigits, -n))},\n {\"name\": \"DecimalLiteral\", \"symbols\": [\"DecimalIntegerLiteral\", {\"literal\":\".\"}, \"ExponentPart\"], \"postprocess\": ([DecimalIntegerLiteral, _, e]) => new Scientific(DecimalIntegerLiteral, e)},\n {\"name\": \"DecimalLiteral\", \"symbols\": [\"DecimalIntegerLiteral\", {\"literal\":\".\"}, \"DecimalDigits\", \"ExponentPart\"], \"postprocess\": ([DecimalIntegerLiteral, _, [DecimalDigits, n], e]) => new Scientific(DecimalIntegerLiteral).addSci(new Scientific(DecimalDigits, -n)).expAdd(e)},\n {\"name\": \"DecimalLiteral\", \"symbols\": [{\"literal\":\".\"}, \"DecimalDigits\"], \"postprocess\": ([_, [DecimalDigits, n]]) => new Scientific(DecimalDigits, -n)},\n {\"name\": \"DecimalLiteral\", \"symbols\": [{\"literal\":\".\"}, \"DecimalDigits\", \"ExponentPart\"], \"postprocess\": ([_, [DecimalDigits, n], e]) => new Scientific(DecimalDigits, e - n)},\n {\"name\": \"DecimalLiteral\", \"symbols\": [\"DecimalIntegerLiteral\"], \"postprocess\": ([DecimalIntegerLiteral]) => new Scientific(DecimalIntegerLiteral)},\n {\"name\": \"DecimalLiteral\", \"symbols\": [\"DecimalIntegerLiteral\", \"ExponentPart\"], \"postprocess\": ([DecimalIntegerLiteral, e]) => new Scientific(DecimalIntegerLiteral, e)},\n {\"name\": \"DecimalIntegerLiteral\", \"symbols\": [{\"literal\":\"0\"}], \"postprocess\": c(0n)},\n {\"name\": \"DecimalIntegerLiteral\", \"symbols\": [\"NonZeroDigit\"], \"postprocess\": ([NonZeroDigit]) => NonZeroDigit},\n {\"name\": \"DecimalIntegerLiteral\", \"symbols\": [\"NonZeroDigit\", \"DecimalDigits\"], \"postprocess\": ([NonZeroDigit, [DecimalDigits, n]]) => NonZeroDigit * (10n ** n) + DecimalDigits},\n {\"name\": \"DecimalDigits\", \"symbols\": [\"DecimalDigit\"], \"postprocess\": ([DecimalDigit]) => [DecimalDigit, 1n]},\n {\"name\": \"DecimalDigits\", \"symbols\": [\"DecimalDigits\", \"DecimalDigit\"], \"postprocess\": ([[DecimalDigits, n], DecimalDigit]) => [DecimalDigits * 10n + DecimalDigit, n + 1n]},\n {\"name\": \"DecimalDigit\", \"symbols\": [{\"literal\":\"0\"}], \"postprocess\": c(0n)},\n {\"name\": \"DecimalDigit\", \"symbols\": [{\"literal\":\"1\"}], \"postprocess\": c(1n)},\n {\"name\": \"DecimalDigit\", \"symbols\": [{\"literal\":\"2\"}], \"postprocess\": c(2n)},\n {\"name\": \"DecimalDigit\", \"symbols\": [{\"literal\":\"3\"}], \"postprocess\": c(3n)},\n {\"name\": \"DecimalDigit\", \"symbols\": [{\"literal\":\"4\"}], \"postprocess\": c(4n)},\n {\"name\": \"DecimalDigit\", \"symbols\": [{\"literal\":\"5\"}], \"postprocess\": c(5n)},\n {\"name\": \"DecimalDigit\", \"symbols\": [{\"literal\":\"6\"}], \"postprocess\": c(6n)},\n {\"name\": \"DecimalDigit\", \"symbols\": [{\"literal\":\"7\"}], \"postprocess\": c(7n)},\n {\"name\": \"DecimalDigit\", \"symbols\": [{\"literal\":\"8\"}], \"postprocess\": c(8n)},\n {\"name\": \"DecimalDigit\", \"symbols\": [{\"literal\":\"9\"}], \"postprocess\": c(9n)},\n {\"name\": \"NonZeroDigit\", \"symbols\": [{\"literal\":\"1\"}], \"postprocess\": c(1n)},\n {\"name\": \"NonZeroDigit\", \"symbols\": [{\"literal\":\"2\"}], \"postprocess\": c(2n)},\n {\"name\": \"NonZeroDigit\", \"symbols\": [{\"literal\":\"3\"}], \"postprocess\": c(3n)},\n {\"name\": \"NonZeroDigit\", \"symbols\": [{\"literal\":\"4\"}], \"postprocess\": c(4n)},\n {\"name\": \"NonZeroDigit\", \"symbols\": [{\"literal\":\"5\"}], \"postprocess\": c(5n)},\n {\"name\": \"NonZeroDigit\", \"symbols\": [{\"literal\":\"6\"}], \"postprocess\": c(6n)},\n {\"name\": \"NonZeroDigit\", \"symbols\": [{\"literal\":\"7\"}], \"postprocess\": c(7n)},\n {\"name\": \"NonZeroDigit\", \"symbols\": [{\"literal\":\"8\"}], \"postprocess\": c(8n)},\n {\"name\": \"NonZeroDigit\", \"symbols\": [{\"literal\":\"9\"}], \"postprocess\": c(9n)},\n {\"name\": \"ExponentPart\", \"symbols\": [\"ExponentIndicator\", \"SignedInteger\"], \"postprocess\": ([_, SignedInteger]) => SignedInteger},\n {\"name\": \"ExponentIndicator$subexpression$1\", \"symbols\": [/[eE]/], \"postprocess\": function(d) {return d.join(\"\"); }},\n {\"name\": \"ExponentIndicator\", \"symbols\": [\"ExponentIndicator$subexpression$1\"]},\n {\"name\": \"SignedInteger\", \"symbols\": [\"DecimalDigits\"], \"postprocess\": ([[DecimalDigits]]) => DecimalDigits},\n {\"name\": \"SignedInteger\", \"symbols\": [{\"literal\":\"+\"}, \"DecimalDigits\"], \"postprocess\": ([_, [DecimalDigits]]) => DecimalDigits},\n {\"name\": \"SignedInteger\", \"symbols\": [{\"literal\":\"-\"}, \"DecimalDigits\"], \"postprocess\": ([_, [DecimalDigits]]) => -DecimalDigits},\n {\"name\": \"BinaryIntegerLiteral$subexpression$1\", \"symbols\": [{\"literal\":\"0\"}, /[bB]/], \"postprocess\": function(d) {return d.join(\"\"); }},\n {\"name\": \"BinaryIntegerLiteral\", \"symbols\": [\"BinaryIntegerLiteral$subexpression$1\", \"BinaryDigits\"], \"postprocess\": ([_, BinaryDigits]) => new Scientific(BinaryDigits)},\n {\"name\": \"BinaryDigits\", \"symbols\": [\"BinaryDigit\"], \"postprocess\": ([BinaryDigit]) => BinaryDigit},\n {\"name\": \"BinaryDigits\", \"symbols\": [\"BinaryDigits\", \"BinaryDigit\"], \"postprocess\": ([BinaryDigits, BinaryDigit]) => BinaryDigits * 2n + BinaryDigit},\n {\"name\": \"BinaryDigit\", \"symbols\": [{\"literal\":\"0\"}], \"postprocess\": c(0n)},\n {\"name\": \"BinaryDigit\", \"symbols\": [{\"literal\":\"1\"}], \"postprocess\": c(1n)},\n {\"name\": \"OctalIntegerLiteral$subexpression$1\", \"symbols\": [{\"literal\":\"0\"}, /[oO]/], \"postprocess\": function(d) {return d.join(\"\"); }},\n {\"name\": \"OctalIntegerLiteral\", \"symbols\": [\"OctalIntegerLiteral$subexpression$1\", \"OctalDigits\"], \"postprocess\": ([_, OctalDigits]) => new Scientific(OctalDigits)},\n {\"name\": \"OctalDigits\", \"symbols\": [\"OctalDigit\"], \"postprocess\": ([OctalDigit]) => OctalDigit},\n {\"name\": \"OctalDigits\", \"symbols\": [\"OctalDigits\", \"OctalDigit\"], \"postprocess\": ([OctalDigits, OctalDigit]) => OctalDigits * 8n + OctalDigit},\n {\"name\": \"OctalDigit\", \"symbols\": [{\"literal\":\"0\"}], \"postprocess\": c(0n)},\n {\"name\": \"OctalDigit\", \"symbols\": [{\"literal\":\"1\"}], \"postprocess\": c(1n)},\n {\"name\": \"OctalDigit\", \"symbols\": [{\"literal\":\"2\"}], \"postprocess\": c(2n)},\n {\"name\": \"OctalDigit\", \"symbols\": [{\"literal\":\"3\"}], \"postprocess\": c(3n)},\n {\"name\": \"OctalDigit\", \"symbols\": [{\"literal\":\"4\"}], \"postprocess\": c(4n)},\n {\"name\": \"OctalDigit\", \"symbols\": [{\"literal\":\"5\"}], \"postprocess\": c(5n)},\n {\"name\": \"OctalDigit\", \"symbols\": [{\"literal\":\"6\"}], \"postprocess\": c(6n)},\n {\"name\": \"OctalDigit\", \"symbols\": [{\"literal\":\"7\"}], \"postprocess\": c(7n)},\n {\"name\": \"HexIntegerLiteral$subexpression$1\", \"symbols\": [{\"literal\":\"0\"}, /[xX]/], \"postprocess\": function(d) {return d.join(\"\"); }},\n {\"name\": \"HexIntegerLiteral\", \"symbols\": [\"HexIntegerLiteral$subexpression$1\", \"HexDigits\"], \"postprocess\": ([_, HexDigits]) => new Scientific(HexDigits)},\n {\"name\": \"HexDigits\", \"symbols\": [\"HexDigit\"], \"postprocess\": ([HexDigit]) => HexDigit},\n {\"name\": \"HexDigits\", \"symbols\": [\"HexDigits\", \"HexDigit\"], \"postprocess\": ([HexDigits, HexDigit]) => HexDigits * 16n + HexDigit},\n {\"name\": \"HexDigit\", \"symbols\": [{\"literal\":\"0\"}], \"postprocess\": c(0n)},\n {\"name\": \"HexDigit\", \"symbols\": [{\"literal\":\"1\"}], \"postprocess\": c(1n)},\n {\"name\": \"HexDigit\", \"symbols\": [{\"literal\":\"2\"}], \"postprocess\": c(2n)},\n {\"name\": \"HexDigit\", \"symbols\": [{\"literal\":\"3\"}], \"postprocess\": c(3n)},\n {\"name\": \"HexDigit\", \"symbols\": [{\"literal\":\"4\"}], \"postprocess\": c(4n)},\n {\"name\": \"HexDigit\", \"symbols\": [{\"literal\":\"5\"}], \"postprocess\": c(5n)},\n {\"name\": \"HexDigit\", \"symbols\": [{\"literal\":\"6\"}], \"postprocess\": c(6n)},\n {\"name\": \"HexDigit\", \"symbols\": [{\"literal\":\"7\"}], \"postprocess\": c(7n)},\n {\"name\": \"HexDigit\", \"symbols\": [{\"literal\":\"8\"}], \"postprocess\": c(8n)},\n {\"name\": \"HexDigit\", \"symbols\": [{\"literal\":\"9\"}], \"postprocess\": c(9n)},\n {\"name\": \"HexDigit$subexpression$1\", \"symbols\": [/[aA]/], \"postprocess\": function(d) {return d.join(\"\"); }},\n {\"name\": \"HexDigit\", \"symbols\": [\"HexDigit$subexpression$1\"], \"postprocess\": c(10n)},\n {\"name\": \"HexDigit$subexpression$2\", \"symbols\": [/[bB]/], \"postprocess\": function(d) {return d.join(\"\"); }},\n {\"name\": \"HexDigit\", \"symbols\": [\"HexDigit$subexpression$2\"], \"postprocess\": c(11n)},\n {\"name\": \"HexDigit$subexpression$3\", \"symbols\": [/[cC]/], \"postprocess\": function(d) {return d.join(\"\"); }},\n {\"name\": \"HexDigit\", \"symbols\": [\"HexDigit$subexpression$3\"], \"postprocess\": c(12n)},\n {\"name\": \"HexDigit$subexpression$4\", \"symbols\": [/[dD]/], \"postprocess\": function(d) {return d.join(\"\"); }},\n {\"name\": \"HexDigit\", \"symbols\": [\"HexDigit$subexpression$4\"], \"postprocess\": c(13n)},\n {\"name\": \"HexDigit$subexpression$5\", \"symbols\": [/[eE]/], \"postprocess\": function(d) {return d.join(\"\"); }},\n {\"name\": \"HexDigit\", \"symbols\": [\"HexDigit$subexpression$5\"], \"postprocess\": c(14n)},\n {\"name\": \"HexDigit$subexpression$6\", \"symbols\": [/[fF]/], \"postprocess\": function(d) {return d.join(\"\"); }},\n {\"name\": \"HexDigit\", \"symbols\": [\"HexDigit$subexpression$6\"], \"postprocess\": c(15n)}\n];\nlet ParserStart = \"StrNumericLiteral\";\nexport default { Lexer, ParserRules, ParserStart };\n","import nearley from 'nearley';\nimport { Assert } from '../abstract-ops/all.mjs';\nimport grammar from '../grammar/StrNumericLiteral-gen.mjs';\n\nconst { ParserRules } = grammar;\n\nconst NumericLiteralGrammar = nearley.Grammar.fromCompiled({\n ParserRules,\n ParserStart: 'NumericLiteral',\n});\n\n// 11.8.3.1 #sec-static-semantics-mv\n// NumericLiteral ::\n// DecimalLiteral\n// BinaryIntegerLiteral\n// OctalIntegerLiteral\n// HexIntegerLiteral\nexport function MV_NumericLiteral(NumericLiteral) {\n const parser = new nearley.Parser(NumericLiteralGrammar);\n try {\n parser.feed(NumericLiteral);\n } catch (err) {\n return NaN;\n }\n Assert(parser.results.length === 1);\n return parser.results[0].toNumber();\n}\n","// 14.6.10 #sec-static-semantics-nonconstructormethoddefinitions\n// ClassElementList :\n// ClassElement\n// ClassElementList ClassElement\nfunction NonConstructorMethodDefinitions_ClassElementList(ClassElementList) {\n return ClassElementList.filter((ClassElement) => ClassElement.kind !== 'constructor');\n}\n\n// (implicit)\n// ClassBody : ClassElementList\nexport const NonConstructorMethodDefinitions_ClassBody = NonConstructorMethodDefinitions_ClassElementList;\n","import { Assert } from '../abstract-ops/notational-conventions.mjs';\nimport { OutOfRange } from '../helpers.mjs';\n\n// 11.8.6.1 #sec-static-semantics-tv-and-trv\n// NoSubstitutionTemplate ::\n// `\\`` `\\``\n// `\\`` TemplateCharacters `\\``\nexport function TRV_NoSubstitutionTemplate(NoSubstitutionTemplate) {\n if (NoSubstitutionTemplate.quasis.length !== 1) {\n throw new OutOfRange('TRV_NoSubstitutionTemplate', NoSubstitutionTemplate);\n }\n return TRV_TemplateCharacters(NoSubstitutionTemplate.quasis[0]);\n}\n\n// 11.8.6.1 #sec-static-semantics-tv-and-trv\n// TemplateCharacters ::\n// TemplateCharacter\n// TemplateCharacter TemplateCharacters\nexport function TRV_TemplateCharacters(TemplateCharacters) {\n Assert(typeof TemplateCharacters.value.raw === 'string');\n return TemplateCharacters.value.raw;\n}\n\n// 11.8.6.1 #sec-static-semantics-tv-and-trv\n// TemplateHead ::\n// `\\`` `${`\n// `\\`` TemplateCharacters `${`\nexport const TRV_TemplateHead = TRV_TemplateCharacters;\n\n// 11.8.6.1 #sec-static-semantics-tv-and-trv\n// TemplateMiddle ::\n// `}` `${`\n// `}` TemplateCharacters `${`\nexport const TRV_TemplateMiddle = TRV_TemplateCharacters;\n\n// 11.8.6.1 #sec-static-semantics-tv-and-trv\n// TemplateTail ::\n// `}` `\\``\n// `}` TemplateCharacters `\\``\nexport const TRV_TemplateTail = TRV_TemplateCharacters;\n","import { OutOfRange } from '../helpers.mjs';\n\n// 11.8.6.1 #sec-static-semantics-tv-and-trv\n// NoSubstitutionTemplate ::\n// `\\`` `\\``\n// `\\`` TemplateCharacters `\\``\nexport function TV_NoSubstitutionTemplate(NoSubstitutionTemplate) {\n if (NoSubstitutionTemplate.quasis.length !== 1) {\n throw new OutOfRange('TV_NoSubstitutionTemplate', NoSubstitutionTemplate);\n }\n return TV_TemplateCharacters(NoSubstitutionTemplate.quasis[0]);\n}\n\n// 11.8.6.1 #sec-static-semantics-tv-and-trv\n// TemplateCharacters ::\n// TemplateCharacter\n// TemplateCharacter TemplateCharacters\nexport function TV_TemplateCharacters(TemplateCharacters) {\n if (TemplateCharacters.value.cooked === null) {\n return undefined;\n }\n return TemplateCharacters.value.cooked;\n}\n\n// 11.8.6.1 #sec-static-semantics-tv-and-trv\n// TemplateHead ::\n// `\\`` `${`\n// `\\`` TemplateCharacters `${`\nexport const TV_TemplateHead = TV_TemplateCharacters;\n\n// 11.8.6.1 #sec-static-semantics-tv-and-trv\n// TemplateMiddle ::\n// `}` `${`\n// `}` TemplateCharacters `${`\nexport const TV_TemplateMiddle = TV_TemplateCharacters;\n\n// 11.8.6.1 #sec-static-semantics-tv-and-trv\n// TemplateTail ::\n// `}` `\\``\n// `}` TemplateCharacters `\\``\nexport const TV_TemplateTail = TV_TemplateCharacters;\n","import { Assert } from '../abstract-ops/notational-conventions.mjs';\nimport {\n isNoSubstitutionTemplate,\n isSubstitutionTemplate,\n unrollTemplateLiteral,\n} from '../ast.mjs';\nimport { OutOfRange } from '../helpers.mjs';\nimport {\n TV_NoSubstitutionTemplate,\n TV_TemplateHead,\n TV_TemplateMiddle,\n TV_TemplateTail,\n TRV_NoSubstitutionTemplate,\n TRV_TemplateHead,\n TRV_TemplateMiddle,\n TRV_TemplateTail,\n} from './all.mjs';\n\n// 12.2.9.2 #sec-static-semantics-templatestrings\n// TemplateLiteral : NoSubstitutionTemplate\n//\n// (implicit)\n// TemplateLiteral : SubstitutionTemplate\nexport function TemplateStrings_TemplateLiteral(TemplateLiteral, raw) {\n switch (true) {\n case isNoSubstitutionTemplate(TemplateLiteral): {\n let string;\n if (raw === false) {\n string = TV_NoSubstitutionTemplate(TemplateLiteral);\n } else {\n string = TRV_NoSubstitutionTemplate(TemplateLiteral);\n }\n return [string];\n }\n\n case isSubstitutionTemplate(TemplateLiteral):\n return TemplateStrings_SubstitutionTemplate(TemplateLiteral, raw);\n\n default:\n throw new OutOfRange('TemplateStrings_TemplateLiteral', TemplateLiteral);\n }\n}\n\n// 12.2.9.2 #sec-static-semantics-templatestrings\n// SubstitutionTemplate : TemplateHead Expression TemplateSpans\nexport function TemplateStrings_SubstitutionTemplate(SubstitutionTemplate, raw) {\n const [TemplateHead, /* Expression */, ...TemplateSpans] = unrollTemplateLiteral(SubstitutionTemplate);\n\n let head;\n if (raw === false) {\n head = TV_TemplateHead(TemplateHead);\n } else {\n head = TRV_TemplateHead(TemplateHead);\n }\n const tail = TemplateStrings_TemplateSpans(TemplateSpans, raw);\n return [head, ...tail];\n}\n\n// 12.2.9.2 #sec-static-semantics-templatestrings\n// TemplateSpans :\n// TemplateTail\n// TemplateMiddleList TemplateTail\nexport function TemplateStrings_TemplateSpans(TemplateSpans, raw) {\n let middle = [];\n Assert(TemplateSpans.length % 2 === 1);\n if (TemplateSpans.length > 1) {\n middle = TemplateStrings_TemplateMiddleList(TemplateSpans.slice(0, -1), raw);\n }\n\n const TemplateTail = TemplateSpans[TemplateSpans.length - 1];\n let tail;\n if (raw === false) {\n tail = TV_TemplateTail(TemplateTail);\n } else {\n tail = TRV_TemplateTail(TemplateTail);\n }\n\n return [...middle, tail];\n}\n\n// 12.2.9.2 #sec-static-semantics-templatestrings\n// TemplateMiddleList :\n// TemplateMiddle Expression\n// TemplateMiddleList TemplateMiddle Expression\nexport function TemplateStrings_TemplateMiddleList(TemplateMiddleList, raw) {\n const front = [];\n Assert(TemplateMiddleList.length % 2 === 0);\n for (let i = 0; i < TemplateMiddleList.length; i += 2) {\n const TemplateMiddle = TemplateMiddleList[i];\n let last;\n if (raw === false) {\n last = TV_TemplateMiddle(TemplateMiddle);\n } else {\n last = TRV_TemplateMiddle(TemplateMiddle);\n }\n front.push(last);\n }\n return front;\n}\n","import {\n isDeclaration,\n isHoistableDeclaration,\n isStatement,\n} from '../ast.mjs';\n\n// 13.2.8 #sec-block-static-semantics-toplevellexicallyscopeddeclarations\n// StatementList : StatementList StatementListItem\n//\n// (implicit)\n// StatementList : StatementListItem\nexport function TopLevelLexicallyScopedDeclarations_StatementList(StatementList) {\n const declarations = [];\n for (const StatementListItem of StatementList) {\n declarations.push(...TopLevelLexicallyScopedDeclarations_StatementListItem(StatementListItem));\n }\n return declarations;\n}\n\n// 13.2.8 #sec-block-static-semantics-toplevellexicallyscopeddeclarations\n// StatementListItem :\n// Statement\n// Declaration\nexport function TopLevelLexicallyScopedDeclarations_StatementListItem(StatementListItem) {\n switch (true) {\n case isStatement(StatementListItem):\n return [];\n case isDeclaration(StatementListItem):\n if (isHoistableDeclaration(StatementListItem)) {\n return [];\n }\n return [StatementListItem];\n default:\n throw new TypeError(`Unexpected StatementListItem: ${StatementListItem.type}`);\n }\n}\n","import {\n isBlockStatement,\n isBreakStatement,\n isContinueStatement,\n isDebuggerStatement,\n isDeclaration,\n isEmptyStatement,\n isExportDeclaration,\n isExportDeclarationWithVariable,\n isExpressionBody,\n isExpressionStatement,\n isFunctionDeclaration,\n isIfStatement,\n isImportDeclaration,\n isIterationStatement,\n isLabelledStatement,\n isReturnStatement,\n isStatement,\n isSwitchStatement,\n isThrowStatement,\n isTryStatement,\n isVariableStatement,\n isWithStatement,\n} from '../ast.mjs';\nimport {\n TopLevelVarScopedDeclarations_StatementList,\n} from './TopLevelVarScopedDeclarations.mjs';\n\n// 13.1.6 #sec-statement-semantics-static-semantics-varscopeddeclarations\n// Statement :\n// EmptyStatement\n// ExpressionStatement\n// ContinueStatement\n// BreakStatement\n// ReturnStatement\n// ThrowStatement\n// DebuggerStatement\n//\n// (implicit)\n// Statement :\n// BlockStatement\n// VariableStatement\n// IfStatement\n// BreakableStatement\n// WithStatement\n// LabelledStatement\n// TryStatement\n// BreakableStatement :\n// IterationStatement\n// SwitchStatement\nexport function VarScopedDeclarations_Statement(Statement) {\n switch (true) {\n case isEmptyStatement(Statement):\n case isExpressionStatement(Statement):\n case isContinueStatement(Statement):\n case isBreakStatement(Statement):\n case isReturnStatement(Statement):\n case isThrowStatement(Statement):\n case isDebuggerStatement(Statement):\n return [];\n\n case isBlockStatement(Statement):\n return VarScopedDeclarations_BlockStatement(Statement);\n case isVariableStatement(Statement):\n return VarScopedDeclarations_VariableStatement(Statement);\n case isIfStatement(Statement):\n return VarScopedDeclarations_IfStatement(Statement);\n case isWithStatement(Statement):\n return VarScopedDeclarations_WithStatement(Statement);\n case isLabelledStatement(Statement):\n return VarScopedDeclarations_LabelledStatement(Statement);\n case isTryStatement(Statement):\n return VarScopedDeclarations_TryStatement(Statement);\n case isIterationStatement(Statement):\n return VarScopedDeclarations_IterationStatement(Statement);\n case isSwitchStatement(Statement):\n return VarScopedDeclarations_SwitchStatement(Statement);\n\n default:\n throw new TypeError(`Invalid Statement: ${Statement.type}`);\n }\n}\n\n// 13.2.12 #sec-block-static-semantics-varscopeddeclarations\n// StatementList : StatementList StatementListItem\n//\n// (implicit)\n// StatementList : StatementListItem\nexport function VarScopedDeclarations_StatementList(StatementList) {\n const declarations = [];\n for (const StatementListItem of StatementList) {\n declarations.push(...VarScopedDeclarations_StatementListItem(StatementListItem));\n }\n return declarations;\n}\n\n// 13.2.12 #sec-block-static-semantics-varscopeddeclarations\n// Block : `{` `}`\n//\n// (implicit)\n// Block : `{` StatementList `}`\nexport function VarScopedDeclarations_Block(Block) {\n return VarScopedDeclarations_StatementList(Block.body);\n}\n\n// (implicit)\n// BlockStatement : Block\nexport const VarScopedDeclarations_BlockStatement = VarScopedDeclarations_Block;\n\n// 13.2.12 #sec-block-static-semantics-varscopeddeclarations\n// StatementListItem : Declaration\n//\n// (implicit)\n// StatementListItem : Statement\nexport function VarScopedDeclarations_StatementListItem(StatementListItem) {\n switch (true) {\n case isDeclaration(StatementListItem):\n return [];\n case isStatement(StatementListItem):\n return VarScopedDeclarations_Statement(StatementListItem);\n default:\n throw new TypeError(`Unexpected StatementListItem: ${StatementListItem.type}`);\n }\n}\n\n// 13.3.2.3 #sec-variable-statement-static-semantics-varscopeddeclarations\n// VariableDeclarationList :\n// VariableDeclaration\n// VariableDeclarationList `,` VariableDeclaration\nexport function VarScopedDeclarations_VariableDeclarationList(VariableDeclarationList) {\n return VariableDeclarationList;\n}\n\n// (implicit)\n// VariableStatement : `var` VariableDeclarationList `;`\nexport function VarScopedDeclarations_VariableStatement(VariableStatement) {\n return VarScopedDeclarations_VariableDeclarationList(VariableStatement.declarations);\n}\n\n// 13.6.6 #sec-if-statement-static-semantics-varscopeddeclarations\n// IfStatement :\n// `if` `(` Expression `)` Statement `else` Statement\n// `if` `(` Expression `)` Statement\nexport function VarScopedDeclarations_IfStatement(IfStatement) {\n if (IfStatement.alternate) {\n return [\n ...VarScopedDeclarations_Statement(IfStatement.consequent),\n ...VarScopedDeclarations_Statement(IfStatement.alternate),\n ];\n }\n return VarScopedDeclarations_Statement(IfStatement.consequent);\n}\n\n// 13.7.2.5 #sec-do-while-statement-static-semantics-varscopeddeclarations\n// IterationStatement : `do` Statement `while` `(` Expression `)` `;`\n//\n// 13.7.3.5 #sec-while-statement-static-semantics-varscopeddeclarations\n// IterationStatement : `while` `(` Expression `)` Statement\n//\n// 13.7.4.6 #sec-for-statement-static-semantics-varscopeddeclarations\n// IterationStatement :\n// `for` `(` Expression `;` Expression `;` Expression `)` Statement\n// `for` `(` `var` VariableDeclarationList `;` Expression `;` Expression `)` Statement\n// `for` `(` LexicalDeclaration Expression `;` Expression `)` Statement\n//\n// 13.7.5.8 #sec-for-in-and-for-of-statements-static-semantics-varscopeddeclarations\n// IterationStatement :\n// `for` `(` LeftHandSideExpression `in` Expression `)` Statement\n// `for` `(` `var` ForBinding `in` Expression `)` Statement\n// `for` `(` ForDeclaration `in` Expression `)` Statement\n// `for` `(` LeftHandSideExpression `of` AssignmentExpression `)` Statement\n// `for` `await` `(` LeftHandSideExpression `of` AssignmentExpression `)` Statement\n// `for` `(` `var` ForBinding `of` AssignmentExpression `)` Statement\n// `for` `await` `(` `var` ForBinding `of` AssignmentExpression `)` Statement\n// `for` `(` ForDeclaration `of` Expression `)` Statement\n// `for` `await` `(` ForDeclaration `of` Expression `)` Statement\nexport function VarScopedDeclarations_IterationStatement(IterationStatement) {\n let declarationsFromBinding = [];\n switch (IterationStatement.type) {\n case 'DoWhileStatement':\n case 'WhileStatement':\n break;\n case 'ForStatement':\n if (IterationStatement.init && isVariableStatement(IterationStatement.init)) {\n const VariableDeclarationList = IterationStatement.init.declarations;\n declarationsFromBinding = VarScopedDeclarations_VariableDeclarationList(\n VariableDeclarationList,\n );\n }\n break;\n case 'ForInStatement':\n case 'ForOfStatement':\n if (isVariableStatement(IterationStatement.left)) {\n const ForBinding = IterationStatement.left.declarations[0].id;\n declarationsFromBinding = [ForBinding];\n }\n break;\n default:\n throw new TypeError(`Invalid IterationStatement: ${IterationStatement.type}`);\n }\n return [\n ...declarationsFromBinding,\n ...VarScopedDeclarations_Statement(IterationStatement.body),\n ];\n}\n\n// 13.11.6 #sec-with-statement-static-semantics-varscopeddeclarations\n// WithStatement : `with` `(` Expression `)` Statement\nexport function VarScopedDeclarations_WithStatement(WithStatement) {\n return VarScopedDeclarations_Statement(WithStatement.body);\n}\n\n// 13.12.8 #sec-switch-statement-static-semantics-varscopeddeclarations\n// SwitchStatement : `switch` `(` Expression `)` CaseBlock\nexport function VarScopedDeclarations_SwitchStatement(SwitchStatement) {\n return VarScopedDeclarations_CaseBlock(SwitchStatement.cases);\n}\n\n// 13.12.8 #sec-switch-statement-static-semantics-varscopeddeclarations\n// CaseBlock :\n// `{` `}`\n// `{` CaseClauses_opt DefaultClause CaseClauses_opt `}`\n// CaseClauses : CaseClauses CaseClause\n// CaseClause : `case` Expression `:` StatementList_opt\n// DefaultClause : `default` `:` StatementList_opt\n//\n// (implicit)\n// CaseBlock : `{` CaseClauses `}`\n// CaseClauses : CaseClause\nexport function VarScopedDeclarations_CaseBlock(CaseBlock) {\n const declarations = [];\n for (const CaseClauseOrDefaultClause of CaseBlock) {\n declarations.push(...VarScopedDeclarations_StatementList(CaseClauseOrDefaultClause.consequent));\n }\n return declarations;\n}\n\n// 13.13.13 #sec-labelled-statements-static-semantics-varscopeddeclarations\n// LabelledStatement : LabelIdentifier `:` LabelledItem\n// LabelledItem : FunctionDeclaration\n//\n// (implicit)\n// LabelledItem : Statement\nexport function VarScopedDeclarations_LabelledStatement(LabelledStatement) {\n const LabelledItem = LabelledStatement.body;\n switch (true) {\n case isFunctionDeclaration(LabelledItem):\n return [];\n case isStatement(LabelledItem):\n return VarScopedDeclarations_Statement(LabelledItem);\n default:\n throw new TypeError(`Invalid LabelledItem: ${LabelledItem.type}`);\n }\n}\n\n// 13.15.6 #sec-try-statement-static-semantics-varscopeddeclarations\n// TryStatement :\n// `try` Block Catch\n// `try` Block Finally\n// `try` Block Catch Finally\n// Catch : `catch` `(` CatchParameter `)` Block\n//\n// (implicit)\n// Catch : `catch` Block\n// Finally : `finally` Block\nexport function VarScopedDeclarations_TryStatement(TryStatement) {\n const declarationsBlock = VarScopedDeclarations_Block(TryStatement.block);\n const declarationsCatch = TryStatement.handler !== null\n ? VarScopedDeclarations_Block(TryStatement.handler.body) : [];\n const declarationsFinally = TryStatement.finalizer !== null\n ? VarScopedDeclarations_Block(TryStatement.finalizer) : [];\n return [\n ...declarationsBlock,\n ...declarationsCatch,\n ...declarationsFinally,\n ];\n}\n\n// 14.1.17 #sec-function-definitions-static-semantics-varscopeddeclarations\n// FunctionStatementList :\n// [empty]\n// StatementList\nexport const\n VarScopedDeclarations_FunctionStatementList = TopLevelVarScopedDeclarations_StatementList;\n\n// (implicit)\n// FunctionBody : FunctionStatementList\nexport const VarScopedDeclarations_FunctionBody = VarScopedDeclarations_FunctionStatementList;\n\n// (implicit)\n// GeneratorBody : FunctionBody\nexport const VarScopedDeclarations_GeneratorBody = VarScopedDeclarations_FunctionBody;\n\n// (implicit)\n// AsyncFunctionBody : FunctionBody\nexport const VarScopedDeclarations_AsyncFunctionBody = VarScopedDeclarations_FunctionBody;\n\n// 14.2.13 #sec-arrow-function-definitions-static-semantics-varscopeddeclarations\n// ConciseBody : ExpressionBody\n//\n// (implicit)\n// ConciseBody : `{` FunctionBody `}`\nexport function VarScopedDeclarations_ConciseBody(ConciseBody) {\n switch (true) {\n case isExpressionBody(ConciseBody):\n return [];\n case isBlockStatement(ConciseBody):\n return VarScopedDeclarations_FunctionBody(ConciseBody.body);\n default:\n throw new TypeError(`Unexpected ConciseBody: ${ConciseBody.type}`);\n }\n}\n\n// 14.8.12 #sec-async-arrow-function-definitions-static-semantics-VarScopedDeclarations\n// AsyncConciseBody : [lookahead ≠ `{`] ExpressionBody\n//\n// (implicit)\n// AsyncConciseBody : `{` AsyncFunctionBody `}`\n// AsyncFunctionBody : FunctionBody\nexport const VarScopedDeclarations_AsyncConciseBody = VarScopedDeclarations_ConciseBody;\n\n// 15.1.6 #sec-scripts-static-semantics-varscopeddeclarations\n// ScriptBody : StatementList\nexport const VarScopedDeclarations_ScriptBody = TopLevelVarScopedDeclarations_StatementList;\n\n// (implicit)\n// Script :\n// [empty]\n// ScriptBody\nexport const VarScopedDeclarations_Script = VarScopedDeclarations_ScriptBody;\n\n// 15.2.1.14 #sec-module-semantics-static-semantics-varscopeddeclarations\n// ModuleItemList : ModuleItemList ModuleItem\n//\n// (implicit)\n// ModuleItemList : ModuleItem\nexport function VarScopedDeclarations_ModuleItemList(ModuleItemList) {\n const declarations = [];\n for (const ModuleItem of ModuleItemList) {\n declarations.push(...VarScopedDeclarations_ModuleItem(ModuleItem));\n }\n return declarations;\n}\n\n// (implicit)\n// ModuleBody : ModuleItemList\nexport const VarScopedDeclarations_ModuleBody = VarScopedDeclarations_ModuleItemList;\n\n// 15.2.1.14 #sec-module-semantics-static-semantics-varscopeddeclarations\n// Module : [empty]\n//\n// (implicit)\n// Module : ModuleBody\nexport const VarScopedDeclarations_Module = VarScopedDeclarations_ModuleBody;\n\n// 15.2.1.14 #sec-module-semantics-static-semantics-varscopeddeclarations\n// ModuleItem :\n// ImportDeclaration\n// ExportDeclaration\n//\n// (implicit)\n// ModuleItem : StatementListItem\nexport function VarScopedDeclarations_ModuleItem(ModuleItem) {\n switch (true) {\n case isImportDeclaration(ModuleItem):\n return [];\n case isExportDeclaration(ModuleItem):\n if (isExportDeclarationWithVariable(ModuleItem)) {\n return VarScopedDeclarations_VariableStatement(ModuleItem.declaration);\n }\n return [];\n default:\n return VarScopedDeclarations_StatementListItem(ModuleItem);\n }\n}\n","import {\n isDeclaration,\n isFunctionDeclaration,\n isHoistableDeclaration,\n isLabelledStatement,\n isStatement,\n} from '../ast.mjs';\nimport { DeclarationPart_Declaration } from './DeclarationPart.mjs';\nimport { VarScopedDeclarations_Statement } from './VarScopedDeclarations.mjs';\n\n// 13.2.10 #sec-block-static-semantics-toplevelvarscopeddeclarations\n// StatementList : StatementList StatementListItem\nexport function TopLevelVarScopedDeclarations_StatementList(StatementList) {\n const declarations = [];\n for (const StatementListItem of StatementList) {\n declarations.push(...TopLevelVarScopedDeclarations_StatementListItem(StatementListItem));\n }\n return declarations;\n}\n\n// 13.2.10 #sec-block-static-semantics-toplevelvarscopeddeclarations\n// StatementListItem :\n// Statement\n// Declaration\nexport function TopLevelVarScopedDeclarations_StatementListItem(StatementListItem) {\n switch (true) {\n case isStatement(StatementListItem):\n if (isLabelledStatement(StatementListItem)) {\n return TopLevelVarScopedDeclarations_LabelledStatement(StatementListItem);\n }\n return VarScopedDeclarations_Statement(StatementListItem);\n case isDeclaration(StatementListItem):\n if (isHoistableDeclaration(StatementListItem)) {\n return [DeclarationPart_Declaration(StatementListItem)];\n }\n return [];\n default:\n throw new TypeError(`Unexpected StatementListItem: ${StatementListItem.type}`);\n }\n}\n\n// 13.13.11 #sec-labelled-statements-static-semantics-toplevelvarscopeddeclarations\n// LabelledStatement : LabelIdentifier `:` LabelledItem\nexport function TopLevelVarScopedDeclarations_LabelledStatement(LabelledStatement) {\n return TopLevelVarScopedDeclarations_LabelledItem(LabelledStatement.body);\n}\n\n// 13.13.11 #sec-labelled-statements-static-semantics-toplevelvarscopeddeclarations\n// LabelledItem :\n// Statement\n// FunctionDeclaration\nexport function TopLevelVarScopedDeclarations_LabelledItem(LabelledItem) {\n switch (true) {\n case isStatement(LabelledItem):\n if (isLabelledStatement(LabelledItem)) {\n return TopLevelVarScopedDeclarations_LabelledItem(LabelledItem.body);\n }\n return VarScopedDeclarations_Statement(LabelledItem);\n case isFunctionDeclaration(LabelledItem):\n return [LabelledItem];\n default:\n throw new TypeError(`Unexpected LabelledItem: ${LabelledItem.type}`);\n }\n}\n","import { Q, ReturnIfAbrupt } from '../completion.mjs';\nimport {\n GetReferencedName,\n GetValue,\n PutValue,\n} from '../abstract-ops/all.mjs';\nimport {\n IsAnonymousFunctionDefinition,\n IsIdentifierRef,\n} from '../static-semantics/all.mjs';\nimport { isAssignmentPattern } from '../ast.mjs';\nimport { EvaluateBinopValues, Evaluate } from '../evaluator.mjs';\nimport {\n DestructuringAssignmentEvaluation_AssignmentPattern,\n NamedEvaluation_Expression,\n} from './all.mjs';\n\n// 12.15.4 #sec-assignment-operators-runtime-semantics-evaluation\n// AssignmentExpression :\n// LeftHandSideExpression `=` AssignmentExpression\n// LeftHandSideExpression AssignmentOperator AssignmentExpression\nexport function* Evaluate_AssignmentExpression(node) {\n const LeftHandSideExpression = node.left;\n const AssignmentExpression = node.right;\n if (node.operator === '=') {\n if (!isAssignmentPattern(LeftHandSideExpression)) {\n const lref = yield* Evaluate(LeftHandSideExpression);\n ReturnIfAbrupt(lref);\n let rval;\n if (IsAnonymousFunctionDefinition(AssignmentExpression) && IsIdentifierRef(LeftHandSideExpression)) {\n rval = yield* NamedEvaluation_Expression(AssignmentExpression, GetReferencedName(lref));\n } else {\n const rref = yield* Evaluate(AssignmentExpression);\n rval = Q(GetValue(rref));\n }\n Q(PutValue(lref, rval));\n return rval;\n }\n const assignmentPattern = LeftHandSideExpression;\n const rref = yield* Evaluate(AssignmentExpression);\n const rval = Q(GetValue(rref));\n Q(yield* DestructuringAssignmentEvaluation_AssignmentPattern(assignmentPattern, rval));\n return rval;\n } else {\n const AssignmentOperator = node.operator;\n\n const lref = yield* Evaluate(LeftHandSideExpression);\n const lval = Q(GetValue(lref));\n const rref = yield* Evaluate(AssignmentExpression);\n const rval = Q(GetValue(rref));\n // Let op be the @ where AssignmentOperator is @=.\n const op = AssignmentOperator.slice(0, -1);\n // Let r be the result of applying op to lval and rval\n // as if evaluating the expression lval op rval.\n const r = EvaluateBinopValues(op, lval, rval);\n Q(PutValue(lref, r));\n return r;\n }\n}\n","import {\n surroundingAgent,\n} from '../engine.mjs';\nimport { X } from '../completion.mjs';\n// import { CoveredFormalsList } from '../static-semantics/all.mjs';\nimport { OrdinaryFunctionCreate, sourceTextMatchedBy } from '../abstract-ops/all.mjs';\n\n// 14.8.16 #sec-async-arrow-function-definitions-runtime-semantics-evaluation\n// AsyncArrowFunction :\n// `async` AsyncArrowBindingIdentifier `=>` AsyncConciseBody\n// CoverCallExpressionAndAsyncArrowHead `=>` AsyncConciseBody\nexport function Evaluate_AsyncArrowFunction(AsyncArrowFunction) {\n const { params: ArrowFormalParameters } = AsyncArrowFunction;\n const scope = surroundingAgent.runningExecutionContext.LexicalEnvironment;\n const parameters = ArrowFormalParameters;\n const closure = X(OrdinaryFunctionCreate(surroundingAgent.intrinsic('%AsyncFunction.prototype%'), parameters, AsyncArrowFunction, 'lexical-this', scope));\n closure.SourceText = sourceTextMatchedBy(AsyncArrowFunction);\n return closure;\n}\n","import { surroundingAgent } from '../engine.mjs';\nimport {\n isAsyncFunctionExpressionWithBindingIdentifier,\n} from '../ast.mjs';\nimport {\n OrdinaryFunctionCreate,\n SetFunctionName,\n sourceTextMatchedBy,\n} from '../abstract-ops/all.mjs';\nimport { NewDeclarativeEnvironment } from '../environment.mjs';\nimport { Value } from '../value.mjs';\nimport { X } from '../completion.mjs';\n\nfunction Evaluate_AsyncFunctionExpression_BindingIdentifier(AsyncFunctionExpression) {\n const {\n id: BindingIdentifier,\n params: FormalParameters,\n } = AsyncFunctionExpression;\n const scope = surroundingAgent.runningExecutionContext.LexicalEnvironment;\n const funcEnv = NewDeclarativeEnvironment(scope);\n const envRec = funcEnv.EnvironmentRecord;\n const name = new Value(BindingIdentifier.name);\n X(envRec.CreateImmutableBinding(name, Value.false));\n const closure = X(OrdinaryFunctionCreate(surroundingAgent.intrinsic('%AsyncFunction.prototype%'), FormalParameters, AsyncFunctionExpression, 'non-lexical-this', funcEnv));\n X(SetFunctionName(closure, name));\n X(envRec.InitializeBinding(name, closure));\n closure.SourceText = sourceTextMatchedBy(AsyncFunctionExpression);\n return closure;\n}\n\nexport function Evaluate_AsyncFunctionExpression(AsyncFunctionExpression) {\n if (isAsyncFunctionExpressionWithBindingIdentifier(AsyncFunctionExpression)) {\n return Evaluate_AsyncFunctionExpression_BindingIdentifier(AsyncFunctionExpression);\n }\n const {\n params: FormalParameters,\n } = AsyncFunctionExpression;\n const scope = surroundingAgent.runningExecutionContext.LexicalEnvironment;\n const closure = X(OrdinaryFunctionCreate(surroundingAgent.intrinsic('%AsyncFunction.prototype%'), FormalParameters, AsyncFunctionExpression, 'non-lexical-this', scope));\n closure.SourceText = sourceTextMatchedBy(AsyncFunctionExpression);\n return closure;\n}\n","import {\n DefinePropertyOrThrow,\n OrdinaryFunctionCreate,\n OrdinaryObjectCreate,\n SetFunctionName,\n sourceTextMatchedBy,\n} from '../abstract-ops/all.mjs';\nimport { X } from '../completion.mjs';\nimport { surroundingAgent } from '../engine.mjs';\nimport { NewDeclarativeEnvironment } from '../environment.mjs';\nimport { Descriptor, Value } from '../value.mjs';\n\n// 14.4.14 #sec-generator-function-definitions-runtime-semantics-evaluation\n// AsyncGeneratorExpression :\n// `async` `function` `*` `(` FormalParameters `)` `{` AsyncGeneratorBody `}`\n// `async` `function` `*` BindingIdentifier `(` FormalParameters `)` `{` AsyncGeneratorBody `}`\nexport function Evaluate_AsyncGeneratorExpression(AsyncGeneratorExpression) {\n const {\n id: BindingIdentifier,\n params: FormalParameters,\n } = AsyncGeneratorExpression;\n const scope = surroundingAgent.runningExecutionContext.LexicalEnvironment;\n let funcEnv = scope;\n let envRec;\n let name;\n if (BindingIdentifier) {\n funcEnv = NewDeclarativeEnvironment(scope);\n envRec = funcEnv.EnvironmentRecord;\n name = new Value(BindingIdentifier.name);\n envRec.CreateImmutableBinding(name, Value.false);\n }\n const closure = X(OrdinaryFunctionCreate(surroundingAgent.intrinsic('%AsyncGeneratorFunction.prototype%'), FormalParameters, AsyncGeneratorExpression, 'non-lexical-this', funcEnv));\n const prototype = OrdinaryObjectCreate(surroundingAgent.intrinsic('%AsyncGenerator.prototype%'));\n X(DefinePropertyOrThrow(\n closure,\n new Value('prototype'),\n Descriptor({\n Value: prototype,\n Writable: Value.true,\n Enumerable: Value.false,\n Configurable: Value.false,\n }),\n ));\n closure.SourceText = sourceTextMatchedBy(AsyncGeneratorExpression);\n if (BindingIdentifier) {\n X(SetFunctionName(closure, name));\n envRec.InitializeBinding(name, closure);\n }\n return closure;\n}\n","import { GetValue } from '../abstract-ops/all.mjs';\nimport { Evaluate } from '../evaluator.mjs';\nimport { Await, Q } from '../completion.mjs';\n\n// #prod-AwaitExpression\n// AwaitExpression : `await` UnaryExpression\nexport function* Evaluate_AwaitExpression({ argument: UnaryExpression }) {\n const exprRef = yield* Evaluate(UnaryExpression);\n const value = Q(GetValue(exprRef));\n return Q(yield* Await(value));\n}\n","import {\n Assert,\n GetIterator,\n IteratorClose,\n PutValue,\n RequireObjectCoercible,\n ResolveBinding,\n} from '../abstract-ops/all.mjs';\nimport {\n isArrayBindingPattern,\n isBindingIdentifier,\n isBindingPattern,\n isBindingRestProperty,\n isObjectBindingPattern,\n} from '../ast.mjs';\nimport {\n Type,\n Value,\n} from '../value.mjs';\nimport {\n NormalCompletion,\n Q,\n} from '../completion.mjs';\nimport { OutOfRange } from '../helpers.mjs';\nimport {\n IteratorBindingInitialization_ArrayBindingPattern,\n PropertyBindingInitialization_BindingPropertyList,\n RestBindingInitialization_BindingRestProperty,\n} from './all.mjs';\n\n// 12.1.5.1 #sec-initializeboundname\nexport function InitializeBoundName(name, value, environment) {\n Assert(Type(name) === 'String');\n if (Type(environment) !== 'Undefined') {\n const env = environment.EnvironmentRecord;\n env.InitializeBinding(name, value);\n return new NormalCompletion(Value.undefined);\n } else {\n const lhs = ResolveBinding(name, undefined, false);\n return Q(PutValue(lhs, value));\n }\n}\n\n// 12.1.5 #sec-identifiers-runtime-semantics-bindinginitialization\n// BindingIdentifier :\n// Identifier\n// `yield`\n// `await`\nexport function BindingInitialization_BindingIdentifier(BindingIdentifier, value, environment) {\n const name = new Value(BindingIdentifier.name);\n return Q(InitializeBoundName(name, value, environment));\n}\n\n// 13.3.3.5 #sec-destructuring-binding-patterns-runtime-semantics-bindinginitialization\n// BindingPattern :\n// ObjectBindingPattern\n// ArrayBindingPattern\nexport function* BindingInitialization_BindingPattern(BindingPattern, value, environment) {\n switch (true) {\n case isObjectBindingPattern(BindingPattern):\n Q(RequireObjectCoercible(value));\n return yield* BindingInitialization_ObjectBindingPattern(BindingPattern, value, environment);\n\n case isArrayBindingPattern(BindingPattern): {\n const iteratorRecord = Q(GetIterator(value));\n const result = yield* IteratorBindingInitialization_ArrayBindingPattern(\n BindingPattern, iteratorRecord, environment,\n );\n if (iteratorRecord.Done === Value.false) {\n return Q(IteratorClose(iteratorRecord, result));\n }\n return result;\n }\n\n default:\n throw new OutOfRange('BindingInitialization_BindingPattern', BindingPattern);\n }\n}\n\n// (implicit)\n// ForBinding :\n// BindingIdentifier\n// BindingPattern\nexport function* BindingInitialization_ForBinding(ForBinding, value, environment) {\n switch (true) {\n case isBindingIdentifier(ForBinding):\n return BindingInitialization_BindingIdentifier(ForBinding, value, environment);\n\n case isBindingPattern(ForBinding):\n return yield* BindingInitialization_BindingPattern(ForBinding, value, environment);\n\n default:\n throw new OutOfRange('BindingInitialization_ForBinding', ForBinding);\n }\n}\n\n// 13.3.3.5 #sec-destructuring-binding-patterns-runtime-semantics-bindinginitialization\n// ObjectBindingPattern :\n// `{` `}`\n// `{` BindingPropertyList `}`\n// `{` BindingPropertyList `,` `}`\n// `{` BindingRestProperty `}`\n// `{` BindingPropertyList `,` BindingRestProperty `}`\nfunction* BindingInitialization_ObjectBindingPattern(ObjectBindingPattern, value, environment) {\n if (ObjectBindingPattern.properties.length === 0) {\n return new NormalCompletion(undefined);\n }\n\n let BindingRestProperty;\n let BindingPropertyList = ObjectBindingPattern.properties;\n const last = ObjectBindingPattern.properties[ObjectBindingPattern.properties.length - 1];\n if (isBindingRestProperty(last)) {\n BindingRestProperty = last;\n BindingPropertyList = BindingPropertyList.slice(0, -1);\n }\n\n const excludedNames = Q(yield* PropertyBindingInitialization_BindingPropertyList(\n BindingPropertyList, value, environment,\n ));\n if (BindingRestProperty === undefined) {\n return new NormalCompletion(undefined);\n }\n\n return RestBindingInitialization_BindingRestProperty(\n BindingRestProperty, value, environment, excludedNames,\n );\n}\n\nexport function* BindingInitialization_CatchParameter(CatchParameter, value, environment) {\n switch (true) {\n case isBindingIdentifier(CatchParameter):\n return BindingInitialization_BindingIdentifier(CatchParameter, value, environment);\n\n case isBindingPattern(CatchParameter):\n return yield* BindingInitialization_BindingPattern(CatchParameter, value, environment);\n\n default:\n throw new OutOfRange('BindingInitialization_CatchParameter', CatchParameter);\n }\n}\n\n// 13.7.5.9 #sec-for-in-and-for-of-statements-runtime-semantics-bindinginitialization\n// ForDeclaration : LetOrConst ForBinding\nexport function* BindingInitialization_ForDeclaration(ForDeclaration, value, environment) {\n return yield* BindingInitialization_ForBinding(ForDeclaration.declarations[0].id, value, environment);\n}\n","import { surroundingAgent } from '../engine.mjs';\nimport { GetValue, ToNumeric } from '../abstract-ops/all.mjs';\nimport { Type, TypeNumeric } from '../value.mjs';\nimport { Evaluate } from '../evaluator.mjs';\nimport { Q } from '../completion.mjs';\nimport { OutOfRange } from '../helpers.mjs';\n\n/* eslint-disable no-bitwise */\n\nexport function EvaluateBinopValues_BitwiseANDExpression(lval, rval) {\n const lnum = Q(ToNumeric(lval));\n const rnum = Q(ToNumeric(rval));\n if (Type(lnum) !== Type(rnum)) {\n return surroundingAgent.Throw('TypeError', 'CannotMixBigInts');\n }\n const T = TypeNumeric(lnum);\n return T.bitwiseAND(lnum, rnum);\n}\n\nexport function EvaluateBinopValues_BitwiseXORExpression(lval, rval) {\n const lnum = Q(ToNumeric(lval));\n const rnum = Q(ToNumeric(rval));\n if (Type(lnum) !== Type(rnum)) {\n return surroundingAgent.Throw('TypeError', 'CannotMixBigInts');\n }\n const T = TypeNumeric(lnum);\n return T.bitwiseXOR(lnum, rnum);\n}\n\nexport function EvaluateBinopValues_BitwiseORExpression(lval, rval) {\n const lnum = Q(ToNumeric(lval));\n const rnum = Q(ToNumeric(rval));\n if (Type(lnum) !== Type(rnum)) {\n return surroundingAgent.Throw('TypeError', 'CannotMixBigInts');\n }\n const T = TypeNumeric(lnum);\n return T.bitwiseOR(lnum, rnum);\n}\n\n// 12.12.3 #sec-binary-bitwise-operators-runtime-semantics-evaluation\nexport function* Evaluate_BinaryBitwiseExpression({ left: A, operator, right: B }) {\n const lref = yield* Evaluate(A);\n const lval = Q(GetValue(lref));\n const rref = yield* Evaluate(B);\n const rval = Q(GetValue(rref));\n\n // Return the result of applying the bitwise operator @ to lnum and rnum.\n switch (operator) {\n case '&':\n return EvaluateBinopValues_BitwiseANDExpression(lval, rval);\n case '^':\n return EvaluateBinopValues_BitwiseXORExpression(lval, rval);\n case '|':\n return EvaluateBinopValues_BitwiseORExpression(lval, rval);\n\n default:\n throw new OutOfRange('Evaluate_BinaryBiwise', operator);\n }\n}\n","import {\n surroundingAgent,\n} from '../engine.mjs';\nimport {\n BoundNames_Declaration,\n IsConstantDeclaration,\n LexicallyScopedDeclarations_StatementList,\n} from '../static-semantics/all.mjs';\nimport {\n isAsyncFunctionDeclaration,\n isAsyncGeneratorDeclaration,\n isFunctionDeclaration,\n isGeneratorDeclaration,\n} from '../ast.mjs';\nimport {\n Assert,\n} from '../abstract-ops/all.mjs';\nimport {\n DeclarativeEnvironmentRecord,\n NewDeclarativeEnvironment,\n} from '../environment.mjs';\nimport {\n Value,\n} from '../value.mjs';\nimport {\n NormalCompletion,\n X,\n} from '../completion.mjs';\nimport { Evaluate_StatementList } from '../evaluator.mjs';\nimport {\n InstantiateFunctionObject,\n} from './all.mjs';\n\n// 13.2.14 #sec-blockdeclarationinstantiation\nexport function BlockDeclarationInstantiation(code, env) {\n const envRec = env.EnvironmentRecord;\n Assert(envRec instanceof DeclarativeEnvironmentRecord);\n const declarations = LexicallyScopedDeclarations_StatementList(code);\n for (const d of declarations) {\n for (const dn of BoundNames_Declaration(d).map(Value)) {\n if (IsConstantDeclaration(d)) {\n X(envRec.CreateImmutableBinding(dn, Value.true));\n } else {\n X(envRec.CreateMutableBinding(dn, false));\n }\n if (isFunctionDeclaration(d) || isGeneratorDeclaration(d)\n || isAsyncFunctionDeclaration(d) || isAsyncGeneratorDeclaration(d)) {\n const fn = BoundNames_Declaration(d)[0];\n const fo = InstantiateFunctionObject(d, env);\n envRec.InitializeBinding(new Value(fn), fo);\n }\n }\n }\n}\n\n// 13.2.13 #sec-block-runtime-semantics-evaluation\n// Block :\n// `{` `}`\n// `{` StatementList `}`\nexport function* Evaluate_Block(Block) {\n const StatementList = Block.body;\n\n if (StatementList.length === 0) {\n return new NormalCompletion(undefined);\n }\n\n const oldEnv = surroundingAgent.runningExecutionContext.LexicalEnvironment;\n const blockEnv = NewDeclarativeEnvironment(oldEnv);\n BlockDeclarationInstantiation(StatementList, blockEnv);\n surroundingAgent.runningExecutionContext.LexicalEnvironment = blockEnv;\n const blockValue = yield* Evaluate_StatementList(StatementList);\n surroundingAgent.runningExecutionContext.LexicalEnvironment = oldEnv;\n return blockValue;\n}\n\nexport const Evaluate_BlockStatement = Evaluate_Block;\n","import { Value } from '../value.mjs';\nimport { BreakCompletion } from '../completion.mjs';\n\n// 13.9.3 #sec-break-statement-runtime-semantics-evaluation\n// BreakStatement :\n// `break` `;`\n// `break` LabelIdentifier `;`\nexport function Evaluate_BreakStatement({ label: LabelIdentifier }) {\n if (LabelIdentifier) {\n const label = new Value(LabelIdentifier.name);\n return new BreakCompletion(label);\n } else {\n return new BreakCompletion();\n }\n}\n","import {\n isIterationStatement,\n isSwitchStatement,\n} from '../ast.mjs';\nimport {\n Completion,\n EnsureCompletion,\n NormalCompletion,\n} from '../completion.mjs';\nimport { ValueSet, OutOfRange } from '../helpers.mjs';\nimport { Value } from '../value.mjs';\nimport {\n Evaluate_SwitchStatement,\n LabelledEvaluation_IterationStatement,\n} from './all.mjs';\n\n// 13.1.8 #sec-statement-semantics-runtime-semantics-evaluation\n// BreakableStatement :\n// IterationStatement\n// SwitchStatement\nexport function* Evaluate_BreakableStatement(BreakableStatement) {\n const newLabelSet = new ValueSet();\n return yield* LabelledEvaluation_BreakableStatement(BreakableStatement, newLabelSet);\n}\n\n// 13.1.7 #sec-statement-semantics-runtime-semantics-labelledevaluation\n// BreakableStatement : IterationStatement\nexport function* LabelledEvaluation_BreakableStatement(BreakableStatement, labelSet) {\n switch (true) {\n case isIterationStatement(BreakableStatement): {\n let stmtResult = EnsureCompletion(yield* LabelledEvaluation_IterationStatement(BreakableStatement, labelSet));\n if (stmtResult.Type === 'break') {\n if (stmtResult.Target === undefined) {\n if (stmtResult.Value === undefined) {\n stmtResult = new NormalCompletion(Value.undefined);\n } else {\n stmtResult = new NormalCompletion(stmtResult.Value);\n }\n }\n }\n return Completion(stmtResult);\n }\n\n case isSwitchStatement(BreakableStatement): {\n let stmtResult = EnsureCompletion(yield* Evaluate_SwitchStatement(BreakableStatement, labelSet));\n if (stmtResult.Type === 'break') {\n if (stmtResult.Target === undefined) {\n if (stmtResult.Value === undefined) {\n stmtResult = new NormalCompletion(Value.undefined);\n } else {\n stmtResult = new NormalCompletion(stmtResult.Value);\n }\n }\n }\n return Completion(stmtResult);\n }\n\n default:\n throw new OutOfRange('LabelledEvaluation_BreakableStatement', BreakableStatement);\n }\n}\n","import { surroundingAgent } from '../engine.mjs';\nimport { Type, Value } from '../value.mjs';\nimport {\n Assert,\n Call,\n GetBase,\n GetReferencedName,\n GetThisValue,\n GetValue,\n IsCallable,\n IsPropertyReference,\n PerformEval,\n PrepareForTailCall,\n SameValue,\n} from '../abstract-ops/all.mjs';\nimport { IsInTailPosition } from '../static-semantics/all.mjs';\nimport {\n AbruptCompletion,\n Completion,\n Q,\n} from '../completion.mjs';\nimport { Evaluate } from '../evaluator.mjs';\nimport { EnvironmentRecord } from '../environment.mjs';\nimport { ArgumentListEvaluation, ArgumentListEvaluation_Arguments } from './all.mjs';\n\n// #sec-evaluatecall\nexport function* EvaluateCall(func, ref, args, tailPosition) {\n // 1. If Type(ref) is Reference, then\n let thisValue;\n if (Type(ref) === 'Reference') {\n // a. If IsPropertyReference(ref) is true, then\n if (IsPropertyReference(ref) === Value.true) {\n // i. Let thisValue be GetThisValue(ref).\n thisValue = GetThisValue(ref);\n } else {\n // i. Assert: the base of ref is an Environment Record.\n Assert(ref.BaseValue instanceof EnvironmentRecord);\n // ii. Let envRef be GetBase(ref).\n const refEnv = GetBase(ref);\n // iii. Let thisValue be envRef.WithBaseObject().\n thisValue = refEnv.WithBaseObject();\n }\n } else {\n // a. Let thisValue be undefined.\n thisValue = Value.undefined;\n }\n // 3. Let argList be ? ArgumentListEvaluation of arguments.\n const argList = Q(yield* ArgumentListEvaluation(args));\n // 4. If Type(func) is not Object, throw a TypeError exception.\n if (Type(func) !== 'Object') {\n return surroundingAgent.Throw('TypeError', 'NotAFunction', func);\n }\n // 5. If IsCallable(func) is false, throw a TypeError exception.\n if (IsCallable(func) === Value.false) {\n return surroundingAgent.Throw('TypeError', 'NotAFunction', func);\n }\n // 6. If tailPosition is true, perform PrepareForTailCall().\n if (tailPosition) {\n PrepareForTailCall();\n }\n // 7. Let result be Call(func, thisValue, argList).\n const result = Call(func, thisValue, argList);\n // 8. Assert: If tailPosition is true, the above call will not return here but instead\n // evaluation will continue as if the following return has already occurred.\n Assert(!tailPosition);\n // 9. Assert: If result is not an abrupt completion, then Type(result) is an ECMAScript language type.\n if (!(result instanceof AbruptCompletion)) {\n Assert(result instanceof Value || result instanceof Completion);\n }\n // 10. Return result.\n return result;\n}\n\n// #sec-function-calls-runtime-semantics-evaluation\n// CallExpression :\n// CoverCallExpressionAndAsyncArrowHead\n// CallExpression Arguments\nexport function* Evaluate_CallExpression(CallExpression) {\n // 1. Let expr be CoveredCallExpression of CoverCallExpressionAndAsyncArrowHead.\n const expr = CallExpression;\n // 2. Let memberExpr be the MemberExpression of expr.\n const memberExpr = expr.callee;\n // 3. Let arguments be the Arguments of expr.\n const args = expr.arguments;\n // 4. Let ref be the result of evaluating memberExpr.\n const ref = yield* Evaluate(memberExpr);\n // 5. Let func be ? GetValue(ref).\n const func = Q(GetValue(ref));\n // 6. If Type(ref) is Reference, IsPropertyReference(ref) is false, and GetReferencedName(ref) is \"eval\", then\n if (Type(ref) === 'Reference'\n && IsPropertyReference(ref) === Value.false\n && (Type(GetReferencedName(ref)) === 'String'\n && GetReferencedName(ref).stringValue() === 'eval')) {\n // a. If SameValue(func, %eval%) is true, then\n if (SameValue(func, surroundingAgent.intrinsic('%eval%')) === Value.true) {\n // i. Let argList be ? ArgumentListEvaluation of arguments.\n const argList = Q(yield* ArgumentListEvaluation_Arguments(args));\n // ii. If argList has no elements, return undefined.\n if (argList.length === 0) {\n return Value.undefined;\n }\n // iii. Let evalText be the first element of argList.\n const evalText = argList[0];\n // iv. If the source code matching this CallExpression is strict mode code, let strictCaller be true. Otherwise let strictCaller be false.\n const strictCaller = CallExpression.strict;\n // v. Let evalRealm be the current Realm Record.\n const evalRealm = surroundingAgent.currentRealmRecord;\n // vi. Return ? PerformEval(evalText, evalRealm, strictCaller, true).\n return Q(PerformEval(evalText, evalRealm, strictCaller, true));\n }\n }\n // 7. Let thisCall be this CallExpression.\n const thisCall = CallExpression;\n // 8. Let tailCall be IsInTailPosition(thisCall).\n const tailCall = IsInTailPosition(thisCall);\n // 9. Return ? EvaluateCall(func, ref, arguments, tailCall).\n return Q(yield* EvaluateCall(func, ref, args, tailCall));\n}\n","// Reserved word lists for various dialects of the language\n\nvar reservedWords = {\n 3: \"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile\",\n 5: \"class enum extends super const export import\",\n 6: \"enum\",\n strict: \"implements interface let package private protected public static yield\",\n strictBind: \"eval arguments\"\n};\n\n// And the keywords\n\nvar ecma5AndLessKeywords = \"break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this\";\n\nvar keywords = {\n 5: ecma5AndLessKeywords,\n \"5module\": ecma5AndLessKeywords + \" export import\",\n 6: ecma5AndLessKeywords + \" const class extends export import super\"\n};\n\nvar keywordRelationalOperator = /^in(stanceof)?$/;\n\n// ## Character categories\n\n// Big ugly regular expressions that match characters in the\n// whitespace, identifier, and identifier-start categories. These\n// are only applied when a character is found to actually have a\n// code point above 128.\n// Generated by `bin/generate-identifier-regex.js`.\nvar nonASCIIidentifierStartChars = \"\\xaa\\xb5\\xba\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02c1\\u02c6-\\u02d1\\u02e0-\\u02e4\\u02ec\\u02ee\\u0370-\\u0374\\u0376\\u0377\\u037a-\\u037d\\u037f\\u0386\\u0388-\\u038a\\u038c\\u038e-\\u03a1\\u03a3-\\u03f5\\u03f7-\\u0481\\u048a-\\u052f\\u0531-\\u0556\\u0559\\u0560-\\u0588\\u05d0-\\u05ea\\u05ef-\\u05f2\\u0620-\\u064a\\u066e\\u066f\\u0671-\\u06d3\\u06d5\\u06e5\\u06e6\\u06ee\\u06ef\\u06fa-\\u06fc\\u06ff\\u0710\\u0712-\\u072f\\u074d-\\u07a5\\u07b1\\u07ca-\\u07ea\\u07f4\\u07f5\\u07fa\\u0800-\\u0815\\u081a\\u0824\\u0828\\u0840-\\u0858\\u0860-\\u086a\\u08a0-\\u08b4\\u08b6-\\u08bd\\u0904-\\u0939\\u093d\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098c\\u098f\\u0990\\u0993-\\u09a8\\u09aa-\\u09b0\\u09b2\\u09b6-\\u09b9\\u09bd\\u09ce\\u09dc\\u09dd\\u09df-\\u09e1\\u09f0\\u09f1\\u09fc\\u0a05-\\u0a0a\\u0a0f\\u0a10\\u0a13-\\u0a28\\u0a2a-\\u0a30\\u0a32\\u0a33\\u0a35\\u0a36\\u0a38\\u0a39\\u0a59-\\u0a5c\\u0a5e\\u0a72-\\u0a74\\u0a85-\\u0a8d\\u0a8f-\\u0a91\\u0a93-\\u0aa8\\u0aaa-\\u0ab0\\u0ab2\\u0ab3\\u0ab5-\\u0ab9\\u0abd\\u0ad0\\u0ae0\\u0ae1\\u0af9\\u0b05-\\u0b0c\\u0b0f\\u0b10\\u0b13-\\u0b28\\u0b2a-\\u0b30\\u0b32\\u0b33\\u0b35-\\u0b39\\u0b3d\\u0b5c\\u0b5d\\u0b5f-\\u0b61\\u0b71\\u0b83\\u0b85-\\u0b8a\\u0b8e-\\u0b90\\u0b92-\\u0b95\\u0b99\\u0b9a\\u0b9c\\u0b9e\\u0b9f\\u0ba3\\u0ba4\\u0ba8-\\u0baa\\u0bae-\\u0bb9\\u0bd0\\u0c05-\\u0c0c\\u0c0e-\\u0c10\\u0c12-\\u0c28\\u0c2a-\\u0c39\\u0c3d\\u0c58-\\u0c5a\\u0c60\\u0c61\\u0c80\\u0c85-\\u0c8c\\u0c8e-\\u0c90\\u0c92-\\u0ca8\\u0caa-\\u0cb3\\u0cb5-\\u0cb9\\u0cbd\\u0cde\\u0ce0\\u0ce1\\u0cf1\\u0cf2\\u0d05-\\u0d0c\\u0d0e-\\u0d10\\u0d12-\\u0d3a\\u0d3d\\u0d4e\\u0d54-\\u0d56\\u0d5f-\\u0d61\\u0d7a-\\u0d7f\\u0d85-\\u0d96\\u0d9a-\\u0db1\\u0db3-\\u0dbb\\u0dbd\\u0dc0-\\u0dc6\\u0e01-\\u0e30\\u0e32\\u0e33\\u0e40-\\u0e46\\u0e81\\u0e82\\u0e84\\u0e86-\\u0e8a\\u0e8c-\\u0ea3\\u0ea5\\u0ea7-\\u0eb0\\u0eb2\\u0eb3\\u0ebd\\u0ec0-\\u0ec4\\u0ec6\\u0edc-\\u0edf\\u0f00\\u0f40-\\u0f47\\u0f49-\\u0f6c\\u0f88-\\u0f8c\\u1000-\\u102a\\u103f\\u1050-\\u1055\\u105a-\\u105d\\u1061\\u1065\\u1066\\u106e-\\u1070\\u1075-\\u1081\\u108e\\u10a0-\\u10c5\\u10c7\\u10cd\\u10d0-\\u10fa\\u10fc-\\u1248\\u124a-\\u124d\\u1250-\\u1256\\u1258\\u125a-\\u125d\\u1260-\\u1288\\u128a-\\u128d\\u1290-\\u12b0\\u12b2-\\u12b5\\u12b8-\\u12be\\u12c0\\u12c2-\\u12c5\\u12c8-\\u12d6\\u12d8-\\u1310\\u1312-\\u1315\\u1318-\\u135a\\u1380-\\u138f\\u13a0-\\u13f5\\u13f8-\\u13fd\\u1401-\\u166c\\u166f-\\u167f\\u1681-\\u169a\\u16a0-\\u16ea\\u16ee-\\u16f8\\u1700-\\u170c\\u170e-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176c\\u176e-\\u1770\\u1780-\\u17b3\\u17d7\\u17dc\\u1820-\\u1878\\u1880-\\u18a8\\u18aa\\u18b0-\\u18f5\\u1900-\\u191e\\u1950-\\u196d\\u1970-\\u1974\\u1980-\\u19ab\\u19b0-\\u19c9\\u1a00-\\u1a16\\u1a20-\\u1a54\\u1aa7\\u1b05-\\u1b33\\u1b45-\\u1b4b\\u1b83-\\u1ba0\\u1bae\\u1baf\\u1bba-\\u1be5\\u1c00-\\u1c23\\u1c4d-\\u1c4f\\u1c5a-\\u1c7d\\u1c80-\\u1c88\\u1c90-\\u1cba\\u1cbd-\\u1cbf\\u1ce9-\\u1cec\\u1cee-\\u1cf3\\u1cf5\\u1cf6\\u1cfa\\u1d00-\\u1dbf\\u1e00-\\u1f15\\u1f18-\\u1f1d\\u1f20-\\u1f45\\u1f48-\\u1f4d\\u1f50-\\u1f57\\u1f59\\u1f5b\\u1f5d\\u1f5f-\\u1f7d\\u1f80-\\u1fb4\\u1fb6-\\u1fbc\\u1fbe\\u1fc2-\\u1fc4\\u1fc6-\\u1fcc\\u1fd0-\\u1fd3\\u1fd6-\\u1fdb\\u1fe0-\\u1fec\\u1ff2-\\u1ff4\\u1ff6-\\u1ffc\\u2071\\u207f\\u2090-\\u209c\\u2102\\u2107\\u210a-\\u2113\\u2115\\u2118-\\u211d\\u2124\\u2126\\u2128\\u212a-\\u2139\\u213c-\\u213f\\u2145-\\u2149\\u214e\\u2160-\\u2188\\u2c00-\\u2c2e\\u2c30-\\u2c5e\\u2c60-\\u2ce4\\u2ceb-\\u2cee\\u2cf2\\u2cf3\\u2d00-\\u2d25\\u2d27\\u2d2d\\u2d30-\\u2d67\\u2d6f\\u2d80-\\u2d96\\u2da0-\\u2da6\\u2da8-\\u2dae\\u2db0-\\u2db6\\u2db8-\\u2dbe\\u2dc0-\\u2dc6\\u2dc8-\\u2dce\\u2dd0-\\u2dd6\\u2dd8-\\u2dde\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303c\\u3041-\\u3096\\u309b-\\u309f\\u30a1-\\u30fa\\u30fc-\\u30ff\\u3105-\\u312f\\u3131-\\u318e\\u31a0-\\u31ba\\u31f0-\\u31ff\\u3400-\\u4db5\\u4e00-\\u9fef\\ua000-\\ua48c\\ua4d0-\\ua4fd\\ua500-\\ua60c\\ua610-\\ua61f\\ua62a\\ua62b\\ua640-\\ua66e\\ua67f-\\ua69d\\ua6a0-\\ua6ef\\ua717-\\ua71f\\ua722-\\ua788\\ua78b-\\ua7bf\\ua7c2-\\ua7c6\\ua7f7-\\ua801\\ua803-\\ua805\\ua807-\\ua80a\\ua80c-\\ua822\\ua840-\\ua873\\ua882-\\ua8b3\\ua8f2-\\ua8f7\\ua8fb\\ua8fd\\ua8fe\\ua90a-\\ua925\\ua930-\\ua946\\ua960-\\ua97c\\ua984-\\ua9b2\\ua9cf\\ua9e0-\\ua9e4\\ua9e6-\\ua9ef\\ua9fa-\\ua9fe\\uaa00-\\uaa28\\uaa40-\\uaa42\\uaa44-\\uaa4b\\uaa60-\\uaa76\\uaa7a\\uaa7e-\\uaaaf\\uaab1\\uaab5\\uaab6\\uaab9-\\uaabd\\uaac0\\uaac2\\uaadb-\\uaadd\\uaae0-\\uaaea\\uaaf2-\\uaaf4\\uab01-\\uab06\\uab09-\\uab0e\\uab11-\\uab16\\uab20-\\uab26\\uab28-\\uab2e\\uab30-\\uab5a\\uab5c-\\uab67\\uab70-\\uabe2\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\uf900-\\ufa6d\\ufa70-\\ufad9\\ufb00-\\ufb06\\ufb13-\\ufb17\\ufb1d\\ufb1f-\\ufb28\\ufb2a-\\ufb36\\ufb38-\\ufb3c\\ufb3e\\ufb40\\ufb41\\ufb43\\ufb44\\ufb46-\\ufbb1\\ufbd3-\\ufd3d\\ufd50-\\ufd8f\\ufd92-\\ufdc7\\ufdf0-\\ufdfb\\ufe70-\\ufe74\\ufe76-\\ufefc\\uff21-\\uff3a\\uff41-\\uff5a\\uff66-\\uffbe\\uffc2-\\uffc7\\uffca-\\uffcf\\uffd2-\\uffd7\\uffda-\\uffdc\";\nvar nonASCIIidentifierChars = \"\\u200c\\u200d\\xb7\\u0300-\\u036f\\u0387\\u0483-\\u0487\\u0591-\\u05bd\\u05bf\\u05c1\\u05c2\\u05c4\\u05c5\\u05c7\\u0610-\\u061a\\u064b-\\u0669\\u0670\\u06d6-\\u06dc\\u06df-\\u06e4\\u06e7\\u06e8\\u06ea-\\u06ed\\u06f0-\\u06f9\\u0711\\u0730-\\u074a\\u07a6-\\u07b0\\u07c0-\\u07c9\\u07eb-\\u07f3\\u07fd\\u0816-\\u0819\\u081b-\\u0823\\u0825-\\u0827\\u0829-\\u082d\\u0859-\\u085b\\u08d3-\\u08e1\\u08e3-\\u0903\\u093a-\\u093c\\u093e-\\u094f\\u0951-\\u0957\\u0962\\u0963\\u0966-\\u096f\\u0981-\\u0983\\u09bc\\u09be-\\u09c4\\u09c7\\u09c8\\u09cb-\\u09cd\\u09d7\\u09e2\\u09e3\\u09e6-\\u09ef\\u09fe\\u0a01-\\u0a03\\u0a3c\\u0a3e-\\u0a42\\u0a47\\u0a48\\u0a4b-\\u0a4d\\u0a51\\u0a66-\\u0a71\\u0a75\\u0a81-\\u0a83\\u0abc\\u0abe-\\u0ac5\\u0ac7-\\u0ac9\\u0acb-\\u0acd\\u0ae2\\u0ae3\\u0ae6-\\u0aef\\u0afa-\\u0aff\\u0b01-\\u0b03\\u0b3c\\u0b3e-\\u0b44\\u0b47\\u0b48\\u0b4b-\\u0b4d\\u0b56\\u0b57\\u0b62\\u0b63\\u0b66-\\u0b6f\\u0b82\\u0bbe-\\u0bc2\\u0bc6-\\u0bc8\\u0bca-\\u0bcd\\u0bd7\\u0be6-\\u0bef\\u0c00-\\u0c04\\u0c3e-\\u0c44\\u0c46-\\u0c48\\u0c4a-\\u0c4d\\u0c55\\u0c56\\u0c62\\u0c63\\u0c66-\\u0c6f\\u0c81-\\u0c83\\u0cbc\\u0cbe-\\u0cc4\\u0cc6-\\u0cc8\\u0cca-\\u0ccd\\u0cd5\\u0cd6\\u0ce2\\u0ce3\\u0ce6-\\u0cef\\u0d00-\\u0d03\\u0d3b\\u0d3c\\u0d3e-\\u0d44\\u0d46-\\u0d48\\u0d4a-\\u0d4d\\u0d57\\u0d62\\u0d63\\u0d66-\\u0d6f\\u0d82\\u0d83\\u0dca\\u0dcf-\\u0dd4\\u0dd6\\u0dd8-\\u0ddf\\u0de6-\\u0def\\u0df2\\u0df3\\u0e31\\u0e34-\\u0e3a\\u0e47-\\u0e4e\\u0e50-\\u0e59\\u0eb1\\u0eb4-\\u0ebc\\u0ec8-\\u0ecd\\u0ed0-\\u0ed9\\u0f18\\u0f19\\u0f20-\\u0f29\\u0f35\\u0f37\\u0f39\\u0f3e\\u0f3f\\u0f71-\\u0f84\\u0f86\\u0f87\\u0f8d-\\u0f97\\u0f99-\\u0fbc\\u0fc6\\u102b-\\u103e\\u1040-\\u1049\\u1056-\\u1059\\u105e-\\u1060\\u1062-\\u1064\\u1067-\\u106d\\u1071-\\u1074\\u1082-\\u108d\\u108f-\\u109d\\u135d-\\u135f\\u1369-\\u1371\\u1712-\\u1714\\u1732-\\u1734\\u1752\\u1753\\u1772\\u1773\\u17b4-\\u17d3\\u17dd\\u17e0-\\u17e9\\u180b-\\u180d\\u1810-\\u1819\\u18a9\\u1920-\\u192b\\u1930-\\u193b\\u1946-\\u194f\\u19d0-\\u19da\\u1a17-\\u1a1b\\u1a55-\\u1a5e\\u1a60-\\u1a7c\\u1a7f-\\u1a89\\u1a90-\\u1a99\\u1ab0-\\u1abd\\u1b00-\\u1b04\\u1b34-\\u1b44\\u1b50-\\u1b59\\u1b6b-\\u1b73\\u1b80-\\u1b82\\u1ba1-\\u1bad\\u1bb0-\\u1bb9\\u1be6-\\u1bf3\\u1c24-\\u1c37\\u1c40-\\u1c49\\u1c50-\\u1c59\\u1cd0-\\u1cd2\\u1cd4-\\u1ce8\\u1ced\\u1cf4\\u1cf7-\\u1cf9\\u1dc0-\\u1df9\\u1dfb-\\u1dff\\u203f\\u2040\\u2054\\u20d0-\\u20dc\\u20e1\\u20e5-\\u20f0\\u2cef-\\u2cf1\\u2d7f\\u2de0-\\u2dff\\u302a-\\u302f\\u3099\\u309a\\ua620-\\ua629\\ua66f\\ua674-\\ua67d\\ua69e\\ua69f\\ua6f0\\ua6f1\\ua802\\ua806\\ua80b\\ua823-\\ua827\\ua880\\ua881\\ua8b4-\\ua8c5\\ua8d0-\\ua8d9\\ua8e0-\\ua8f1\\ua8ff-\\ua909\\ua926-\\ua92d\\ua947-\\ua953\\ua980-\\ua983\\ua9b3-\\ua9c0\\ua9d0-\\ua9d9\\ua9e5\\ua9f0-\\ua9f9\\uaa29-\\uaa36\\uaa43\\uaa4c\\uaa4d\\uaa50-\\uaa59\\uaa7b-\\uaa7d\\uaab0\\uaab2-\\uaab4\\uaab7\\uaab8\\uaabe\\uaabf\\uaac1\\uaaeb-\\uaaef\\uaaf5\\uaaf6\\uabe3-\\uabea\\uabec\\uabed\\uabf0-\\uabf9\\ufb1e\\ufe00-\\ufe0f\\ufe20-\\ufe2f\\ufe33\\ufe34\\ufe4d-\\ufe4f\\uff10-\\uff19\\uff3f\";\n\nvar nonASCIIidentifierStart = new RegExp(\"[\" + nonASCIIidentifierStartChars + \"]\");\nvar nonASCIIidentifier = new RegExp(\"[\" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + \"]\");\n\nnonASCIIidentifierStartChars = nonASCIIidentifierChars = null;\n\n// These are a run-length and offset encoded representation of the\n// >0xffff code points that are a valid part of identifiers. The\n// offset starts at 0x10000, and each pair of numbers represents an\n// offset to the next range, and then a size of the range. They were\n// generated by bin/generate-identifier-regex.js\n\n// eslint-disable-next-line comma-spacing\nvar astralIdentifierStartCodes = [0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,477,28,11,0,9,21,155,22,13,52,76,44,33,24,27,35,30,0,12,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,0,33,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,230,43,117,63,32,0,161,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,35,56,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,270,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,754,9486,286,50,2,18,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,2357,44,11,6,17,0,370,43,1301,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42710,42,4148,12,221,3,5761,15,7472,3104,541];\n\n// eslint-disable-next-line comma-spacing\nvar astralIdentifierCodes = [509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,525,10,176,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,4,9,83,11,7,0,161,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,232,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,19306,9,135,4,60,6,26,9,1014,0,2,54,8,3,19723,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,262,6,10,9,419,13,1495,6,110,6,6,9,792487,239];\n\n// This has a complexity linear to the value of the code. The\n// assumption is that looking up astral identifier characters is\n// rare.\nfunction isInAstralSet(code, set) {\n var pos = 0x10000;\n for (var i = 0; i < set.length; i += 2) {\n pos += set[i];\n if (pos > code) { return false }\n pos += set[i + 1];\n if (pos >= code) { return true }\n }\n}\n\n// Test whether a given character code starts an identifier.\n\nfunction isIdentifierStart(code, astral) {\n if (code < 65) { return code === 36 }\n if (code < 91) { return true }\n if (code < 97) { return code === 95 }\n if (code < 123) { return true }\n if (code <= 0xffff) { return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code)) }\n if (astral === false) { return false }\n return isInAstralSet(code, astralIdentifierStartCodes)\n}\n\n// Test whether a given character is part of an identifier.\n\nfunction isIdentifierChar(code, astral) {\n if (code < 48) { return code === 36 }\n if (code < 58) { return true }\n if (code < 65) { return false }\n if (code < 91) { return true }\n if (code < 97) { return code === 95 }\n if (code < 123) { return true }\n if (code <= 0xffff) { return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code)) }\n if (astral === false) { return false }\n return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes)\n}\n\n// ## Token types\n\n// The assignment of fine-grained, information-carrying type objects\n// allows the tokenizer to store the information it has about a\n// token in a way that is very cheap for the parser to look up.\n\n// All token type variables start with an underscore, to make them\n// easy to recognize.\n\n// The `beforeExpr` property is used to disambiguate between regular\n// expressions and divisions. It is set on all token types that can\n// be followed by an expression (thus, a slash after them would be a\n// regular expression).\n//\n// The `startsExpr` property is used to check if the token ends a\n// `yield` expression. It is set on all token types that either can\n// directly start an expression (like a quotation mark) or can\n// continue an expression (like the body of a string).\n//\n// `isLoop` marks a keyword as starting a loop, which is important\n// to know when parsing a label, in order to allow or disallow\n// continue jumps to that label.\n\nvar TokenType = function TokenType(label, conf) {\n if ( conf === void 0 ) conf = {};\n\n this.label = label;\n this.keyword = conf.keyword;\n this.beforeExpr = !!conf.beforeExpr;\n this.startsExpr = !!conf.startsExpr;\n this.isLoop = !!conf.isLoop;\n this.isAssign = !!conf.isAssign;\n this.prefix = !!conf.prefix;\n this.postfix = !!conf.postfix;\n this.binop = conf.binop || null;\n this.updateContext = null;\n};\n\nfunction binop(name, prec) {\n return new TokenType(name, {beforeExpr: true, binop: prec})\n}\nvar beforeExpr = {beforeExpr: true}, startsExpr = {startsExpr: true};\n\n// Map keyword names to token types.\n\nvar keywords$1 = {};\n\n// Succinct definitions of keyword token types\nfunction kw(name, options) {\n if ( options === void 0 ) options = {};\n\n options.keyword = name;\n return keywords$1[name] = new TokenType(name, options)\n}\n\nvar types = {\n num: new TokenType(\"num\", startsExpr),\n regexp: new TokenType(\"regexp\", startsExpr),\n string: new TokenType(\"string\", startsExpr),\n name: new TokenType(\"name\", startsExpr),\n eof: new TokenType(\"eof\"),\n\n // Punctuation token types.\n bracketL: new TokenType(\"[\", {beforeExpr: true, startsExpr: true}),\n bracketR: new TokenType(\"]\"),\n braceL: new TokenType(\"{\", {beforeExpr: true, startsExpr: true}),\n braceR: new TokenType(\"}\"),\n parenL: new TokenType(\"(\", {beforeExpr: true, startsExpr: true}),\n parenR: new TokenType(\")\"),\n comma: new TokenType(\",\", beforeExpr),\n semi: new TokenType(\";\", beforeExpr),\n colon: new TokenType(\":\", beforeExpr),\n dot: new TokenType(\".\"),\n question: new TokenType(\"?\", beforeExpr),\n arrow: new TokenType(\"=>\", beforeExpr),\n template: new TokenType(\"template\"),\n invalidTemplate: new TokenType(\"invalidTemplate\"),\n ellipsis: new TokenType(\"...\", beforeExpr),\n backQuote: new TokenType(\"`\", startsExpr),\n dollarBraceL: new TokenType(\"${\", {beforeExpr: true, startsExpr: true}),\n\n // Operators. These carry several kinds of properties to help the\n // parser use them properly (the presence of these properties is\n // what categorizes them as operators).\n //\n // `binop`, when present, specifies that this operator is a binary\n // operator, and will refer to its precedence.\n //\n // `prefix` and `postfix` mark the operator as a prefix or postfix\n // unary operator.\n //\n // `isAssign` marks all of `=`, `+=`, `-=` etcetera, which act as\n // binary operators with a very low precedence, that should result\n // in AssignmentExpression nodes.\n\n eq: new TokenType(\"=\", {beforeExpr: true, isAssign: true}),\n assign: new TokenType(\"_=\", {beforeExpr: true, isAssign: true}),\n incDec: new TokenType(\"++/--\", {prefix: true, postfix: true, startsExpr: true}),\n prefix: new TokenType(\"!/~\", {beforeExpr: true, prefix: true, startsExpr: true}),\n logicalOR: binop(\"||\", 1),\n logicalAND: binop(\"&&\", 2),\n bitwiseOR: binop(\"|\", 3),\n bitwiseXOR: binop(\"^\", 4),\n bitwiseAND: binop(\"&\", 5),\n equality: binop(\"==/!=/===/!==\", 6),\n relational: binop(\"/<=/>=\", 7),\n bitShift: binop(\"<>/>>>\", 8),\n plusMin: new TokenType(\"+/-\", {beforeExpr: true, binop: 9, prefix: true, startsExpr: true}),\n modulo: binop(\"%\", 10),\n star: binop(\"*\", 10),\n slash: binop(\"/\", 10),\n starstar: new TokenType(\"**\", {beforeExpr: true}),\n\n // Keyword token types.\n _break: kw(\"break\"),\n _case: kw(\"case\", beforeExpr),\n _catch: kw(\"catch\"),\n _continue: kw(\"continue\"),\n _debugger: kw(\"debugger\"),\n _default: kw(\"default\", beforeExpr),\n _do: kw(\"do\", {isLoop: true, beforeExpr: true}),\n _else: kw(\"else\", beforeExpr),\n _finally: kw(\"finally\"),\n _for: kw(\"for\", {isLoop: true}),\n _function: kw(\"function\", startsExpr),\n _if: kw(\"if\"),\n _return: kw(\"return\", beforeExpr),\n _switch: kw(\"switch\"),\n _throw: kw(\"throw\", beforeExpr),\n _try: kw(\"try\"),\n _var: kw(\"var\"),\n _const: kw(\"const\"),\n _while: kw(\"while\", {isLoop: true}),\n _with: kw(\"with\"),\n _new: kw(\"new\", {beforeExpr: true, startsExpr: true}),\n _this: kw(\"this\", startsExpr),\n _super: kw(\"super\", startsExpr),\n _class: kw(\"class\", startsExpr),\n _extends: kw(\"extends\", beforeExpr),\n _export: kw(\"export\"),\n _import: kw(\"import\", startsExpr),\n _null: kw(\"null\", startsExpr),\n _true: kw(\"true\", startsExpr),\n _false: kw(\"false\", startsExpr),\n _in: kw(\"in\", {beforeExpr: true, binop: 7}),\n _instanceof: kw(\"instanceof\", {beforeExpr: true, binop: 7}),\n _typeof: kw(\"typeof\", {beforeExpr: true, prefix: true, startsExpr: true}),\n _void: kw(\"void\", {beforeExpr: true, prefix: true, startsExpr: true}),\n _delete: kw(\"delete\", {beforeExpr: true, prefix: true, startsExpr: true})\n};\n\n// Matches a whole line break (where CRLF is considered a single\n// line break). Used to count lines.\n\nvar lineBreak = /\\r\\n?|\\n|\\u2028|\\u2029/;\nvar lineBreakG = new RegExp(lineBreak.source, \"g\");\n\nfunction isNewLine(code, ecma2019String) {\n return code === 10 || code === 13 || (!ecma2019String && (code === 0x2028 || code === 0x2029))\n}\n\nvar nonASCIIwhitespace = /[\\u1680\\u2000-\\u200a\\u202f\\u205f\\u3000\\ufeff]/;\n\nvar skipWhiteSpace = /(?:\\s|\\/\\/.*|\\/\\*[^]*?\\*\\/)*/g;\n\nvar ref = Object.prototype;\nvar hasOwnProperty = ref.hasOwnProperty;\nvar toString = ref.toString;\n\n// Checks if an object has a property.\n\nfunction has(obj, propName) {\n return hasOwnProperty.call(obj, propName)\n}\n\nvar isArray = Array.isArray || (function (obj) { return (\n toString.call(obj) === \"[object Array]\"\n); });\n\nfunction wordsRegexp(words) {\n return new RegExp(\"^(?:\" + words.replace(/ /g, \"|\") + \")$\")\n}\n\n// These are used when `options.locations` is on, for the\n// `startLoc` and `endLoc` properties.\n\nvar Position = function Position(line, col) {\n this.line = line;\n this.column = col;\n};\n\nPosition.prototype.offset = function offset (n) {\n return new Position(this.line, this.column + n)\n};\n\nvar SourceLocation = function SourceLocation(p, start, end) {\n this.start = start;\n this.end = end;\n if (p.sourceFile !== null) { this.source = p.sourceFile; }\n};\n\n// The `getLineInfo` function is mostly useful when the\n// `locations` option is off (for performance reasons) and you\n// want to find the line/column position for a given character\n// offset. `input` should be the code string that the offset refers\n// into.\n\nfunction getLineInfo(input, offset) {\n for (var line = 1, cur = 0;;) {\n lineBreakG.lastIndex = cur;\n var match = lineBreakG.exec(input);\n if (match && match.index < offset) {\n ++line;\n cur = match.index + match[0].length;\n } else {\n return new Position(line, offset - cur)\n }\n }\n}\n\n// A second optional argument can be given to further configure\n// the parser process. These options are recognized:\n\nvar defaultOptions = {\n // `ecmaVersion` indicates the ECMAScript version to parse. Must be\n // either 3, 5, 6 (2015), 7 (2016), 8 (2017), 9 (2018), or 10\n // (2019). This influences support for strict mode, the set of\n // reserved words, and support for new syntax features. The default\n // is 10.\n ecmaVersion: 10,\n // `sourceType` indicates the mode the code should be parsed in.\n // Can be either `\"script\"` or `\"module\"`. This influences global\n // strict mode and parsing of `import` and `export` declarations.\n sourceType: \"script\",\n // `onInsertedSemicolon` can be a callback that will be called\n // when a semicolon is automatically inserted. It will be passed\n // the position of the comma as an offset, and if `locations` is\n // enabled, it is given the location as a `{line, column}` object\n // as second argument.\n onInsertedSemicolon: null,\n // `onTrailingComma` is similar to `onInsertedSemicolon`, but for\n // trailing commas.\n onTrailingComma: null,\n // By default, reserved words are only enforced if ecmaVersion >= 5.\n // Set `allowReserved` to a boolean value to explicitly turn this on\n // an off. When this option has the value \"never\", reserved words\n // and keywords can also not be used as property names.\n allowReserved: null,\n // When enabled, a return at the top level is not considered an\n // error.\n allowReturnOutsideFunction: false,\n // When enabled, import/export statements are not constrained to\n // appearing at the top of the program.\n allowImportExportEverywhere: false,\n // When enabled, await identifiers are allowed to appear at the top-level scope,\n // but they are still not allowed in non-async functions.\n allowAwaitOutsideFunction: false,\n // When enabled, hashbang directive in the beginning of file\n // is allowed and treated as a line comment.\n allowHashBang: false,\n // When `locations` is on, `loc` properties holding objects with\n // `start` and `end` properties in `{line, column}` form (with\n // line being 1-based and column 0-based) will be attached to the\n // nodes.\n locations: false,\n // A function can be passed as `onToken` option, which will\n // cause Acorn to call that function with object in the same\n // format as tokens returned from `tokenizer().getToken()`. Note\n // that you are not allowed to call the parser from the\n // callback—that will corrupt its internal state.\n onToken: null,\n // A function can be passed as `onComment` option, which will\n // cause Acorn to call that function with `(block, text, start,\n // end)` parameters whenever a comment is skipped. `block` is a\n // boolean indicating whether this is a block (`/* */`) comment,\n // `text` is the content of the comment, and `start` and `end` are\n // character offsets that denote the start and end of the comment.\n // When the `locations` option is on, two more parameters are\n // passed, the full `{line, column}` locations of the start and\n // end of the comments. Note that you are not allowed to call the\n // parser from the callback—that will corrupt its internal state.\n onComment: null,\n // Nodes have their start and end characters offsets recorded in\n // `start` and `end` properties (directly on the node, rather than\n // the `loc` object, which holds line/column data. To also add a\n // [semi-standardized][range] `range` property holding a `[start,\n // end]` array with the same numbers, set the `ranges` option to\n // `true`.\n //\n // [range]: https://bugzilla.mozilla.org/show_bug.cgi?id=745678\n ranges: false,\n // It is possible to parse multiple files into a single AST by\n // passing the tree produced by parsing the first file as\n // `program` option in subsequent parses. This will add the\n // toplevel forms of the parsed file to the `Program` (top) node\n // of an existing parse tree.\n program: null,\n // When `locations` is on, you can pass this to record the source\n // file in every node's `loc` object.\n sourceFile: null,\n // This value, if given, is stored in every node, whether\n // `locations` is on or off.\n directSourceFile: null,\n // When enabled, parenthesized expressions are represented by\n // (non-standard) ParenthesizedExpression nodes\n preserveParens: false\n};\n\n// Interpret and default an options object\n\nfunction getOptions(opts) {\n var options = {};\n\n for (var opt in defaultOptions)\n { options[opt] = opts && has(opts, opt) ? opts[opt] : defaultOptions[opt]; }\n\n if (options.ecmaVersion >= 2015)\n { options.ecmaVersion -= 2009; }\n\n if (options.allowReserved == null)\n { options.allowReserved = options.ecmaVersion < 5; }\n\n if (isArray(options.onToken)) {\n var tokens = options.onToken;\n options.onToken = function (token) { return tokens.push(token); };\n }\n if (isArray(options.onComment))\n { options.onComment = pushComment(options, options.onComment); }\n\n return options\n}\n\nfunction pushComment(options, array) {\n return function(block, text, start, end, startLoc, endLoc) {\n var comment = {\n type: block ? \"Block\" : \"Line\",\n value: text,\n start: start,\n end: end\n };\n if (options.locations)\n { comment.loc = new SourceLocation(this, startLoc, endLoc); }\n if (options.ranges)\n { comment.range = [start, end]; }\n array.push(comment);\n }\n}\n\n// Each scope gets a bitset that may contain these flags\nvar\n SCOPE_TOP = 1,\n SCOPE_FUNCTION = 2,\n SCOPE_VAR = SCOPE_TOP | SCOPE_FUNCTION,\n SCOPE_ASYNC = 4,\n SCOPE_GENERATOR = 8,\n SCOPE_ARROW = 16,\n SCOPE_SIMPLE_CATCH = 32,\n SCOPE_SUPER = 64,\n SCOPE_DIRECT_SUPER = 128;\n\nfunction functionFlags(async, generator) {\n return SCOPE_FUNCTION | (async ? SCOPE_ASYNC : 0) | (generator ? SCOPE_GENERATOR : 0)\n}\n\n// Used in checkLVal and declareName to determine the type of a binding\nvar\n BIND_NONE = 0, // Not a binding\n BIND_VAR = 1, // Var-style binding\n BIND_LEXICAL = 2, // Let- or const-style binding\n BIND_FUNCTION = 3, // Function declaration\n BIND_SIMPLE_CATCH = 4, // Simple (identifier pattern) catch binding\n BIND_OUTSIDE = 5; // Special case for function names as bound inside the function\n\nvar Parser = function Parser(options, input, startPos) {\n this.options = options = getOptions(options);\n this.sourceFile = options.sourceFile;\n this.keywords = wordsRegexp(keywords[options.ecmaVersion >= 6 ? 6 : options.sourceType === \"module\" ? \"5module\" : 5]);\n var reserved = \"\";\n if (options.allowReserved !== true) {\n for (var v = options.ecmaVersion;; v--)\n { if (reserved = reservedWords[v]) { break } }\n if (options.sourceType === \"module\") { reserved += \" await\"; }\n }\n this.reservedWords = wordsRegexp(reserved);\n var reservedStrict = (reserved ? reserved + \" \" : \"\") + reservedWords.strict;\n this.reservedWordsStrict = wordsRegexp(reservedStrict);\n this.reservedWordsStrictBind = wordsRegexp(reservedStrict + \" \" + reservedWords.strictBind);\n this.input = String(input);\n\n // Used to signal to callers of `readWord1` whether the word\n // contained any escape sequences. This is needed because words with\n // escape sequences must not be interpreted as keywords.\n this.containsEsc = false;\n\n // Set up token state\n\n // The current position of the tokenizer in the input.\n if (startPos) {\n this.pos = startPos;\n this.lineStart = this.input.lastIndexOf(\"\\n\", startPos - 1) + 1;\n this.curLine = this.input.slice(0, this.lineStart).split(lineBreak).length;\n } else {\n this.pos = this.lineStart = 0;\n this.curLine = 1;\n }\n\n // Properties of the current token:\n // Its type\n this.type = types.eof;\n // For tokens that include more information than their type, the value\n this.value = null;\n // Its start and end offset\n this.start = this.end = this.pos;\n // And, if locations are used, the {line, column} object\n // corresponding to those offsets\n this.startLoc = this.endLoc = this.curPosition();\n\n // Position information for the previous token\n this.lastTokEndLoc = this.lastTokStartLoc = null;\n this.lastTokStart = this.lastTokEnd = this.pos;\n\n // The context stack is used to superficially track syntactic\n // context to predict whether a regular expression is allowed in a\n // given position.\n this.context = this.initialContext();\n this.exprAllowed = true;\n\n // Figure out if it's a module code.\n this.inModule = options.sourceType === \"module\";\n this.strict = this.inModule || this.strictDirective(this.pos);\n\n // Used to signify the start of a potential arrow function\n this.potentialArrowAt = -1;\n\n // Positions to delayed-check that yield/await does not exist in default parameters.\n this.yieldPos = this.awaitPos = this.awaitIdentPos = 0;\n // Labels in scope.\n this.labels = [];\n // Thus-far undefined exports.\n this.undefinedExports = {};\n\n // If enabled, skip leading hashbang line.\n if (this.pos === 0 && options.allowHashBang && this.input.slice(0, 2) === \"#!\")\n { this.skipLineComment(2); }\n\n // Scope tracking for duplicate variable names (see scope.js)\n this.scopeStack = [];\n this.enterScope(SCOPE_TOP);\n\n // For RegExp validation\n this.regexpState = null;\n};\n\nvar prototypeAccessors = { inFunction: { configurable: true },inGenerator: { configurable: true },inAsync: { configurable: true },allowSuper: { configurable: true },allowDirectSuper: { configurable: true },treatFunctionsAsVar: { configurable: true } };\n\nParser.prototype.parse = function parse () {\n var node = this.options.program || this.startNode();\n this.nextToken();\n return this.parseTopLevel(node)\n};\n\nprototypeAccessors.inFunction.get = function () { return (this.currentVarScope().flags & SCOPE_FUNCTION) > 0 };\nprototypeAccessors.inGenerator.get = function () { return (this.currentVarScope().flags & SCOPE_GENERATOR) > 0 };\nprototypeAccessors.inAsync.get = function () { return (this.currentVarScope().flags & SCOPE_ASYNC) > 0 };\nprototypeAccessors.allowSuper.get = function () { return (this.currentThisScope().flags & SCOPE_SUPER) > 0 };\nprototypeAccessors.allowDirectSuper.get = function () { return (this.currentThisScope().flags & SCOPE_DIRECT_SUPER) > 0 };\nprototypeAccessors.treatFunctionsAsVar.get = function () { return this.treatFunctionsAsVarInScope(this.currentScope()) };\n\n// Switch to a getter for 7.0.0.\nParser.prototype.inNonArrowFunction = function inNonArrowFunction () { return (this.currentThisScope().flags & SCOPE_FUNCTION) > 0 };\n\nParser.extend = function extend () {\n var plugins = [], len = arguments.length;\n while ( len-- ) plugins[ len ] = arguments[ len ];\n\n var cls = this;\n for (var i = 0; i < plugins.length; i++) { cls = plugins[i](cls); }\n return cls\n};\n\nParser.parse = function parse (input, options) {\n return new this(options, input).parse()\n};\n\nParser.parseExpressionAt = function parseExpressionAt (input, pos, options) {\n var parser = new this(options, input, pos);\n parser.nextToken();\n return parser.parseExpression()\n};\n\nParser.tokenizer = function tokenizer (input, options) {\n return new this(options, input)\n};\n\nObject.defineProperties( Parser.prototype, prototypeAccessors );\n\nvar pp = Parser.prototype;\n\n// ## Parser utilities\n\nvar literal = /^(?:'((?:\\\\.|[^'])*?)'|\"((?:\\\\.|[^\"])*?)\")/;\npp.strictDirective = function(start) {\n for (;;) {\n // Try to find string literal.\n skipWhiteSpace.lastIndex = start;\n start += skipWhiteSpace.exec(this.input)[0].length;\n var match = literal.exec(this.input.slice(start));\n if (!match) { return false }\n if ((match[1] || match[2]) === \"use strict\") { return true }\n start += match[0].length;\n\n // Skip semicolon, if any.\n skipWhiteSpace.lastIndex = start;\n start += skipWhiteSpace.exec(this.input)[0].length;\n if (this.input[start] === \";\")\n { start++; }\n }\n};\n\n// Predicate that tests whether the next token is of the given\n// type, and if yes, consumes it as a side effect.\n\npp.eat = function(type) {\n if (this.type === type) {\n this.next();\n return true\n } else {\n return false\n }\n};\n\n// Tests whether parsed token is a contextual keyword.\n\npp.isContextual = function(name) {\n return this.type === types.name && this.value === name && !this.containsEsc\n};\n\n// Consumes contextual keyword if possible.\n\npp.eatContextual = function(name) {\n if (!this.isContextual(name)) { return false }\n this.next();\n return true\n};\n\n// Asserts that following token is given contextual keyword.\n\npp.expectContextual = function(name) {\n if (!this.eatContextual(name)) { this.unexpected(); }\n};\n\n// Test whether a semicolon can be inserted at the current position.\n\npp.canInsertSemicolon = function() {\n return this.type === types.eof ||\n this.type === types.braceR ||\n lineBreak.test(this.input.slice(this.lastTokEnd, this.start))\n};\n\npp.insertSemicolon = function() {\n if (this.canInsertSemicolon()) {\n if (this.options.onInsertedSemicolon)\n { this.options.onInsertedSemicolon(this.lastTokEnd, this.lastTokEndLoc); }\n return true\n }\n};\n\n// Consume a semicolon, or, failing that, see if we are allowed to\n// pretend that there is a semicolon at this position.\n\npp.semicolon = function() {\n if (!this.eat(types.semi) && !this.insertSemicolon()) { this.unexpected(); }\n};\n\npp.afterTrailingComma = function(tokType, notNext) {\n if (this.type === tokType) {\n if (this.options.onTrailingComma)\n { this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc); }\n if (!notNext)\n { this.next(); }\n return true\n }\n};\n\n// Expect a token of a given type. If found, consume it, otherwise,\n// raise an unexpected token error.\n\npp.expect = function(type) {\n this.eat(type) || this.unexpected();\n};\n\n// Raise an unexpected token error.\n\npp.unexpected = function(pos) {\n this.raise(pos != null ? pos : this.start, \"Unexpected token\");\n};\n\nfunction DestructuringErrors() {\n this.shorthandAssign =\n this.trailingComma =\n this.parenthesizedAssign =\n this.parenthesizedBind =\n this.doubleProto =\n -1;\n}\n\npp.checkPatternErrors = function(refDestructuringErrors, isAssign) {\n if (!refDestructuringErrors) { return }\n if (refDestructuringErrors.trailingComma > -1)\n { this.raiseRecoverable(refDestructuringErrors.trailingComma, \"Comma is not permitted after the rest element\"); }\n var parens = isAssign ? refDestructuringErrors.parenthesizedAssign : refDestructuringErrors.parenthesizedBind;\n if (parens > -1) { this.raiseRecoverable(parens, \"Parenthesized pattern\"); }\n};\n\npp.checkExpressionErrors = function(refDestructuringErrors, andThrow) {\n if (!refDestructuringErrors) { return false }\n var shorthandAssign = refDestructuringErrors.shorthandAssign;\n var doubleProto = refDestructuringErrors.doubleProto;\n if (!andThrow) { return shorthandAssign >= 0 || doubleProto >= 0 }\n if (shorthandAssign >= 0)\n { this.raise(shorthandAssign, \"Shorthand property assignments are valid only in destructuring patterns\"); }\n if (doubleProto >= 0)\n { this.raiseRecoverable(doubleProto, \"Redefinition of __proto__ property\"); }\n};\n\npp.checkYieldAwaitInDefaultParams = function() {\n if (this.yieldPos && (!this.awaitPos || this.yieldPos < this.awaitPos))\n { this.raise(this.yieldPos, \"Yield expression cannot be a default value\"); }\n if (this.awaitPos)\n { this.raise(this.awaitPos, \"Await expression cannot be a default value\"); }\n};\n\npp.isSimpleAssignTarget = function(expr) {\n if (expr.type === \"ParenthesizedExpression\")\n { return this.isSimpleAssignTarget(expr.expression) }\n return expr.type === \"Identifier\" || expr.type === \"MemberExpression\"\n};\n\nvar pp$1 = Parser.prototype;\n\n// ### Statement parsing\n\n// Parse a program. Initializes the parser, reads any number of\n// statements, and wraps them in a Program node. Optionally takes a\n// `program` argument. If present, the statements will be appended\n// to its body instead of creating a new node.\n\npp$1.parseTopLevel = function(node) {\n var exports = {};\n if (!node.body) { node.body = []; }\n while (this.type !== types.eof) {\n var stmt = this.parseStatement(null, true, exports);\n node.body.push(stmt);\n }\n if (this.inModule)\n { for (var i = 0, list = Object.keys(this.undefinedExports); i < list.length; i += 1)\n {\n var name = list[i];\n\n this.raiseRecoverable(this.undefinedExports[name].start, (\"Export '\" + name + \"' is not defined\"));\n } }\n this.adaptDirectivePrologue(node.body);\n this.next();\n node.sourceType = this.options.sourceType;\n return this.finishNode(node, \"Program\")\n};\n\nvar loopLabel = {kind: \"loop\"}, switchLabel = {kind: \"switch\"};\n\npp$1.isLet = function(context) {\n if (this.options.ecmaVersion < 6 || !this.isContextual(\"let\")) { return false }\n skipWhiteSpace.lastIndex = this.pos;\n var skip = skipWhiteSpace.exec(this.input);\n var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next);\n // For ambiguous cases, determine if a LexicalDeclaration (or only a\n // Statement) is allowed here. If context is not empty then only a Statement\n // is allowed. However, `let [` is an explicit negative lookahead for\n // ExpressionStatement, so special-case it first.\n if (nextCh === 91) { return true } // '['\n if (context) { return false }\n\n if (nextCh === 123) { return true } // '{'\n if (isIdentifierStart(nextCh, true)) {\n var pos = next + 1;\n while (isIdentifierChar(this.input.charCodeAt(pos), true)) { ++pos; }\n var ident = this.input.slice(next, pos);\n if (!keywordRelationalOperator.test(ident)) { return true }\n }\n return false\n};\n\n// check 'async [no LineTerminator here] function'\n// - 'async /*foo*/ function' is OK.\n// - 'async /*\\n*/ function' is invalid.\npp$1.isAsyncFunction = function() {\n if (this.options.ecmaVersion < 8 || !this.isContextual(\"async\"))\n { return false }\n\n skipWhiteSpace.lastIndex = this.pos;\n var skip = skipWhiteSpace.exec(this.input);\n var next = this.pos + skip[0].length;\n return !lineBreak.test(this.input.slice(this.pos, next)) &&\n this.input.slice(next, next + 8) === \"function\" &&\n (next + 8 === this.input.length || !isIdentifierChar(this.input.charAt(next + 8)))\n};\n\n// Parse a single statement.\n//\n// If expecting a statement and finding a slash operator, parse a\n// regular expression literal. This is to handle cases like\n// `if (foo) /blah/.exec(foo)`, where looking at the previous token\n// does not help.\n\npp$1.parseStatement = function(context, topLevel, exports) {\n var starttype = this.type, node = this.startNode(), kind;\n\n if (this.isLet(context)) {\n starttype = types._var;\n kind = \"let\";\n }\n\n // Most types of statements are recognized by the keyword they\n // start with. Many are trivial to parse, some require a bit of\n // complexity.\n\n switch (starttype) {\n case types._break: case types._continue: return this.parseBreakContinueStatement(node, starttype.keyword)\n case types._debugger: return this.parseDebuggerStatement(node)\n case types._do: return this.parseDoStatement(node)\n case types._for: return this.parseForStatement(node)\n case types._function:\n // Function as sole body of either an if statement or a labeled statement\n // works, but not when it is part of a labeled statement that is the sole\n // body of an if statement.\n if ((context && (this.strict || context !== \"if\" && context !== \"label\")) && this.options.ecmaVersion >= 6) { this.unexpected(); }\n return this.parseFunctionStatement(node, false, !context)\n case types._class:\n if (context) { this.unexpected(); }\n return this.parseClass(node, true)\n case types._if: return this.parseIfStatement(node)\n case types._return: return this.parseReturnStatement(node)\n case types._switch: return this.parseSwitchStatement(node)\n case types._throw: return this.parseThrowStatement(node)\n case types._try: return this.parseTryStatement(node)\n case types._const: case types._var:\n kind = kind || this.value;\n if (context && kind !== \"var\") { this.unexpected(); }\n return this.parseVarStatement(node, kind)\n case types._while: return this.parseWhileStatement(node)\n case types._with: return this.parseWithStatement(node)\n case types.braceL: return this.parseBlock(true, node)\n case types.semi: return this.parseEmptyStatement(node)\n case types._export:\n case types._import:\n if (this.options.ecmaVersion > 10 && starttype === types._import) {\n skipWhiteSpace.lastIndex = this.pos;\n var skip = skipWhiteSpace.exec(this.input);\n var next = this.pos + skip[0].length, nextCh = this.input.charCodeAt(next);\n if (nextCh === 40) // '('\n { return this.parseExpressionStatement(node, this.parseExpression()) }\n }\n\n if (!this.options.allowImportExportEverywhere) {\n if (!topLevel)\n { this.raise(this.start, \"'import' and 'export' may only appear at the top level\"); }\n if (!this.inModule)\n { this.raise(this.start, \"'import' and 'export' may appear only with 'sourceType: module'\"); }\n }\n return starttype === types._import ? this.parseImport(node) : this.parseExport(node, exports)\n\n // If the statement does not start with a statement keyword or a\n // brace, it's an ExpressionStatement or LabeledStatement. We\n // simply start parsing an expression, and afterwards, if the\n // next token is a colon and the expression was a simple\n // Identifier node, we switch to interpreting it as a label.\n default:\n if (this.isAsyncFunction()) {\n if (context) { this.unexpected(); }\n this.next();\n return this.parseFunctionStatement(node, true, !context)\n }\n\n var maybeName = this.value, expr = this.parseExpression();\n if (starttype === types.name && expr.type === \"Identifier\" && this.eat(types.colon))\n { return this.parseLabeledStatement(node, maybeName, expr, context) }\n else { return this.parseExpressionStatement(node, expr) }\n }\n};\n\npp$1.parseBreakContinueStatement = function(node, keyword) {\n var isBreak = keyword === \"break\";\n this.next();\n if (this.eat(types.semi) || this.insertSemicolon()) { node.label = null; }\n else if (this.type !== types.name) { this.unexpected(); }\n else {\n node.label = this.parseIdent();\n this.semicolon();\n }\n\n // Verify that there is an actual destination to break or\n // continue to.\n var i = 0;\n for (; i < this.labels.length; ++i) {\n var lab = this.labels[i];\n if (node.label == null || lab.name === node.label.name) {\n if (lab.kind != null && (isBreak || lab.kind === \"loop\")) { break }\n if (node.label && isBreak) { break }\n }\n }\n if (i === this.labels.length) { this.raise(node.start, \"Unsyntactic \" + keyword); }\n return this.finishNode(node, isBreak ? \"BreakStatement\" : \"ContinueStatement\")\n};\n\npp$1.parseDebuggerStatement = function(node) {\n this.next();\n this.semicolon();\n return this.finishNode(node, \"DebuggerStatement\")\n};\n\npp$1.parseDoStatement = function(node) {\n this.next();\n this.labels.push(loopLabel);\n node.body = this.parseStatement(\"do\");\n this.labels.pop();\n this.expect(types._while);\n node.test = this.parseParenExpression();\n if (this.options.ecmaVersion >= 6)\n { this.eat(types.semi); }\n else\n { this.semicolon(); }\n return this.finishNode(node, \"DoWhileStatement\")\n};\n\n// Disambiguating between a `for` and a `for`/`in` or `for`/`of`\n// loop is non-trivial. Basically, we have to parse the init `var`\n// statement or expression, disallowing the `in` operator (see\n// the second parameter to `parseExpression`), and then check\n// whether the next token is `in` or `of`. When there is no init\n// part (semicolon immediately after the opening parenthesis), it\n// is a regular `for` loop.\n\npp$1.parseForStatement = function(node) {\n this.next();\n var awaitAt = (this.options.ecmaVersion >= 9 && (this.inAsync || (!this.inFunction && this.options.allowAwaitOutsideFunction)) && this.eatContextual(\"await\")) ? this.lastTokStart : -1;\n this.labels.push(loopLabel);\n this.enterScope(0);\n this.expect(types.parenL);\n if (this.type === types.semi) {\n if (awaitAt > -1) { this.unexpected(awaitAt); }\n return this.parseFor(node, null)\n }\n var isLet = this.isLet();\n if (this.type === types._var || this.type === types._const || isLet) {\n var init$1 = this.startNode(), kind = isLet ? \"let\" : this.value;\n this.next();\n this.parseVar(init$1, true, kind);\n this.finishNode(init$1, \"VariableDeclaration\");\n if ((this.type === types._in || (this.options.ecmaVersion >= 6 && this.isContextual(\"of\"))) && init$1.declarations.length === 1) {\n if (this.options.ecmaVersion >= 9) {\n if (this.type === types._in) {\n if (awaitAt > -1) { this.unexpected(awaitAt); }\n } else { node.await = awaitAt > -1; }\n }\n return this.parseForIn(node, init$1)\n }\n if (awaitAt > -1) { this.unexpected(awaitAt); }\n return this.parseFor(node, init$1)\n }\n var refDestructuringErrors = new DestructuringErrors;\n var init = this.parseExpression(true, refDestructuringErrors);\n if (this.type === types._in || (this.options.ecmaVersion >= 6 && this.isContextual(\"of\"))) {\n if (this.options.ecmaVersion >= 9) {\n if (this.type === types._in) {\n if (awaitAt > -1) { this.unexpected(awaitAt); }\n } else { node.await = awaitAt > -1; }\n }\n this.toAssignable(init, false, refDestructuringErrors);\n this.checkLVal(init);\n return this.parseForIn(node, init)\n } else {\n this.checkExpressionErrors(refDestructuringErrors, true);\n }\n if (awaitAt > -1) { this.unexpected(awaitAt); }\n return this.parseFor(node, init)\n};\n\npp$1.parseFunctionStatement = function(node, isAsync, declarationPosition) {\n this.next();\n return this.parseFunction(node, FUNC_STATEMENT | (declarationPosition ? 0 : FUNC_HANGING_STATEMENT), false, isAsync)\n};\n\npp$1.parseIfStatement = function(node) {\n this.next();\n node.test = this.parseParenExpression();\n // allow function declarations in branches, but only in non-strict mode\n node.consequent = this.parseStatement(\"if\");\n node.alternate = this.eat(types._else) ? this.parseStatement(\"if\") : null;\n return this.finishNode(node, \"IfStatement\")\n};\n\npp$1.parseReturnStatement = function(node) {\n if (!this.inFunction && !this.options.allowReturnOutsideFunction)\n { this.raise(this.start, \"'return' outside of function\"); }\n this.next();\n\n // In `return` (and `break`/`continue`), the keywords with\n // optional arguments, we eagerly look for a semicolon or the\n // possibility to insert one.\n\n if (this.eat(types.semi) || this.insertSemicolon()) { node.argument = null; }\n else { node.argument = this.parseExpression(); this.semicolon(); }\n return this.finishNode(node, \"ReturnStatement\")\n};\n\npp$1.parseSwitchStatement = function(node) {\n this.next();\n node.discriminant = this.parseParenExpression();\n node.cases = [];\n this.expect(types.braceL);\n this.labels.push(switchLabel);\n this.enterScope(0);\n\n // Statements under must be grouped (by label) in SwitchCase\n // nodes. `cur` is used to keep the node that we are currently\n // adding statements to.\n\n var cur;\n for (var sawDefault = false; this.type !== types.braceR;) {\n if (this.type === types._case || this.type === types._default) {\n var isCase = this.type === types._case;\n if (cur) { this.finishNode(cur, \"SwitchCase\"); }\n node.cases.push(cur = this.startNode());\n cur.consequent = [];\n this.next();\n if (isCase) {\n cur.test = this.parseExpression();\n } else {\n if (sawDefault) { this.raiseRecoverable(this.lastTokStart, \"Multiple default clauses\"); }\n sawDefault = true;\n cur.test = null;\n }\n this.expect(types.colon);\n } else {\n if (!cur) { this.unexpected(); }\n cur.consequent.push(this.parseStatement(null));\n }\n }\n this.exitScope();\n if (cur) { this.finishNode(cur, \"SwitchCase\"); }\n this.next(); // Closing brace\n this.labels.pop();\n return this.finishNode(node, \"SwitchStatement\")\n};\n\npp$1.parseThrowStatement = function(node) {\n this.next();\n if (lineBreak.test(this.input.slice(this.lastTokEnd, this.start)))\n { this.raise(this.lastTokEnd, \"Illegal newline after throw\"); }\n node.argument = this.parseExpression();\n this.semicolon();\n return this.finishNode(node, \"ThrowStatement\")\n};\n\n// Reused empty array added for node fields that are always empty.\n\nvar empty = [];\n\npp$1.parseTryStatement = function(node) {\n this.next();\n node.block = this.parseBlock();\n node.handler = null;\n if (this.type === types._catch) {\n var clause = this.startNode();\n this.next();\n if (this.eat(types.parenL)) {\n clause.param = this.parseBindingAtom();\n var simple = clause.param.type === \"Identifier\";\n this.enterScope(simple ? SCOPE_SIMPLE_CATCH : 0);\n this.checkLVal(clause.param, simple ? BIND_SIMPLE_CATCH : BIND_LEXICAL);\n this.expect(types.parenR);\n } else {\n if (this.options.ecmaVersion < 10) { this.unexpected(); }\n clause.param = null;\n this.enterScope(0);\n }\n clause.body = this.parseBlock(false);\n this.exitScope();\n node.handler = this.finishNode(clause, \"CatchClause\");\n }\n node.finalizer = this.eat(types._finally) ? this.parseBlock() : null;\n if (!node.handler && !node.finalizer)\n { this.raise(node.start, \"Missing catch or finally clause\"); }\n return this.finishNode(node, \"TryStatement\")\n};\n\npp$1.parseVarStatement = function(node, kind) {\n this.next();\n this.parseVar(node, false, kind);\n this.semicolon();\n return this.finishNode(node, \"VariableDeclaration\")\n};\n\npp$1.parseWhileStatement = function(node) {\n this.next();\n node.test = this.parseParenExpression();\n this.labels.push(loopLabel);\n node.body = this.parseStatement(\"while\");\n this.labels.pop();\n return this.finishNode(node, \"WhileStatement\")\n};\n\npp$1.parseWithStatement = function(node) {\n if (this.strict) { this.raise(this.start, \"'with' in strict mode\"); }\n this.next();\n node.object = this.parseParenExpression();\n node.body = this.parseStatement(\"with\");\n return this.finishNode(node, \"WithStatement\")\n};\n\npp$1.parseEmptyStatement = function(node) {\n this.next();\n return this.finishNode(node, \"EmptyStatement\")\n};\n\npp$1.parseLabeledStatement = function(node, maybeName, expr, context) {\n for (var i$1 = 0, list = this.labels; i$1 < list.length; i$1 += 1)\n {\n var label = list[i$1];\n\n if (label.name === maybeName)\n { this.raise(expr.start, \"Label '\" + maybeName + \"' is already declared\");\n } }\n var kind = this.type.isLoop ? \"loop\" : this.type === types._switch ? \"switch\" : null;\n for (var i = this.labels.length - 1; i >= 0; i--) {\n var label$1 = this.labels[i];\n if (label$1.statementStart === node.start) {\n // Update information about previous labels on this node\n label$1.statementStart = this.start;\n label$1.kind = kind;\n } else { break }\n }\n this.labels.push({name: maybeName, kind: kind, statementStart: this.start});\n node.body = this.parseStatement(context ? context.indexOf(\"label\") === -1 ? context + \"label\" : context : \"label\");\n this.labels.pop();\n node.label = expr;\n return this.finishNode(node, \"LabeledStatement\")\n};\n\npp$1.parseExpressionStatement = function(node, expr) {\n node.expression = expr;\n this.semicolon();\n return this.finishNode(node, \"ExpressionStatement\")\n};\n\n// Parse a semicolon-enclosed block of statements, handling `\"use\n// strict\"` declarations when `allowStrict` is true (used for\n// function bodies).\n\npp$1.parseBlock = function(createNewLexicalScope, node) {\n if ( createNewLexicalScope === void 0 ) createNewLexicalScope = true;\n if ( node === void 0 ) node = this.startNode();\n\n node.body = [];\n this.expect(types.braceL);\n if (createNewLexicalScope) { this.enterScope(0); }\n while (!this.eat(types.braceR)) {\n var stmt = this.parseStatement(null);\n node.body.push(stmt);\n }\n if (createNewLexicalScope) { this.exitScope(); }\n return this.finishNode(node, \"BlockStatement\")\n};\n\n// Parse a regular `for` loop. The disambiguation code in\n// `parseStatement` will already have parsed the init statement or\n// expression.\n\npp$1.parseFor = function(node, init) {\n node.init = init;\n this.expect(types.semi);\n node.test = this.type === types.semi ? null : this.parseExpression();\n this.expect(types.semi);\n node.update = this.type === types.parenR ? null : this.parseExpression();\n this.expect(types.parenR);\n node.body = this.parseStatement(\"for\");\n this.exitScope();\n this.labels.pop();\n return this.finishNode(node, \"ForStatement\")\n};\n\n// Parse a `for`/`in` and `for`/`of` loop, which are almost\n// same from parser's perspective.\n\npp$1.parseForIn = function(node, init) {\n var isForIn = this.type === types._in;\n this.next();\n\n if (\n init.type === \"VariableDeclaration\" &&\n init.declarations[0].init != null &&\n (\n !isForIn ||\n this.options.ecmaVersion < 8 ||\n this.strict ||\n init.kind !== \"var\" ||\n init.declarations[0].id.type !== \"Identifier\"\n )\n ) {\n this.raise(\n init.start,\n ((isForIn ? \"for-in\" : \"for-of\") + \" loop variable declaration may not have an initializer\")\n );\n } else if (init.type === \"AssignmentPattern\") {\n this.raise(init.start, \"Invalid left-hand side in for-loop\");\n }\n node.left = init;\n node.right = isForIn ? this.parseExpression() : this.parseMaybeAssign();\n this.expect(types.parenR);\n node.body = this.parseStatement(\"for\");\n this.exitScope();\n this.labels.pop();\n return this.finishNode(node, isForIn ? \"ForInStatement\" : \"ForOfStatement\")\n};\n\n// Parse a list of variable declarations.\n\npp$1.parseVar = function(node, isFor, kind) {\n node.declarations = [];\n node.kind = kind;\n for (;;) {\n var decl = this.startNode();\n this.parseVarId(decl, kind);\n if (this.eat(types.eq)) {\n decl.init = this.parseMaybeAssign(isFor);\n } else if (kind === \"const\" && !(this.type === types._in || (this.options.ecmaVersion >= 6 && this.isContextual(\"of\")))) {\n this.unexpected();\n } else if (decl.id.type !== \"Identifier\" && !(isFor && (this.type === types._in || this.isContextual(\"of\")))) {\n this.raise(this.lastTokEnd, \"Complex binding patterns require an initialization value\");\n } else {\n decl.init = null;\n }\n node.declarations.push(this.finishNode(decl, \"VariableDeclarator\"));\n if (!this.eat(types.comma)) { break }\n }\n return node\n};\n\npp$1.parseVarId = function(decl, kind) {\n decl.id = this.parseBindingAtom();\n this.checkLVal(decl.id, kind === \"var\" ? BIND_VAR : BIND_LEXICAL, false);\n};\n\nvar FUNC_STATEMENT = 1, FUNC_HANGING_STATEMENT = 2, FUNC_NULLABLE_ID = 4;\n\n// Parse a function declaration or literal (depending on the\n// `statement & FUNC_STATEMENT`).\n\n// Remove `allowExpressionBody` for 7.0.0, as it is only called with false\npp$1.parseFunction = function(node, statement, allowExpressionBody, isAsync) {\n this.initFunction(node);\n if (this.options.ecmaVersion >= 9 || this.options.ecmaVersion >= 6 && !isAsync) {\n if (this.type === types.star && (statement & FUNC_HANGING_STATEMENT))\n { this.unexpected(); }\n node.generator = this.eat(types.star);\n }\n if (this.options.ecmaVersion >= 8)\n { node.async = !!isAsync; }\n\n if (statement & FUNC_STATEMENT) {\n node.id = (statement & FUNC_NULLABLE_ID) && this.type !== types.name ? null : this.parseIdent();\n if (node.id && !(statement & FUNC_HANGING_STATEMENT))\n // If it is a regular function declaration in sloppy mode, then it is\n // subject to Annex B semantics (BIND_FUNCTION). Otherwise, the binding\n // mode depends on properties of the current scope (see\n // treatFunctionsAsVar).\n { this.checkLVal(node.id, (this.strict || node.generator || node.async) ? this.treatFunctionsAsVar ? BIND_VAR : BIND_LEXICAL : BIND_FUNCTION); }\n }\n\n var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;\n this.yieldPos = 0;\n this.awaitPos = 0;\n this.awaitIdentPos = 0;\n this.enterScope(functionFlags(node.async, node.generator));\n\n if (!(statement & FUNC_STATEMENT))\n { node.id = this.type === types.name ? this.parseIdent() : null; }\n\n this.parseFunctionParams(node);\n this.parseFunctionBody(node, allowExpressionBody, false);\n\n this.yieldPos = oldYieldPos;\n this.awaitPos = oldAwaitPos;\n this.awaitIdentPos = oldAwaitIdentPos;\n return this.finishNode(node, (statement & FUNC_STATEMENT) ? \"FunctionDeclaration\" : \"FunctionExpression\")\n};\n\npp$1.parseFunctionParams = function(node) {\n this.expect(types.parenL);\n node.params = this.parseBindingList(types.parenR, false, this.options.ecmaVersion >= 8);\n this.checkYieldAwaitInDefaultParams();\n};\n\n// Parse a class declaration or literal (depending on the\n// `isStatement` parameter).\n\npp$1.parseClass = function(node, isStatement) {\n this.next();\n\n // ecma-262 14.6 Class Definitions\n // A class definition is always strict mode code.\n var oldStrict = this.strict;\n this.strict = true;\n\n this.parseClassId(node, isStatement);\n this.parseClassSuper(node);\n var classBody = this.startNode();\n var hadConstructor = false;\n classBody.body = [];\n this.expect(types.braceL);\n while (!this.eat(types.braceR)) {\n var element = this.parseClassElement(node.superClass !== null);\n if (element) {\n classBody.body.push(element);\n if (element.type === \"MethodDefinition\" && element.kind === \"constructor\") {\n if (hadConstructor) { this.raise(element.start, \"Duplicate constructor in the same class\"); }\n hadConstructor = true;\n }\n }\n }\n node.body = this.finishNode(classBody, \"ClassBody\");\n this.strict = oldStrict;\n return this.finishNode(node, isStatement ? \"ClassDeclaration\" : \"ClassExpression\")\n};\n\npp$1.parseClassElement = function(constructorAllowsSuper) {\n var this$1 = this;\n\n if (this.eat(types.semi)) { return null }\n\n var method = this.startNode();\n var tryContextual = function (k, noLineBreak) {\n if ( noLineBreak === void 0 ) noLineBreak = false;\n\n var start = this$1.start, startLoc = this$1.startLoc;\n if (!this$1.eatContextual(k)) { return false }\n if (this$1.type !== types.parenL && (!noLineBreak || !this$1.canInsertSemicolon())) { return true }\n if (method.key) { this$1.unexpected(); }\n method.computed = false;\n method.key = this$1.startNodeAt(start, startLoc);\n method.key.name = k;\n this$1.finishNode(method.key, \"Identifier\");\n return false\n };\n\n method.kind = \"method\";\n method.static = tryContextual(\"static\");\n var isGenerator = this.eat(types.star);\n var isAsync = false;\n if (!isGenerator) {\n if (this.options.ecmaVersion >= 8 && tryContextual(\"async\", true)) {\n isAsync = true;\n isGenerator = this.options.ecmaVersion >= 9 && this.eat(types.star);\n } else if (tryContextual(\"get\")) {\n method.kind = \"get\";\n } else if (tryContextual(\"set\")) {\n method.kind = \"set\";\n }\n }\n if (!method.key) { this.parsePropertyName(method); }\n var key = method.key;\n var allowsDirectSuper = false;\n if (!method.computed && !method.static && (key.type === \"Identifier\" && key.name === \"constructor\" ||\n key.type === \"Literal\" && key.value === \"constructor\")) {\n if (method.kind !== \"method\") { this.raise(key.start, \"Constructor can't have get/set modifier\"); }\n if (isGenerator) { this.raise(key.start, \"Constructor can't be a generator\"); }\n if (isAsync) { this.raise(key.start, \"Constructor can't be an async method\"); }\n method.kind = \"constructor\";\n allowsDirectSuper = constructorAllowsSuper;\n } else if (method.static && key.type === \"Identifier\" && key.name === \"prototype\") {\n this.raise(key.start, \"Classes may not have a static property named prototype\");\n }\n this.parseClassMethod(method, isGenerator, isAsync, allowsDirectSuper);\n if (method.kind === \"get\" && method.value.params.length !== 0)\n { this.raiseRecoverable(method.value.start, \"getter should have no params\"); }\n if (method.kind === \"set\" && method.value.params.length !== 1)\n { this.raiseRecoverable(method.value.start, \"setter should have exactly one param\"); }\n if (method.kind === \"set\" && method.value.params[0].type === \"RestElement\")\n { this.raiseRecoverable(method.value.params[0].start, \"Setter cannot use rest params\"); }\n return method\n};\n\npp$1.parseClassMethod = function(method, isGenerator, isAsync, allowsDirectSuper) {\n method.value = this.parseMethod(isGenerator, isAsync, allowsDirectSuper);\n return this.finishNode(method, \"MethodDefinition\")\n};\n\npp$1.parseClassId = function(node, isStatement) {\n if (this.type === types.name) {\n node.id = this.parseIdent();\n if (isStatement)\n { this.checkLVal(node.id, BIND_LEXICAL, false); }\n } else {\n if (isStatement === true)\n { this.unexpected(); }\n node.id = null;\n }\n};\n\npp$1.parseClassSuper = function(node) {\n node.superClass = this.eat(types._extends) ? this.parseExprSubscripts() : null;\n};\n\n// Parses module export declaration.\n\npp$1.parseExport = function(node, exports) {\n this.next();\n // export * from '...'\n if (this.eat(types.star)) {\n this.expectContextual(\"from\");\n if (this.type !== types.string) { this.unexpected(); }\n node.source = this.parseExprAtom();\n this.semicolon();\n return this.finishNode(node, \"ExportAllDeclaration\")\n }\n if (this.eat(types._default)) { // export default ...\n this.checkExport(exports, \"default\", this.lastTokStart);\n var isAsync;\n if (this.type === types._function || (isAsync = this.isAsyncFunction())) {\n var fNode = this.startNode();\n this.next();\n if (isAsync) { this.next(); }\n node.declaration = this.parseFunction(fNode, FUNC_STATEMENT | FUNC_NULLABLE_ID, false, isAsync);\n } else if (this.type === types._class) {\n var cNode = this.startNode();\n node.declaration = this.parseClass(cNode, \"nullableID\");\n } else {\n node.declaration = this.parseMaybeAssign();\n this.semicolon();\n }\n return this.finishNode(node, \"ExportDefaultDeclaration\")\n }\n // export var|const|let|function|class ...\n if (this.shouldParseExportStatement()) {\n node.declaration = this.parseStatement(null);\n if (node.declaration.type === \"VariableDeclaration\")\n { this.checkVariableExport(exports, node.declaration.declarations); }\n else\n { this.checkExport(exports, node.declaration.id.name, node.declaration.id.start); }\n node.specifiers = [];\n node.source = null;\n } else { // export { x, y as z } [from '...']\n node.declaration = null;\n node.specifiers = this.parseExportSpecifiers(exports);\n if (this.eatContextual(\"from\")) {\n if (this.type !== types.string) { this.unexpected(); }\n node.source = this.parseExprAtom();\n } else {\n for (var i = 0, list = node.specifiers; i < list.length; i += 1) {\n // check for keywords used as local names\n var spec = list[i];\n\n this.checkUnreserved(spec.local);\n // check if export is defined\n this.checkLocalExport(spec.local);\n }\n\n node.source = null;\n }\n this.semicolon();\n }\n return this.finishNode(node, \"ExportNamedDeclaration\")\n};\n\npp$1.checkExport = function(exports, name, pos) {\n if (!exports) { return }\n if (has(exports, name))\n { this.raiseRecoverable(pos, \"Duplicate export '\" + name + \"'\"); }\n exports[name] = true;\n};\n\npp$1.checkPatternExport = function(exports, pat) {\n var type = pat.type;\n if (type === \"Identifier\")\n { this.checkExport(exports, pat.name, pat.start); }\n else if (type === \"ObjectPattern\")\n { for (var i = 0, list = pat.properties; i < list.length; i += 1)\n {\n var prop = list[i];\n\n this.checkPatternExport(exports, prop);\n } }\n else if (type === \"ArrayPattern\")\n { for (var i$1 = 0, list$1 = pat.elements; i$1 < list$1.length; i$1 += 1) {\n var elt = list$1[i$1];\n\n if (elt) { this.checkPatternExport(exports, elt); }\n } }\n else if (type === \"Property\")\n { this.checkPatternExport(exports, pat.value); }\n else if (type === \"AssignmentPattern\")\n { this.checkPatternExport(exports, pat.left); }\n else if (type === \"RestElement\")\n { this.checkPatternExport(exports, pat.argument); }\n else if (type === \"ParenthesizedExpression\")\n { this.checkPatternExport(exports, pat.expression); }\n};\n\npp$1.checkVariableExport = function(exports, decls) {\n if (!exports) { return }\n for (var i = 0, list = decls; i < list.length; i += 1)\n {\n var decl = list[i];\n\n this.checkPatternExport(exports, decl.id);\n }\n};\n\npp$1.shouldParseExportStatement = function() {\n return this.type.keyword === \"var\" ||\n this.type.keyword === \"const\" ||\n this.type.keyword === \"class\" ||\n this.type.keyword === \"function\" ||\n this.isLet() ||\n this.isAsyncFunction()\n};\n\n// Parses a comma-separated list of module exports.\n\npp$1.parseExportSpecifiers = function(exports) {\n var nodes = [], first = true;\n // export { x, y as z } [from '...']\n this.expect(types.braceL);\n while (!this.eat(types.braceR)) {\n if (!first) {\n this.expect(types.comma);\n if (this.afterTrailingComma(types.braceR)) { break }\n } else { first = false; }\n\n var node = this.startNode();\n node.local = this.parseIdent(true);\n node.exported = this.eatContextual(\"as\") ? this.parseIdent(true) : node.local;\n this.checkExport(exports, node.exported.name, node.exported.start);\n nodes.push(this.finishNode(node, \"ExportSpecifier\"));\n }\n return nodes\n};\n\n// Parses import declaration.\n\npp$1.parseImport = function(node) {\n this.next();\n // import '...'\n if (this.type === types.string) {\n node.specifiers = empty;\n node.source = this.parseExprAtom();\n } else {\n node.specifiers = this.parseImportSpecifiers();\n this.expectContextual(\"from\");\n node.source = this.type === types.string ? this.parseExprAtom() : this.unexpected();\n }\n this.semicolon();\n return this.finishNode(node, \"ImportDeclaration\")\n};\n\n// Parses a comma-separated list of module imports.\n\npp$1.parseImportSpecifiers = function() {\n var nodes = [], first = true;\n if (this.type === types.name) {\n // import defaultObj, { x, y as z } from '...'\n var node = this.startNode();\n node.local = this.parseIdent();\n this.checkLVal(node.local, BIND_LEXICAL);\n nodes.push(this.finishNode(node, \"ImportDefaultSpecifier\"));\n if (!this.eat(types.comma)) { return nodes }\n }\n if (this.type === types.star) {\n var node$1 = this.startNode();\n this.next();\n this.expectContextual(\"as\");\n node$1.local = this.parseIdent();\n this.checkLVal(node$1.local, BIND_LEXICAL);\n nodes.push(this.finishNode(node$1, \"ImportNamespaceSpecifier\"));\n return nodes\n }\n this.expect(types.braceL);\n while (!this.eat(types.braceR)) {\n if (!first) {\n this.expect(types.comma);\n if (this.afterTrailingComma(types.braceR)) { break }\n } else { first = false; }\n\n var node$2 = this.startNode();\n node$2.imported = this.parseIdent(true);\n if (this.eatContextual(\"as\")) {\n node$2.local = this.parseIdent();\n } else {\n this.checkUnreserved(node$2.imported);\n node$2.local = node$2.imported;\n }\n this.checkLVal(node$2.local, BIND_LEXICAL);\n nodes.push(this.finishNode(node$2, \"ImportSpecifier\"));\n }\n return nodes\n};\n\n// Set `ExpressionStatement#directive` property for directive prologues.\npp$1.adaptDirectivePrologue = function(statements) {\n for (var i = 0; i < statements.length && this.isDirectiveCandidate(statements[i]); ++i) {\n statements[i].directive = statements[i].expression.raw.slice(1, -1);\n }\n};\npp$1.isDirectiveCandidate = function(statement) {\n return (\n statement.type === \"ExpressionStatement\" &&\n statement.expression.type === \"Literal\" &&\n typeof statement.expression.value === \"string\" &&\n // Reject parenthesized strings.\n (this.input[statement.start] === \"\\\"\" || this.input[statement.start] === \"'\")\n )\n};\n\nvar pp$2 = Parser.prototype;\n\n// Convert existing expression atom to assignable pattern\n// if possible.\n\npp$2.toAssignable = function(node, isBinding, refDestructuringErrors) {\n if (this.options.ecmaVersion >= 6 && node) {\n switch (node.type) {\n case \"Identifier\":\n if (this.inAsync && node.name === \"await\")\n { this.raise(node.start, \"Cannot use 'await' as identifier inside an async function\"); }\n break\n\n case \"ObjectPattern\":\n case \"ArrayPattern\":\n case \"RestElement\":\n break\n\n case \"ObjectExpression\":\n node.type = \"ObjectPattern\";\n if (refDestructuringErrors) { this.checkPatternErrors(refDestructuringErrors, true); }\n for (var i = 0, list = node.properties; i < list.length; i += 1) {\n var prop = list[i];\n\n this.toAssignable(prop, isBinding);\n // Early error:\n // AssignmentRestProperty[Yield, Await] :\n // `...` DestructuringAssignmentTarget[Yield, Await]\n //\n // It is a Syntax Error if |DestructuringAssignmentTarget| is an |ArrayLiteral| or an |ObjectLiteral|.\n if (\n prop.type === \"RestElement\" &&\n (prop.argument.type === \"ArrayPattern\" || prop.argument.type === \"ObjectPattern\")\n ) {\n this.raise(prop.argument.start, \"Unexpected token\");\n }\n }\n break\n\n case \"Property\":\n // AssignmentProperty has type === \"Property\"\n if (node.kind !== \"init\") { this.raise(node.key.start, \"Object pattern can't contain getter or setter\"); }\n this.toAssignable(node.value, isBinding);\n break\n\n case \"ArrayExpression\":\n node.type = \"ArrayPattern\";\n if (refDestructuringErrors) { this.checkPatternErrors(refDestructuringErrors, true); }\n this.toAssignableList(node.elements, isBinding);\n break\n\n case \"SpreadElement\":\n node.type = \"RestElement\";\n this.toAssignable(node.argument, isBinding);\n if (node.argument.type === \"AssignmentPattern\")\n { this.raise(node.argument.start, \"Rest elements cannot have a default value\"); }\n break\n\n case \"AssignmentExpression\":\n if (node.operator !== \"=\") { this.raise(node.left.end, \"Only '=' operator can be used for specifying default value.\"); }\n node.type = \"AssignmentPattern\";\n delete node.operator;\n this.toAssignable(node.left, isBinding);\n // falls through to AssignmentPattern\n\n case \"AssignmentPattern\":\n break\n\n case \"ParenthesizedExpression\":\n this.toAssignable(node.expression, isBinding, refDestructuringErrors);\n break\n\n case \"MemberExpression\":\n if (!isBinding) { break }\n\n default:\n this.raise(node.start, \"Assigning to rvalue\");\n }\n } else if (refDestructuringErrors) { this.checkPatternErrors(refDestructuringErrors, true); }\n return node\n};\n\n// Convert list of expression atoms to binding list.\n\npp$2.toAssignableList = function(exprList, isBinding) {\n var end = exprList.length;\n for (var i = 0; i < end; i++) {\n var elt = exprList[i];\n if (elt) { this.toAssignable(elt, isBinding); }\n }\n if (end) {\n var last = exprList[end - 1];\n if (this.options.ecmaVersion === 6 && isBinding && last && last.type === \"RestElement\" && last.argument.type !== \"Identifier\")\n { this.unexpected(last.argument.start); }\n }\n return exprList\n};\n\n// Parses spread element.\n\npp$2.parseSpread = function(refDestructuringErrors) {\n var node = this.startNode();\n this.next();\n node.argument = this.parseMaybeAssign(false, refDestructuringErrors);\n return this.finishNode(node, \"SpreadElement\")\n};\n\npp$2.parseRestBinding = function() {\n var node = this.startNode();\n this.next();\n\n // RestElement inside of a function parameter must be an identifier\n if (this.options.ecmaVersion === 6 && this.type !== types.name)\n { this.unexpected(); }\n\n node.argument = this.parseBindingAtom();\n\n return this.finishNode(node, \"RestElement\")\n};\n\n// Parses lvalue (assignable) atom.\n\npp$2.parseBindingAtom = function() {\n if (this.options.ecmaVersion >= 6) {\n switch (this.type) {\n case types.bracketL:\n var node = this.startNode();\n this.next();\n node.elements = this.parseBindingList(types.bracketR, true, true);\n return this.finishNode(node, \"ArrayPattern\")\n\n case types.braceL:\n return this.parseObj(true)\n }\n }\n return this.parseIdent()\n};\n\npp$2.parseBindingList = function(close, allowEmpty, allowTrailingComma) {\n var elts = [], first = true;\n while (!this.eat(close)) {\n if (first) { first = false; }\n else { this.expect(types.comma); }\n if (allowEmpty && this.type === types.comma) {\n elts.push(null);\n } else if (allowTrailingComma && this.afterTrailingComma(close)) {\n break\n } else if (this.type === types.ellipsis) {\n var rest = this.parseRestBinding();\n this.parseBindingListItem(rest);\n elts.push(rest);\n if (this.type === types.comma) { this.raise(this.start, \"Comma is not permitted after the rest element\"); }\n this.expect(close);\n break\n } else {\n var elem = this.parseMaybeDefault(this.start, this.startLoc);\n this.parseBindingListItem(elem);\n elts.push(elem);\n }\n }\n return elts\n};\n\npp$2.parseBindingListItem = function(param) {\n return param\n};\n\n// Parses assignment pattern around given atom if possible.\n\npp$2.parseMaybeDefault = function(startPos, startLoc, left) {\n left = left || this.parseBindingAtom();\n if (this.options.ecmaVersion < 6 || !this.eat(types.eq)) { return left }\n var node = this.startNodeAt(startPos, startLoc);\n node.left = left;\n node.right = this.parseMaybeAssign();\n return this.finishNode(node, \"AssignmentPattern\")\n};\n\n// Verify that a node is an lval — something that can be assigned\n// to.\n// bindingType can be either:\n// 'var' indicating that the lval creates a 'var' binding\n// 'let' indicating that the lval creates a lexical ('let' or 'const') binding\n// 'none' indicating that the binding should be checked for illegal identifiers, but not for duplicate references\n\npp$2.checkLVal = function(expr, bindingType, checkClashes) {\n if ( bindingType === void 0 ) bindingType = BIND_NONE;\n\n switch (expr.type) {\n case \"Identifier\":\n if (bindingType === BIND_LEXICAL && expr.name === \"let\")\n { this.raiseRecoverable(expr.start, \"let is disallowed as a lexically bound name\"); }\n if (this.strict && this.reservedWordsStrictBind.test(expr.name))\n { this.raiseRecoverable(expr.start, (bindingType ? \"Binding \" : \"Assigning to \") + expr.name + \" in strict mode\"); }\n if (checkClashes) {\n if (has(checkClashes, expr.name))\n { this.raiseRecoverable(expr.start, \"Argument name clash\"); }\n checkClashes[expr.name] = true;\n }\n if (bindingType !== BIND_NONE && bindingType !== BIND_OUTSIDE) { this.declareName(expr.name, bindingType, expr.start); }\n break\n\n case \"MemberExpression\":\n if (bindingType) { this.raiseRecoverable(expr.start, \"Binding member expression\"); }\n break\n\n case \"ObjectPattern\":\n for (var i = 0, list = expr.properties; i < list.length; i += 1)\n {\n var prop = list[i];\n\n this.checkLVal(prop, bindingType, checkClashes);\n }\n break\n\n case \"Property\":\n // AssignmentProperty has type === \"Property\"\n this.checkLVal(expr.value, bindingType, checkClashes);\n break\n\n case \"ArrayPattern\":\n for (var i$1 = 0, list$1 = expr.elements; i$1 < list$1.length; i$1 += 1) {\n var elem = list$1[i$1];\n\n if (elem) { this.checkLVal(elem, bindingType, checkClashes); }\n }\n break\n\n case \"AssignmentPattern\":\n this.checkLVal(expr.left, bindingType, checkClashes);\n break\n\n case \"RestElement\":\n this.checkLVal(expr.argument, bindingType, checkClashes);\n break\n\n case \"ParenthesizedExpression\":\n this.checkLVal(expr.expression, bindingType, checkClashes);\n break\n\n default:\n this.raise(expr.start, (bindingType ? \"Binding\" : \"Assigning to\") + \" rvalue\");\n }\n};\n\n// A recursive descent parser operates by defining functions for all\n\nvar pp$3 = Parser.prototype;\n\n// Check if property name clashes with already added.\n// Object/class getters and setters are not allowed to clash —\n// either with each other or with an init property — and in\n// strict mode, init properties are also not allowed to be repeated.\n\npp$3.checkPropClash = function(prop, propHash, refDestructuringErrors) {\n if (this.options.ecmaVersion >= 9 && prop.type === \"SpreadElement\")\n { return }\n if (this.options.ecmaVersion >= 6 && (prop.computed || prop.method || prop.shorthand))\n { return }\n var key = prop.key;\n var name;\n switch (key.type) {\n case \"Identifier\": name = key.name; break\n case \"Literal\": name = String(key.value); break\n default: return\n }\n var kind = prop.kind;\n if (this.options.ecmaVersion >= 6) {\n if (name === \"__proto__\" && kind === \"init\") {\n if (propHash.proto) {\n if (refDestructuringErrors && refDestructuringErrors.doubleProto < 0) { refDestructuringErrors.doubleProto = key.start; }\n // Backwards-compat kludge. Can be removed in version 6.0\n else { this.raiseRecoverable(key.start, \"Redefinition of __proto__ property\"); }\n }\n propHash.proto = true;\n }\n return\n }\n name = \"$\" + name;\n var other = propHash[name];\n if (other) {\n var redefinition;\n if (kind === \"init\") {\n redefinition = this.strict && other.init || other.get || other.set;\n } else {\n redefinition = other.init || other[kind];\n }\n if (redefinition)\n { this.raiseRecoverable(key.start, \"Redefinition of property\"); }\n } else {\n other = propHash[name] = {\n init: false,\n get: false,\n set: false\n };\n }\n other[kind] = true;\n};\n\n// ### Expression parsing\n\n// These nest, from the most general expression type at the top to\n// 'atomic', nondivisible expression types at the bottom. Most of\n// the functions will simply let the function(s) below them parse,\n// and, *if* the syntactic construct they handle is present, wrap\n// the AST node that the inner parser gave them in another node.\n\n// Parse a full expression. The optional arguments are used to\n// forbid the `in` operator (in for loops initalization expressions)\n// and provide reference for storing '=' operator inside shorthand\n// property assignment in contexts where both object expression\n// and object pattern might appear (so it's possible to raise\n// delayed syntax error at correct position).\n\npp$3.parseExpression = function(noIn, refDestructuringErrors) {\n var startPos = this.start, startLoc = this.startLoc;\n var expr = this.parseMaybeAssign(noIn, refDestructuringErrors);\n if (this.type === types.comma) {\n var node = this.startNodeAt(startPos, startLoc);\n node.expressions = [expr];\n while (this.eat(types.comma)) { node.expressions.push(this.parseMaybeAssign(noIn, refDestructuringErrors)); }\n return this.finishNode(node, \"SequenceExpression\")\n }\n return expr\n};\n\n// Parse an assignment expression. This includes applications of\n// operators like `+=`.\n\npp$3.parseMaybeAssign = function(noIn, refDestructuringErrors, afterLeftParse) {\n if (this.isContextual(\"yield\")) {\n if (this.inGenerator) { return this.parseYield(noIn) }\n // The tokenizer will assume an expression is allowed after\n // `yield`, but this isn't that kind of yield\n else { this.exprAllowed = false; }\n }\n\n var ownDestructuringErrors = false, oldParenAssign = -1, oldTrailingComma = -1, oldShorthandAssign = -1;\n if (refDestructuringErrors) {\n oldParenAssign = refDestructuringErrors.parenthesizedAssign;\n oldTrailingComma = refDestructuringErrors.trailingComma;\n oldShorthandAssign = refDestructuringErrors.shorthandAssign;\n refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = refDestructuringErrors.shorthandAssign = -1;\n } else {\n refDestructuringErrors = new DestructuringErrors;\n ownDestructuringErrors = true;\n }\n\n var startPos = this.start, startLoc = this.startLoc;\n if (this.type === types.parenL || this.type === types.name)\n { this.potentialArrowAt = this.start; }\n var left = this.parseMaybeConditional(noIn, refDestructuringErrors);\n if (afterLeftParse) { left = afterLeftParse.call(this, left, startPos, startLoc); }\n if (this.type.isAssign) {\n var node = this.startNodeAt(startPos, startLoc);\n node.operator = this.value;\n node.left = this.type === types.eq ? this.toAssignable(left, false, refDestructuringErrors) : left;\n if (!ownDestructuringErrors) { DestructuringErrors.call(refDestructuringErrors); }\n refDestructuringErrors.shorthandAssign = -1; // reset because shorthand default was used correctly\n this.checkLVal(left);\n this.next();\n node.right = this.parseMaybeAssign(noIn);\n return this.finishNode(node, \"AssignmentExpression\")\n } else {\n if (ownDestructuringErrors) { this.checkExpressionErrors(refDestructuringErrors, true); }\n }\n if (oldParenAssign > -1) { refDestructuringErrors.parenthesizedAssign = oldParenAssign; }\n if (oldTrailingComma > -1) { refDestructuringErrors.trailingComma = oldTrailingComma; }\n if (oldShorthandAssign > -1) { refDestructuringErrors.shorthandAssign = oldShorthandAssign; }\n return left\n};\n\n// Parse a ternary conditional (`?:`) operator.\n\npp$3.parseMaybeConditional = function(noIn, refDestructuringErrors) {\n var startPos = this.start, startLoc = this.startLoc;\n var expr = this.parseExprOps(noIn, refDestructuringErrors);\n if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }\n if (this.eat(types.question)) {\n var node = this.startNodeAt(startPos, startLoc);\n node.test = expr;\n node.consequent = this.parseMaybeAssign();\n this.expect(types.colon);\n node.alternate = this.parseMaybeAssign(noIn);\n return this.finishNode(node, \"ConditionalExpression\")\n }\n return expr\n};\n\n// Start the precedence parser.\n\npp$3.parseExprOps = function(noIn, refDestructuringErrors) {\n var startPos = this.start, startLoc = this.startLoc;\n var expr = this.parseMaybeUnary(refDestructuringErrors, false);\n if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }\n return expr.start === startPos && expr.type === \"ArrowFunctionExpression\" ? expr : this.parseExprOp(expr, startPos, startLoc, -1, noIn)\n};\n\n// Parse binary operators with the operator precedence parsing\n// algorithm. `left` is the left-hand side of the operator.\n// `minPrec` provides context that allows the function to stop and\n// defer further parser to one of its callers when it encounters an\n// operator that has a lower precedence than the set it is parsing.\n\npp$3.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, noIn) {\n var prec = this.type.binop;\n if (prec != null && (!noIn || this.type !== types._in)) {\n if (prec > minPrec) {\n var logical = this.type === types.logicalOR || this.type === types.logicalAND;\n var op = this.value;\n this.next();\n var startPos = this.start, startLoc = this.startLoc;\n var right = this.parseExprOp(this.parseMaybeUnary(null, false), startPos, startLoc, prec, noIn);\n var node = this.buildBinary(leftStartPos, leftStartLoc, left, right, op, logical);\n return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, noIn)\n }\n }\n return left\n};\n\npp$3.buildBinary = function(startPos, startLoc, left, right, op, logical) {\n var node = this.startNodeAt(startPos, startLoc);\n node.left = left;\n node.operator = op;\n node.right = right;\n return this.finishNode(node, logical ? \"LogicalExpression\" : \"BinaryExpression\")\n};\n\n// Parse unary operators, both prefix and postfix.\n\npp$3.parseMaybeUnary = function(refDestructuringErrors, sawUnary) {\n var startPos = this.start, startLoc = this.startLoc, expr;\n if (this.isContextual(\"await\") && (this.inAsync || (!this.inFunction && this.options.allowAwaitOutsideFunction))) {\n expr = this.parseAwait();\n sawUnary = true;\n } else if (this.type.prefix) {\n var node = this.startNode(), update = this.type === types.incDec;\n node.operator = this.value;\n node.prefix = true;\n this.next();\n node.argument = this.parseMaybeUnary(null, true);\n this.checkExpressionErrors(refDestructuringErrors, true);\n if (update) { this.checkLVal(node.argument); }\n else if (this.strict && node.operator === \"delete\" &&\n node.argument.type === \"Identifier\")\n { this.raiseRecoverable(node.start, \"Deleting local variable in strict mode\"); }\n else { sawUnary = true; }\n expr = this.finishNode(node, update ? \"UpdateExpression\" : \"UnaryExpression\");\n } else {\n expr = this.parseExprSubscripts(refDestructuringErrors);\n if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }\n while (this.type.postfix && !this.canInsertSemicolon()) {\n var node$1 = this.startNodeAt(startPos, startLoc);\n node$1.operator = this.value;\n node$1.prefix = false;\n node$1.argument = expr;\n this.checkLVal(expr);\n this.next();\n expr = this.finishNode(node$1, \"UpdateExpression\");\n }\n }\n\n if (!sawUnary && this.eat(types.starstar))\n { return this.buildBinary(startPos, startLoc, expr, this.parseMaybeUnary(null, false), \"**\", false) }\n else\n { return expr }\n};\n\n// Parse call, dot, and `[]`-subscript expressions.\n\npp$3.parseExprSubscripts = function(refDestructuringErrors) {\n var startPos = this.start, startLoc = this.startLoc;\n var expr = this.parseExprAtom(refDestructuringErrors);\n var skipArrowSubscripts = expr.type === \"ArrowFunctionExpression\" && this.input.slice(this.lastTokStart, this.lastTokEnd) !== \")\";\n if (this.checkExpressionErrors(refDestructuringErrors) || skipArrowSubscripts) { return expr }\n var result = this.parseSubscripts(expr, startPos, startLoc);\n if (refDestructuringErrors && result.type === \"MemberExpression\") {\n if (refDestructuringErrors.parenthesizedAssign >= result.start) { refDestructuringErrors.parenthesizedAssign = -1; }\n if (refDestructuringErrors.parenthesizedBind >= result.start) { refDestructuringErrors.parenthesizedBind = -1; }\n }\n return result\n};\n\npp$3.parseSubscripts = function(base, startPos, startLoc, noCalls) {\n var maybeAsyncArrow = this.options.ecmaVersion >= 8 && base.type === \"Identifier\" && base.name === \"async\" &&\n this.lastTokEnd === base.end && !this.canInsertSemicolon() && this.input.slice(base.start, base.end) === \"async\";\n while (true) {\n var element = this.parseSubscript(base, startPos, startLoc, noCalls, maybeAsyncArrow);\n if (element === base || element.type === \"ArrowFunctionExpression\") { return element }\n base = element;\n }\n};\n\npp$3.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArrow) {\n var computed = this.eat(types.bracketL);\n if (computed || this.eat(types.dot)) {\n var node = this.startNodeAt(startPos, startLoc);\n node.object = base;\n node.property = computed ? this.parseExpression() : this.parseIdent(this.options.allowReserved !== \"never\");\n node.computed = !!computed;\n if (computed) { this.expect(types.bracketR); }\n base = this.finishNode(node, \"MemberExpression\");\n } else if (!noCalls && this.eat(types.parenL)) {\n var refDestructuringErrors = new DestructuringErrors, oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;\n this.yieldPos = 0;\n this.awaitPos = 0;\n this.awaitIdentPos = 0;\n var exprList = this.parseExprList(types.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors);\n if (maybeAsyncArrow && !this.canInsertSemicolon() && this.eat(types.arrow)) {\n this.checkPatternErrors(refDestructuringErrors, false);\n this.checkYieldAwaitInDefaultParams();\n if (this.awaitIdentPos > 0)\n { this.raise(this.awaitIdentPos, \"Cannot use 'await' as identifier inside an async function\"); }\n this.yieldPos = oldYieldPos;\n this.awaitPos = oldAwaitPos;\n this.awaitIdentPos = oldAwaitIdentPos;\n return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, true)\n }\n this.checkExpressionErrors(refDestructuringErrors, true);\n this.yieldPos = oldYieldPos || this.yieldPos;\n this.awaitPos = oldAwaitPos || this.awaitPos;\n this.awaitIdentPos = oldAwaitIdentPos || this.awaitIdentPos;\n var node$1 = this.startNodeAt(startPos, startLoc);\n node$1.callee = base;\n node$1.arguments = exprList;\n base = this.finishNode(node$1, \"CallExpression\");\n } else if (this.type === types.backQuote) {\n var node$2 = this.startNodeAt(startPos, startLoc);\n node$2.tag = base;\n node$2.quasi = this.parseTemplate({isTagged: true});\n base = this.finishNode(node$2, \"TaggedTemplateExpression\");\n }\n return base\n};\n\n// Parse an atomic expression — either a single token that is an\n// expression, an expression started by a keyword like `function` or\n// `new`, or an expression wrapped in punctuation like `()`, `[]`,\n// or `{}`.\n\npp$3.parseExprAtom = function(refDestructuringErrors) {\n // If a division operator appears in an expression position, the\n // tokenizer got confused, and we force it to read a regexp instead.\n if (this.type === types.slash) { this.readRegexp(); }\n\n var node, canBeArrow = this.potentialArrowAt === this.start;\n switch (this.type) {\n case types._super:\n if (!this.allowSuper)\n { this.raise(this.start, \"'super' keyword outside a method\"); }\n node = this.startNode();\n this.next();\n if (this.type === types.parenL && !this.allowDirectSuper)\n { this.raise(node.start, \"super() call outside constructor of a subclass\"); }\n // The `super` keyword can appear at below:\n // SuperProperty:\n // super [ Expression ]\n // super . IdentifierName\n // SuperCall:\n // super ( Arguments )\n if (this.type !== types.dot && this.type !== types.bracketL && this.type !== types.parenL)\n { this.unexpected(); }\n return this.finishNode(node, \"Super\")\n\n case types._this:\n node = this.startNode();\n this.next();\n return this.finishNode(node, \"ThisExpression\")\n\n case types.name:\n var startPos = this.start, startLoc = this.startLoc, containsEsc = this.containsEsc;\n var id = this.parseIdent(false);\n if (this.options.ecmaVersion >= 8 && !containsEsc && id.name === \"async\" && !this.canInsertSemicolon() && this.eat(types._function))\n { return this.parseFunction(this.startNodeAt(startPos, startLoc), 0, false, true) }\n if (canBeArrow && !this.canInsertSemicolon()) {\n if (this.eat(types.arrow))\n { return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], false) }\n if (this.options.ecmaVersion >= 8 && id.name === \"async\" && this.type === types.name && !containsEsc) {\n id = this.parseIdent(false);\n if (this.canInsertSemicolon() || !this.eat(types.arrow))\n { this.unexpected(); }\n return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], true)\n }\n }\n return id\n\n case types.regexp:\n var value = this.value;\n node = this.parseLiteral(value.value);\n node.regex = {pattern: value.pattern, flags: value.flags};\n return node\n\n case types.num: case types.string:\n return this.parseLiteral(this.value)\n\n case types._null: case types._true: case types._false:\n node = this.startNode();\n node.value = this.type === types._null ? null : this.type === types._true;\n node.raw = this.type.keyword;\n this.next();\n return this.finishNode(node, \"Literal\")\n\n case types.parenL:\n var start = this.start, expr = this.parseParenAndDistinguishExpression(canBeArrow);\n if (refDestructuringErrors) {\n if (refDestructuringErrors.parenthesizedAssign < 0 && !this.isSimpleAssignTarget(expr))\n { refDestructuringErrors.parenthesizedAssign = start; }\n if (refDestructuringErrors.parenthesizedBind < 0)\n { refDestructuringErrors.parenthesizedBind = start; }\n }\n return expr\n\n case types.bracketL:\n node = this.startNode();\n this.next();\n node.elements = this.parseExprList(types.bracketR, true, true, refDestructuringErrors);\n return this.finishNode(node, \"ArrayExpression\")\n\n case types.braceL:\n return this.parseObj(false, refDestructuringErrors)\n\n case types._function:\n node = this.startNode();\n this.next();\n return this.parseFunction(node, 0)\n\n case types._class:\n return this.parseClass(this.startNode(), false)\n\n case types._new:\n return this.parseNew()\n\n case types.backQuote:\n return this.parseTemplate()\n\n case types._import:\n if (this.options.ecmaVersion >= 11) {\n return this.parseExprImport()\n } else {\n return this.unexpected()\n }\n\n default:\n this.unexpected();\n }\n};\n\npp$3.parseExprImport = function() {\n var node = this.startNode();\n this.next(); // skip `import`\n switch (this.type) {\n case types.parenL:\n return this.parseDynamicImport(node)\n default:\n this.unexpected();\n }\n};\n\npp$3.parseDynamicImport = function(node) {\n this.next(); // skip `(`\n\n // Parse node.source.\n node.source = this.parseMaybeAssign();\n\n // Verify ending.\n if (!this.eat(types.parenR)) {\n var errorPos = this.start;\n if (this.eat(types.comma) && this.eat(types.parenR)) {\n this.raiseRecoverable(errorPos, \"Trailing comma is not allowed in import()\");\n } else {\n this.unexpected(errorPos);\n }\n }\n\n return this.finishNode(node, \"ImportExpression\")\n};\n\npp$3.parseLiteral = function(value) {\n var node = this.startNode();\n node.value = value;\n node.raw = this.input.slice(this.start, this.end);\n if (node.raw.charCodeAt(node.raw.length - 1) === 110) { node.bigint = node.raw.slice(0, -1); }\n this.next();\n return this.finishNode(node, \"Literal\")\n};\n\npp$3.parseParenExpression = function() {\n this.expect(types.parenL);\n var val = this.parseExpression();\n this.expect(types.parenR);\n return val\n};\n\npp$3.parseParenAndDistinguishExpression = function(canBeArrow) {\n var startPos = this.start, startLoc = this.startLoc, val, allowTrailingComma = this.options.ecmaVersion >= 8;\n if (this.options.ecmaVersion >= 6) {\n this.next();\n\n var innerStartPos = this.start, innerStartLoc = this.startLoc;\n var exprList = [], first = true, lastIsComma = false;\n var refDestructuringErrors = new DestructuringErrors, oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, spreadStart;\n this.yieldPos = 0;\n this.awaitPos = 0;\n // Do not save awaitIdentPos to allow checking awaits nested in parameters\n while (this.type !== types.parenR) {\n first ? first = false : this.expect(types.comma);\n if (allowTrailingComma && this.afterTrailingComma(types.parenR, true)) {\n lastIsComma = true;\n break\n } else if (this.type === types.ellipsis) {\n spreadStart = this.start;\n exprList.push(this.parseParenItem(this.parseRestBinding()));\n if (this.type === types.comma) { this.raise(this.start, \"Comma is not permitted after the rest element\"); }\n break\n } else {\n exprList.push(this.parseMaybeAssign(false, refDestructuringErrors, this.parseParenItem));\n }\n }\n var innerEndPos = this.start, innerEndLoc = this.startLoc;\n this.expect(types.parenR);\n\n if (canBeArrow && !this.canInsertSemicolon() && this.eat(types.arrow)) {\n this.checkPatternErrors(refDestructuringErrors, false);\n this.checkYieldAwaitInDefaultParams();\n this.yieldPos = oldYieldPos;\n this.awaitPos = oldAwaitPos;\n return this.parseParenArrowList(startPos, startLoc, exprList)\n }\n\n if (!exprList.length || lastIsComma) { this.unexpected(this.lastTokStart); }\n if (spreadStart) { this.unexpected(spreadStart); }\n this.checkExpressionErrors(refDestructuringErrors, true);\n this.yieldPos = oldYieldPos || this.yieldPos;\n this.awaitPos = oldAwaitPos || this.awaitPos;\n\n if (exprList.length > 1) {\n val = this.startNodeAt(innerStartPos, innerStartLoc);\n val.expressions = exprList;\n this.finishNodeAt(val, \"SequenceExpression\", innerEndPos, innerEndLoc);\n } else {\n val = exprList[0];\n }\n } else {\n val = this.parseParenExpression();\n }\n\n if (this.options.preserveParens) {\n var par = this.startNodeAt(startPos, startLoc);\n par.expression = val;\n return this.finishNode(par, \"ParenthesizedExpression\")\n } else {\n return val\n }\n};\n\npp$3.parseParenItem = function(item) {\n return item\n};\n\npp$3.parseParenArrowList = function(startPos, startLoc, exprList) {\n return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList)\n};\n\n// New's precedence is slightly tricky. It must allow its argument to\n// be a `[]` or dot subscript expression, but not a call — at least,\n// not without wrapping it in parentheses. Thus, it uses the noCalls\n// argument to parseSubscripts to prevent it from consuming the\n// argument list.\n\nvar empty$1 = [];\n\npp$3.parseNew = function() {\n var node = this.startNode();\n var meta = this.parseIdent(true);\n if (this.options.ecmaVersion >= 6 && this.eat(types.dot)) {\n node.meta = meta;\n var containsEsc = this.containsEsc;\n node.property = this.parseIdent(true);\n if (node.property.name !== \"target\" || containsEsc)\n { this.raiseRecoverable(node.property.start, \"The only valid meta property for new is new.target\"); }\n if (!this.inNonArrowFunction())\n { this.raiseRecoverable(node.start, \"new.target can only be used in functions\"); }\n return this.finishNode(node, \"MetaProperty\")\n }\n var startPos = this.start, startLoc = this.startLoc, isImport = this.type === types._import;\n node.callee = this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true);\n if (isImport && node.callee.type === \"ImportExpression\") {\n this.raise(startPos, \"Cannot use new with import()\");\n }\n if (this.eat(types.parenL)) { node.arguments = this.parseExprList(types.parenR, this.options.ecmaVersion >= 8, false); }\n else { node.arguments = empty$1; }\n return this.finishNode(node, \"NewExpression\")\n};\n\n// Parse template expression.\n\npp$3.parseTemplateElement = function(ref) {\n var isTagged = ref.isTagged;\n\n var elem = this.startNode();\n if (this.type === types.invalidTemplate) {\n if (!isTagged) {\n this.raiseRecoverable(this.start, \"Bad escape sequence in untagged template literal\");\n }\n elem.value = {\n raw: this.value,\n cooked: null\n };\n } else {\n elem.value = {\n raw: this.input.slice(this.start, this.end).replace(/\\r\\n?/g, \"\\n\"),\n cooked: this.value\n };\n }\n this.next();\n elem.tail = this.type === types.backQuote;\n return this.finishNode(elem, \"TemplateElement\")\n};\n\npp$3.parseTemplate = function(ref) {\n if ( ref === void 0 ) ref = {};\n var isTagged = ref.isTagged; if ( isTagged === void 0 ) isTagged = false;\n\n var node = this.startNode();\n this.next();\n node.expressions = [];\n var curElt = this.parseTemplateElement({isTagged: isTagged});\n node.quasis = [curElt];\n while (!curElt.tail) {\n if (this.type === types.eof) { this.raise(this.pos, \"Unterminated template literal\"); }\n this.expect(types.dollarBraceL);\n node.expressions.push(this.parseExpression());\n this.expect(types.braceR);\n node.quasis.push(curElt = this.parseTemplateElement({isTagged: isTagged}));\n }\n this.next();\n return this.finishNode(node, \"TemplateLiteral\")\n};\n\npp$3.isAsyncProp = function(prop) {\n return !prop.computed && prop.key.type === \"Identifier\" && prop.key.name === \"async\" &&\n (this.type === types.name || this.type === types.num || this.type === types.string || this.type === types.bracketL || this.type.keyword || (this.options.ecmaVersion >= 9 && this.type === types.star)) &&\n !lineBreak.test(this.input.slice(this.lastTokEnd, this.start))\n};\n\n// Parse an object literal or binding pattern.\n\npp$3.parseObj = function(isPattern, refDestructuringErrors) {\n var node = this.startNode(), first = true, propHash = {};\n node.properties = [];\n this.next();\n while (!this.eat(types.braceR)) {\n if (!first) {\n this.expect(types.comma);\n if (this.options.ecmaVersion >= 5 && this.afterTrailingComma(types.braceR)) { break }\n } else { first = false; }\n\n var prop = this.parseProperty(isPattern, refDestructuringErrors);\n if (!isPattern) { this.checkPropClash(prop, propHash, refDestructuringErrors); }\n node.properties.push(prop);\n }\n return this.finishNode(node, isPattern ? \"ObjectPattern\" : \"ObjectExpression\")\n};\n\npp$3.parseProperty = function(isPattern, refDestructuringErrors) {\n var prop = this.startNode(), isGenerator, isAsync, startPos, startLoc;\n if (this.options.ecmaVersion >= 9 && this.eat(types.ellipsis)) {\n if (isPattern) {\n prop.argument = this.parseIdent(false);\n if (this.type === types.comma) {\n this.raise(this.start, \"Comma is not permitted after the rest element\");\n }\n return this.finishNode(prop, \"RestElement\")\n }\n // To disallow parenthesized identifier via `this.toAssignable()`.\n if (this.type === types.parenL && refDestructuringErrors) {\n if (refDestructuringErrors.parenthesizedAssign < 0) {\n refDestructuringErrors.parenthesizedAssign = this.start;\n }\n if (refDestructuringErrors.parenthesizedBind < 0) {\n refDestructuringErrors.parenthesizedBind = this.start;\n }\n }\n // Parse argument.\n prop.argument = this.parseMaybeAssign(false, refDestructuringErrors);\n // To disallow trailing comma via `this.toAssignable()`.\n if (this.type === types.comma && refDestructuringErrors && refDestructuringErrors.trailingComma < 0) {\n refDestructuringErrors.trailingComma = this.start;\n }\n // Finish\n return this.finishNode(prop, \"SpreadElement\")\n }\n if (this.options.ecmaVersion >= 6) {\n prop.method = false;\n prop.shorthand = false;\n if (isPattern || refDestructuringErrors) {\n startPos = this.start;\n startLoc = this.startLoc;\n }\n if (!isPattern)\n { isGenerator = this.eat(types.star); }\n }\n var containsEsc = this.containsEsc;\n this.parsePropertyName(prop);\n if (!isPattern && !containsEsc && this.options.ecmaVersion >= 8 && !isGenerator && this.isAsyncProp(prop)) {\n isAsync = true;\n isGenerator = this.options.ecmaVersion >= 9 && this.eat(types.star);\n this.parsePropertyName(prop, refDestructuringErrors);\n } else {\n isAsync = false;\n }\n this.parsePropertyValue(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc);\n return this.finishNode(prop, \"Property\")\n};\n\npp$3.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc) {\n if ((isGenerator || isAsync) && this.type === types.colon)\n { this.unexpected(); }\n\n if (this.eat(types.colon)) {\n prop.value = isPattern ? this.parseMaybeDefault(this.start, this.startLoc) : this.parseMaybeAssign(false, refDestructuringErrors);\n prop.kind = \"init\";\n } else if (this.options.ecmaVersion >= 6 && this.type === types.parenL) {\n if (isPattern) { this.unexpected(); }\n prop.kind = \"init\";\n prop.method = true;\n prop.value = this.parseMethod(isGenerator, isAsync);\n } else if (!isPattern && !containsEsc &&\n this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === \"Identifier\" &&\n (prop.key.name === \"get\" || prop.key.name === \"set\") &&\n (this.type !== types.comma && this.type !== types.braceR)) {\n if (isGenerator || isAsync) { this.unexpected(); }\n prop.kind = prop.key.name;\n this.parsePropertyName(prop);\n prop.value = this.parseMethod(false);\n var paramCount = prop.kind === \"get\" ? 0 : 1;\n if (prop.value.params.length !== paramCount) {\n var start = prop.value.start;\n if (prop.kind === \"get\")\n { this.raiseRecoverable(start, \"getter should have no params\"); }\n else\n { this.raiseRecoverable(start, \"setter should have exactly one param\"); }\n } else {\n if (prop.kind === \"set\" && prop.value.params[0].type === \"RestElement\")\n { this.raiseRecoverable(prop.value.params[0].start, \"Setter cannot use rest params\"); }\n }\n } else if (this.options.ecmaVersion >= 6 && !prop.computed && prop.key.type === \"Identifier\") {\n if (isGenerator || isAsync) { this.unexpected(); }\n this.checkUnreserved(prop.key);\n if (prop.key.name === \"await\" && !this.awaitIdentPos)\n { this.awaitIdentPos = startPos; }\n prop.kind = \"init\";\n if (isPattern) {\n prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key);\n } else if (this.type === types.eq && refDestructuringErrors) {\n if (refDestructuringErrors.shorthandAssign < 0)\n { refDestructuringErrors.shorthandAssign = this.start; }\n prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key);\n } else {\n prop.value = prop.key;\n }\n prop.shorthand = true;\n } else { this.unexpected(); }\n};\n\npp$3.parsePropertyName = function(prop) {\n if (this.options.ecmaVersion >= 6) {\n if (this.eat(types.bracketL)) {\n prop.computed = true;\n prop.key = this.parseMaybeAssign();\n this.expect(types.bracketR);\n return prop.key\n } else {\n prop.computed = false;\n }\n }\n return prop.key = this.type === types.num || this.type === types.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== \"never\")\n};\n\n// Initialize empty function node.\n\npp$3.initFunction = function(node) {\n node.id = null;\n if (this.options.ecmaVersion >= 6) { node.generator = node.expression = false; }\n if (this.options.ecmaVersion >= 8) { node.async = false; }\n};\n\n// Parse object or class method.\n\npp$3.parseMethod = function(isGenerator, isAsync, allowDirectSuper) {\n var node = this.startNode(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;\n\n this.initFunction(node);\n if (this.options.ecmaVersion >= 6)\n { node.generator = isGenerator; }\n if (this.options.ecmaVersion >= 8)\n { node.async = !!isAsync; }\n\n this.yieldPos = 0;\n this.awaitPos = 0;\n this.awaitIdentPos = 0;\n this.enterScope(functionFlags(isAsync, node.generator) | SCOPE_SUPER | (allowDirectSuper ? SCOPE_DIRECT_SUPER : 0));\n\n this.expect(types.parenL);\n node.params = this.parseBindingList(types.parenR, false, this.options.ecmaVersion >= 8);\n this.checkYieldAwaitInDefaultParams();\n this.parseFunctionBody(node, false, true);\n\n this.yieldPos = oldYieldPos;\n this.awaitPos = oldAwaitPos;\n this.awaitIdentPos = oldAwaitIdentPos;\n return this.finishNode(node, \"FunctionExpression\")\n};\n\n// Parse arrow function expression with given parameters.\n\npp$3.parseArrowExpression = function(node, params, isAsync) {\n var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;\n\n this.enterScope(functionFlags(isAsync, false) | SCOPE_ARROW);\n this.initFunction(node);\n if (this.options.ecmaVersion >= 8) { node.async = !!isAsync; }\n\n this.yieldPos = 0;\n this.awaitPos = 0;\n this.awaitIdentPos = 0;\n\n node.params = this.toAssignableList(params, true);\n this.parseFunctionBody(node, true, false);\n\n this.yieldPos = oldYieldPos;\n this.awaitPos = oldAwaitPos;\n this.awaitIdentPos = oldAwaitIdentPos;\n return this.finishNode(node, \"ArrowFunctionExpression\")\n};\n\n// Parse function body and check parameters.\n\npp$3.parseFunctionBody = function(node, isArrowFunction, isMethod) {\n var isExpression = isArrowFunction && this.type !== types.braceL;\n var oldStrict = this.strict, useStrict = false;\n\n if (isExpression) {\n node.body = this.parseMaybeAssign();\n node.expression = true;\n this.checkParams(node, false);\n } else {\n var nonSimple = this.options.ecmaVersion >= 7 && !this.isSimpleParamList(node.params);\n if (!oldStrict || nonSimple) {\n useStrict = this.strictDirective(this.end);\n // If this is a strict mode function, verify that argument names\n // are not repeated, and it does not try to bind the words `eval`\n // or `arguments`.\n if (useStrict && nonSimple)\n { this.raiseRecoverable(node.start, \"Illegal 'use strict' directive in function with non-simple parameter list\"); }\n }\n // Start a new scope with regard to labels and the `inFunction`\n // flag (restore them to their old value afterwards).\n var oldLabels = this.labels;\n this.labels = [];\n if (useStrict) { this.strict = true; }\n\n // Add the params to varDeclaredNames to ensure that an error is thrown\n // if a let/const declaration in the function clashes with one of the params.\n this.checkParams(node, !oldStrict && !useStrict && !isArrowFunction && !isMethod && this.isSimpleParamList(node.params));\n node.body = this.parseBlock(false);\n node.expression = false;\n this.adaptDirectivePrologue(node.body.body);\n this.labels = oldLabels;\n }\n this.exitScope();\n\n // Ensure the function name isn't a forbidden identifier in strict mode, e.g. 'eval'\n if (this.strict && node.id) { this.checkLVal(node.id, BIND_OUTSIDE); }\n this.strict = oldStrict;\n};\n\npp$3.isSimpleParamList = function(params) {\n for (var i = 0, list = params; i < list.length; i += 1)\n {\n var param = list[i];\n\n if (param.type !== \"Identifier\") { return false\n } }\n return true\n};\n\n// Checks function params for various disallowed patterns such as using \"eval\"\n// or \"arguments\" and duplicate parameters.\n\npp$3.checkParams = function(node, allowDuplicates) {\n var nameHash = {};\n for (var i = 0, list = node.params; i < list.length; i += 1)\n {\n var param = list[i];\n\n this.checkLVal(param, BIND_VAR, allowDuplicates ? null : nameHash);\n }\n};\n\n// Parses a comma-separated list of expressions, and returns them as\n// an array. `close` is the token type that ends the list, and\n// `allowEmpty` can be turned on to allow subsequent commas with\n// nothing in between them to be parsed as `null` (which is needed\n// for array literals).\n\npp$3.parseExprList = function(close, allowTrailingComma, allowEmpty, refDestructuringErrors) {\n var elts = [], first = true;\n while (!this.eat(close)) {\n if (!first) {\n this.expect(types.comma);\n if (allowTrailingComma && this.afterTrailingComma(close)) { break }\n } else { first = false; }\n\n var elt = (void 0);\n if (allowEmpty && this.type === types.comma)\n { elt = null; }\n else if (this.type === types.ellipsis) {\n elt = this.parseSpread(refDestructuringErrors);\n if (refDestructuringErrors && this.type === types.comma && refDestructuringErrors.trailingComma < 0)\n { refDestructuringErrors.trailingComma = this.start; }\n } else {\n elt = this.parseMaybeAssign(false, refDestructuringErrors);\n }\n elts.push(elt);\n }\n return elts\n};\n\npp$3.checkUnreserved = function(ref) {\n var start = ref.start;\n var end = ref.end;\n var name = ref.name;\n\n if (this.inGenerator && name === \"yield\")\n { this.raiseRecoverable(start, \"Cannot use 'yield' as identifier inside a generator\"); }\n if (this.inAsync && name === \"await\")\n { this.raiseRecoverable(start, \"Cannot use 'await' as identifier inside an async function\"); }\n if (this.keywords.test(name))\n { this.raise(start, (\"Unexpected keyword '\" + name + \"'\")); }\n if (this.options.ecmaVersion < 6 &&\n this.input.slice(start, end).indexOf(\"\\\\\") !== -1) { return }\n var re = this.strict ? this.reservedWordsStrict : this.reservedWords;\n if (re.test(name)) {\n if (!this.inAsync && name === \"await\")\n { this.raiseRecoverable(start, \"Cannot use keyword 'await' outside an async function\"); }\n this.raiseRecoverable(start, (\"The keyword '\" + name + \"' is reserved\"));\n }\n};\n\n// Parse the next token as an identifier. If `liberal` is true (used\n// when parsing properties), it will also convert keywords into\n// identifiers.\n\npp$3.parseIdent = function(liberal, isBinding) {\n var node = this.startNode();\n if (this.type === types.name) {\n node.name = this.value;\n } else if (this.type.keyword) {\n node.name = this.type.keyword;\n\n // To fix https://github.com/acornjs/acorn/issues/575\n // `class` and `function` keywords push new context into this.context.\n // But there is no chance to pop the context if the keyword is consumed as an identifier such as a property name.\n // If the previous token is a dot, this does not apply because the context-managing code already ignored the keyword\n if ((node.name === \"class\" || node.name === \"function\") &&\n (this.lastTokEnd !== this.lastTokStart + 1 || this.input.charCodeAt(this.lastTokStart) !== 46)) {\n this.context.pop();\n }\n } else {\n this.unexpected();\n }\n this.next();\n this.finishNode(node, \"Identifier\");\n if (!liberal) {\n this.checkUnreserved(node);\n if (node.name === \"await\" && !this.awaitIdentPos)\n { this.awaitIdentPos = node.start; }\n }\n return node\n};\n\n// Parses yield expression inside generator.\n\npp$3.parseYield = function(noIn) {\n if (!this.yieldPos) { this.yieldPos = this.start; }\n\n var node = this.startNode();\n this.next();\n if (this.type === types.semi || this.canInsertSemicolon() || (this.type !== types.star && !this.type.startsExpr)) {\n node.delegate = false;\n node.argument = null;\n } else {\n node.delegate = this.eat(types.star);\n node.argument = this.parseMaybeAssign(noIn);\n }\n return this.finishNode(node, \"YieldExpression\")\n};\n\npp$3.parseAwait = function() {\n if (!this.awaitPos) { this.awaitPos = this.start; }\n\n var node = this.startNode();\n this.next();\n node.argument = this.parseMaybeUnary(null, true);\n return this.finishNode(node, \"AwaitExpression\")\n};\n\nvar pp$4 = Parser.prototype;\n\n// This function is used to raise exceptions on parse errors. It\n// takes an offset integer (into the current `input`) to indicate\n// the location of the error, attaches the position to the end\n// of the error message, and then raises a `SyntaxError` with that\n// message.\n\npp$4.raise = function(pos, message) {\n var loc = getLineInfo(this.input, pos);\n message += \" (\" + loc.line + \":\" + loc.column + \")\";\n var err = new SyntaxError(message);\n err.pos = pos; err.loc = loc; err.raisedAt = this.pos;\n throw err\n};\n\npp$4.raiseRecoverable = pp$4.raise;\n\npp$4.curPosition = function() {\n if (this.options.locations) {\n return new Position(this.curLine, this.pos - this.lineStart)\n }\n};\n\nvar pp$5 = Parser.prototype;\n\nvar Scope = function Scope(flags) {\n this.flags = flags;\n // A list of var-declared names in the current lexical scope\n this.var = [];\n // A list of lexically-declared names in the current lexical scope\n this.lexical = [];\n // A list of lexically-declared FunctionDeclaration names in the current lexical scope\n this.functions = [];\n};\n\n// The functions in this module keep track of declared variables in the current scope in order to detect duplicate variable names.\n\npp$5.enterScope = function(flags) {\n this.scopeStack.push(new Scope(flags));\n};\n\npp$5.exitScope = function() {\n this.scopeStack.pop();\n};\n\n// The spec says:\n// > At the top level of a function, or script, function declarations are\n// > treated like var declarations rather than like lexical declarations.\npp$5.treatFunctionsAsVarInScope = function(scope) {\n return (scope.flags & SCOPE_FUNCTION) || !this.inModule && (scope.flags & SCOPE_TOP)\n};\n\npp$5.declareName = function(name, bindingType, pos) {\n var redeclared = false;\n if (bindingType === BIND_LEXICAL) {\n var scope = this.currentScope();\n redeclared = scope.lexical.indexOf(name) > -1 || scope.functions.indexOf(name) > -1 || scope.var.indexOf(name) > -1;\n scope.lexical.push(name);\n if (this.inModule && (scope.flags & SCOPE_TOP))\n { delete this.undefinedExports[name]; }\n } else if (bindingType === BIND_SIMPLE_CATCH) {\n var scope$1 = this.currentScope();\n scope$1.lexical.push(name);\n } else if (bindingType === BIND_FUNCTION) {\n var scope$2 = this.currentScope();\n if (this.treatFunctionsAsVar)\n { redeclared = scope$2.lexical.indexOf(name) > -1; }\n else\n { redeclared = scope$2.lexical.indexOf(name) > -1 || scope$2.var.indexOf(name) > -1; }\n scope$2.functions.push(name);\n } else {\n for (var i = this.scopeStack.length - 1; i >= 0; --i) {\n var scope$3 = this.scopeStack[i];\n if (scope$3.lexical.indexOf(name) > -1 && !((scope$3.flags & SCOPE_SIMPLE_CATCH) && scope$3.lexical[0] === name) ||\n !this.treatFunctionsAsVarInScope(scope$3) && scope$3.functions.indexOf(name) > -1) {\n redeclared = true;\n break\n }\n scope$3.var.push(name);\n if (this.inModule && (scope$3.flags & SCOPE_TOP))\n { delete this.undefinedExports[name]; }\n if (scope$3.flags & SCOPE_VAR) { break }\n }\n }\n if (redeclared) { this.raiseRecoverable(pos, (\"Identifier '\" + name + \"' has already been declared\")); }\n};\n\npp$5.checkLocalExport = function(id) {\n // scope.functions must be empty as Module code is always strict.\n if (this.scopeStack[0].lexical.indexOf(id.name) === -1 &&\n this.scopeStack[0].var.indexOf(id.name) === -1) {\n this.undefinedExports[id.name] = id;\n }\n};\n\npp$5.currentScope = function() {\n return this.scopeStack[this.scopeStack.length - 1]\n};\n\npp$5.currentVarScope = function() {\n for (var i = this.scopeStack.length - 1;; i--) {\n var scope = this.scopeStack[i];\n if (scope.flags & SCOPE_VAR) { return scope }\n }\n};\n\n// Could be useful for `this`, `new.target`, `super()`, `super.property`, and `super[property]`.\npp$5.currentThisScope = function() {\n for (var i = this.scopeStack.length - 1;; i--) {\n var scope = this.scopeStack[i];\n if (scope.flags & SCOPE_VAR && !(scope.flags & SCOPE_ARROW)) { return scope }\n }\n};\n\nvar Node = function Node(parser, pos, loc) {\n this.type = \"\";\n this.start = pos;\n this.end = 0;\n if (parser.options.locations)\n { this.loc = new SourceLocation(parser, loc); }\n if (parser.options.directSourceFile)\n { this.sourceFile = parser.options.directSourceFile; }\n if (parser.options.ranges)\n { this.range = [pos, 0]; }\n};\n\n// Start an AST node, attaching a start offset.\n\nvar pp$6 = Parser.prototype;\n\npp$6.startNode = function() {\n return new Node(this, this.start, this.startLoc)\n};\n\npp$6.startNodeAt = function(pos, loc) {\n return new Node(this, pos, loc)\n};\n\n// Finish an AST node, adding `type` and `end` properties.\n\nfunction finishNodeAt(node, type, pos, loc) {\n node.type = type;\n node.end = pos;\n if (this.options.locations)\n { node.loc.end = loc; }\n if (this.options.ranges)\n { node.range[1] = pos; }\n return node\n}\n\npp$6.finishNode = function(node, type) {\n return finishNodeAt.call(this, node, type, this.lastTokEnd, this.lastTokEndLoc)\n};\n\n// Finish node at given position\n\npp$6.finishNodeAt = function(node, type, pos, loc) {\n return finishNodeAt.call(this, node, type, pos, loc)\n};\n\n// The algorithm used to determine whether a regexp can appear at a\n\nvar TokContext = function TokContext(token, isExpr, preserveSpace, override, generator) {\n this.token = token;\n this.isExpr = !!isExpr;\n this.preserveSpace = !!preserveSpace;\n this.override = override;\n this.generator = !!generator;\n};\n\nvar types$1 = {\n b_stat: new TokContext(\"{\", false),\n b_expr: new TokContext(\"{\", true),\n b_tmpl: new TokContext(\"${\", false),\n p_stat: new TokContext(\"(\", false),\n p_expr: new TokContext(\"(\", true),\n q_tmpl: new TokContext(\"`\", true, true, function (p) { return p.tryReadTemplateToken(); }),\n f_stat: new TokContext(\"function\", false),\n f_expr: new TokContext(\"function\", true),\n f_expr_gen: new TokContext(\"function\", true, false, null, true),\n f_gen: new TokContext(\"function\", false, false, null, true)\n};\n\nvar pp$7 = Parser.prototype;\n\npp$7.initialContext = function() {\n return [types$1.b_stat]\n};\n\npp$7.braceIsBlock = function(prevType) {\n var parent = this.curContext();\n if (parent === types$1.f_expr || parent === types$1.f_stat)\n { return true }\n if (prevType === types.colon && (parent === types$1.b_stat || parent === types$1.b_expr))\n { return !parent.isExpr }\n\n // The check for `tt.name && exprAllowed` detects whether we are\n // after a `yield` or `of` construct. See the `updateContext` for\n // `tt.name`.\n if (prevType === types._return || prevType === types.name && this.exprAllowed)\n { return lineBreak.test(this.input.slice(this.lastTokEnd, this.start)) }\n if (prevType === types._else || prevType === types.semi || prevType === types.eof || prevType === types.parenR || prevType === types.arrow)\n { return true }\n if (prevType === types.braceL)\n { return parent === types$1.b_stat }\n if (prevType === types._var || prevType === types._const || prevType === types.name)\n { return false }\n return !this.exprAllowed\n};\n\npp$7.inGeneratorContext = function() {\n for (var i = this.context.length - 1; i >= 1; i--) {\n var context = this.context[i];\n if (context.token === \"function\")\n { return context.generator }\n }\n return false\n};\n\npp$7.updateContext = function(prevType) {\n var update, type = this.type;\n if (type.keyword && prevType === types.dot)\n { this.exprAllowed = false; }\n else if (update = type.updateContext)\n { update.call(this, prevType); }\n else\n { this.exprAllowed = type.beforeExpr; }\n};\n\n// Token-specific context update code\n\ntypes.parenR.updateContext = types.braceR.updateContext = function() {\n if (this.context.length === 1) {\n this.exprAllowed = true;\n return\n }\n var out = this.context.pop();\n if (out === types$1.b_stat && this.curContext().token === \"function\") {\n out = this.context.pop();\n }\n this.exprAllowed = !out.isExpr;\n};\n\ntypes.braceL.updateContext = function(prevType) {\n this.context.push(this.braceIsBlock(prevType) ? types$1.b_stat : types$1.b_expr);\n this.exprAllowed = true;\n};\n\ntypes.dollarBraceL.updateContext = function() {\n this.context.push(types$1.b_tmpl);\n this.exprAllowed = true;\n};\n\ntypes.parenL.updateContext = function(prevType) {\n var statementParens = prevType === types._if || prevType === types._for || prevType === types._with || prevType === types._while;\n this.context.push(statementParens ? types$1.p_stat : types$1.p_expr);\n this.exprAllowed = true;\n};\n\ntypes.incDec.updateContext = function() {\n // tokExprAllowed stays unchanged\n};\n\ntypes._function.updateContext = types._class.updateContext = function(prevType) {\n if (prevType.beforeExpr && prevType !== types.semi && prevType !== types._else &&\n !(prevType === types._return && lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) &&\n !((prevType === types.colon || prevType === types.braceL) && this.curContext() === types$1.b_stat))\n { this.context.push(types$1.f_expr); }\n else\n { this.context.push(types$1.f_stat); }\n this.exprAllowed = false;\n};\n\ntypes.backQuote.updateContext = function() {\n if (this.curContext() === types$1.q_tmpl)\n { this.context.pop(); }\n else\n { this.context.push(types$1.q_tmpl); }\n this.exprAllowed = false;\n};\n\ntypes.star.updateContext = function(prevType) {\n if (prevType === types._function) {\n var index = this.context.length - 1;\n if (this.context[index] === types$1.f_expr)\n { this.context[index] = types$1.f_expr_gen; }\n else\n { this.context[index] = types$1.f_gen; }\n }\n this.exprAllowed = true;\n};\n\ntypes.name.updateContext = function(prevType) {\n var allowed = false;\n if (this.options.ecmaVersion >= 6 && prevType !== types.dot) {\n if (this.value === \"of\" && !this.exprAllowed ||\n this.value === \"yield\" && this.inGeneratorContext())\n { allowed = true; }\n }\n this.exprAllowed = allowed;\n};\n\n// This file contains Unicode properties extracted from the ECMAScript\n// specification. The lists are extracted like so:\n// $$('#table-binary-unicode-properties > figure > table > tbody > tr > td:nth-child(1) code').map(el => el.innerText)\n\n// #table-binary-unicode-properties\nvar ecma9BinaryProperties = \"ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS\";\nvar ecma10BinaryProperties = ecma9BinaryProperties + \" Extended_Pictographic\";\nvar ecma11BinaryProperties = ecma10BinaryProperties;\nvar unicodeBinaryProperties = {\n 9: ecma9BinaryProperties,\n 10: ecma10BinaryProperties,\n 11: ecma11BinaryProperties\n};\n\n// #table-unicode-general-category-values\nvar unicodeGeneralCategoryValues = \"Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu\";\n\n// #table-unicode-script-values\nvar ecma9ScriptValues = \"Adlam Adlm Ahom Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb\";\nvar ecma10ScriptValues = ecma9ScriptValues + \" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd\";\nvar ecma11ScriptValues = ecma10ScriptValues + \" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho\";\nvar unicodeScriptValues = {\n 9: ecma9ScriptValues,\n 10: ecma10ScriptValues,\n 11: ecma11ScriptValues\n};\n\nvar data = {};\nfunction buildUnicodeData(ecmaVersion) {\n var d = data[ecmaVersion] = {\n binary: wordsRegexp(unicodeBinaryProperties[ecmaVersion] + \" \" + unicodeGeneralCategoryValues),\n nonBinary: {\n General_Category: wordsRegexp(unicodeGeneralCategoryValues),\n Script: wordsRegexp(unicodeScriptValues[ecmaVersion])\n }\n };\n d.nonBinary.Script_Extensions = d.nonBinary.Script;\n\n d.nonBinary.gc = d.nonBinary.General_Category;\n d.nonBinary.sc = d.nonBinary.Script;\n d.nonBinary.scx = d.nonBinary.Script_Extensions;\n}\nbuildUnicodeData(9);\nbuildUnicodeData(10);\nbuildUnicodeData(11);\n\nvar pp$8 = Parser.prototype;\n\nvar RegExpValidationState = function RegExpValidationState(parser) {\n this.parser = parser;\n this.validFlags = \"gim\" + (parser.options.ecmaVersion >= 6 ? \"uy\" : \"\") + (parser.options.ecmaVersion >= 9 ? \"s\" : \"\");\n this.unicodeProperties = data[parser.options.ecmaVersion >= 11 ? 11 : parser.options.ecmaVersion];\n this.source = \"\";\n this.flags = \"\";\n this.start = 0;\n this.switchU = false;\n this.switchN = false;\n this.pos = 0;\n this.lastIntValue = 0;\n this.lastStringValue = \"\";\n this.lastAssertionIsQuantifiable = false;\n this.numCapturingParens = 0;\n this.maxBackReference = 0;\n this.groupNames = [];\n this.backReferenceNames = [];\n};\n\nRegExpValidationState.prototype.reset = function reset (start, pattern, flags) {\n var unicode = flags.indexOf(\"u\") !== -1;\n this.start = start | 0;\n this.source = pattern + \"\";\n this.flags = flags;\n this.switchU = unicode && this.parser.options.ecmaVersion >= 6;\n this.switchN = unicode && this.parser.options.ecmaVersion >= 9;\n};\n\nRegExpValidationState.prototype.raise = function raise (message) {\n this.parser.raiseRecoverable(this.start, (\"Invalid regular expression: /\" + (this.source) + \"/: \" + message));\n};\n\n// If u flag is given, this returns the code point at the index (it combines a surrogate pair).\n// Otherwise, this returns the code unit of the index (can be a part of a surrogate pair).\nRegExpValidationState.prototype.at = function at (i) {\n var s = this.source;\n var l = s.length;\n if (i >= l) {\n return -1\n }\n var c = s.charCodeAt(i);\n if (!this.switchU || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l) {\n return c\n }\n return (c << 10) + s.charCodeAt(i + 1) - 0x35FDC00\n};\n\nRegExpValidationState.prototype.nextIndex = function nextIndex (i) {\n var s = this.source;\n var l = s.length;\n if (i >= l) {\n return l\n }\n var c = s.charCodeAt(i);\n if (!this.switchU || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l) {\n return i + 1\n }\n return i + 2\n};\n\nRegExpValidationState.prototype.current = function current () {\n return this.at(this.pos)\n};\n\nRegExpValidationState.prototype.lookahead = function lookahead () {\n return this.at(this.nextIndex(this.pos))\n};\n\nRegExpValidationState.prototype.advance = function advance () {\n this.pos = this.nextIndex(this.pos);\n};\n\nRegExpValidationState.prototype.eat = function eat (ch) {\n if (this.current() === ch) {\n this.advance();\n return true\n }\n return false\n};\n\nfunction codePointToString(ch) {\n if (ch <= 0xFFFF) { return String.fromCharCode(ch) }\n ch -= 0x10000;\n return String.fromCharCode((ch >> 10) + 0xD800, (ch & 0x03FF) + 0xDC00)\n}\n\n/**\n * Validate the flags part of a given RegExpLiteral.\n *\n * @param {RegExpValidationState} state The state to validate RegExp.\n * @returns {void}\n */\npp$8.validateRegExpFlags = function(state) {\n var validFlags = state.validFlags;\n var flags = state.flags;\n\n for (var i = 0; i < flags.length; i++) {\n var flag = flags.charAt(i);\n if (validFlags.indexOf(flag) === -1) {\n this.raise(state.start, \"Invalid regular expression flag\");\n }\n if (flags.indexOf(flag, i + 1) > -1) {\n this.raise(state.start, \"Duplicate regular expression flag\");\n }\n }\n};\n\n/**\n * Validate the pattern part of a given RegExpLiteral.\n *\n * @param {RegExpValidationState} state The state to validate RegExp.\n * @returns {void}\n */\npp$8.validateRegExpPattern = function(state) {\n this.regexp_pattern(state);\n\n // The goal symbol for the parse is |Pattern[~U, ~N]|. If the result of\n // parsing contains a |GroupName|, reparse with the goal symbol\n // |Pattern[~U, +N]| and use this result instead. Throw a *SyntaxError*\n // exception if _P_ did not conform to the grammar, if any elements of _P_\n // were not matched by the parse, or if any Early Error conditions exist.\n if (!state.switchN && this.options.ecmaVersion >= 9 && state.groupNames.length > 0) {\n state.switchN = true;\n this.regexp_pattern(state);\n }\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-Pattern\npp$8.regexp_pattern = function(state) {\n state.pos = 0;\n state.lastIntValue = 0;\n state.lastStringValue = \"\";\n state.lastAssertionIsQuantifiable = false;\n state.numCapturingParens = 0;\n state.maxBackReference = 0;\n state.groupNames.length = 0;\n state.backReferenceNames.length = 0;\n\n this.regexp_disjunction(state);\n\n if (state.pos !== state.source.length) {\n // Make the same messages as V8.\n if (state.eat(0x29 /* ) */)) {\n state.raise(\"Unmatched ')'\");\n }\n if (state.eat(0x5D /* [ */) || state.eat(0x7D /* } */)) {\n state.raise(\"Lone quantifier brackets\");\n }\n }\n if (state.maxBackReference > state.numCapturingParens) {\n state.raise(\"Invalid escape\");\n }\n for (var i = 0, list = state.backReferenceNames; i < list.length; i += 1) {\n var name = list[i];\n\n if (state.groupNames.indexOf(name) === -1) {\n state.raise(\"Invalid named capture referenced\");\n }\n }\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-Disjunction\npp$8.regexp_disjunction = function(state) {\n this.regexp_alternative(state);\n while (state.eat(0x7C /* | */)) {\n this.regexp_alternative(state);\n }\n\n // Make the same message as V8.\n if (this.regexp_eatQuantifier(state, true)) {\n state.raise(\"Nothing to repeat\");\n }\n if (state.eat(0x7B /* { */)) {\n state.raise(\"Lone quantifier brackets\");\n }\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-Alternative\npp$8.regexp_alternative = function(state) {\n while (state.pos < state.source.length && this.regexp_eatTerm(state))\n { }\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Term\npp$8.regexp_eatTerm = function(state) {\n if (this.regexp_eatAssertion(state)) {\n // Handle `QuantifiableAssertion Quantifier` alternative.\n // `state.lastAssertionIsQuantifiable` is true if the last eaten Assertion\n // is a QuantifiableAssertion.\n if (state.lastAssertionIsQuantifiable && this.regexp_eatQuantifier(state)) {\n // Make the same message as V8.\n if (state.switchU) {\n state.raise(\"Invalid quantifier\");\n }\n }\n return true\n }\n\n if (state.switchU ? this.regexp_eatAtom(state) : this.regexp_eatExtendedAtom(state)) {\n this.regexp_eatQuantifier(state);\n return true\n }\n\n return false\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Assertion\npp$8.regexp_eatAssertion = function(state) {\n var start = state.pos;\n state.lastAssertionIsQuantifiable = false;\n\n // ^, $\n if (state.eat(0x5E /* ^ */) || state.eat(0x24 /* $ */)) {\n return true\n }\n\n // \\b \\B\n if (state.eat(0x5C /* \\ */)) {\n if (state.eat(0x42 /* B */) || state.eat(0x62 /* b */)) {\n return true\n }\n state.pos = start;\n }\n\n // Lookahead / Lookbehind\n if (state.eat(0x28 /* ( */) && state.eat(0x3F /* ? */)) {\n var lookbehind = false;\n if (this.options.ecmaVersion >= 9) {\n lookbehind = state.eat(0x3C /* < */);\n }\n if (state.eat(0x3D /* = */) || state.eat(0x21 /* ! */)) {\n this.regexp_disjunction(state);\n if (!state.eat(0x29 /* ) */)) {\n state.raise(\"Unterminated group\");\n }\n state.lastAssertionIsQuantifiable = !lookbehind;\n return true\n }\n }\n\n state.pos = start;\n return false\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-Quantifier\npp$8.regexp_eatQuantifier = function(state, noError) {\n if ( noError === void 0 ) noError = false;\n\n if (this.regexp_eatQuantifierPrefix(state, noError)) {\n state.eat(0x3F /* ? */);\n return true\n }\n return false\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-QuantifierPrefix\npp$8.regexp_eatQuantifierPrefix = function(state, noError) {\n return (\n state.eat(0x2A /* * */) ||\n state.eat(0x2B /* + */) ||\n state.eat(0x3F /* ? */) ||\n this.regexp_eatBracedQuantifier(state, noError)\n )\n};\npp$8.regexp_eatBracedQuantifier = function(state, noError) {\n var start = state.pos;\n if (state.eat(0x7B /* { */)) {\n var min = 0, max = -1;\n if (this.regexp_eatDecimalDigits(state)) {\n min = state.lastIntValue;\n if (state.eat(0x2C /* , */) && this.regexp_eatDecimalDigits(state)) {\n max = state.lastIntValue;\n }\n if (state.eat(0x7D /* } */)) {\n // SyntaxError in https://www.ecma-international.org/ecma-262/8.0/#sec-term\n if (max !== -1 && max < min && !noError) {\n state.raise(\"numbers out of order in {} quantifier\");\n }\n return true\n }\n }\n if (state.switchU && !noError) {\n state.raise(\"Incomplete quantifier\");\n }\n state.pos = start;\n }\n return false\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-Atom\npp$8.regexp_eatAtom = function(state) {\n return (\n this.regexp_eatPatternCharacters(state) ||\n state.eat(0x2E /* . */) ||\n this.regexp_eatReverseSolidusAtomEscape(state) ||\n this.regexp_eatCharacterClass(state) ||\n this.regexp_eatUncapturingGroup(state) ||\n this.regexp_eatCapturingGroup(state)\n )\n};\npp$8.regexp_eatReverseSolidusAtomEscape = function(state) {\n var start = state.pos;\n if (state.eat(0x5C /* \\ */)) {\n if (this.regexp_eatAtomEscape(state)) {\n return true\n }\n state.pos = start;\n }\n return false\n};\npp$8.regexp_eatUncapturingGroup = function(state) {\n var start = state.pos;\n if (state.eat(0x28 /* ( */)) {\n if (state.eat(0x3F /* ? */) && state.eat(0x3A /* : */)) {\n this.regexp_disjunction(state);\n if (state.eat(0x29 /* ) */)) {\n return true\n }\n state.raise(\"Unterminated group\");\n }\n state.pos = start;\n }\n return false\n};\npp$8.regexp_eatCapturingGroup = function(state) {\n if (state.eat(0x28 /* ( */)) {\n if (this.options.ecmaVersion >= 9) {\n this.regexp_groupSpecifier(state);\n } else if (state.current() === 0x3F /* ? */) {\n state.raise(\"Invalid group\");\n }\n this.regexp_disjunction(state);\n if (state.eat(0x29 /* ) */)) {\n state.numCapturingParens += 1;\n return true\n }\n state.raise(\"Unterminated group\");\n }\n return false\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedAtom\npp$8.regexp_eatExtendedAtom = function(state) {\n return (\n state.eat(0x2E /* . */) ||\n this.regexp_eatReverseSolidusAtomEscape(state) ||\n this.regexp_eatCharacterClass(state) ||\n this.regexp_eatUncapturingGroup(state) ||\n this.regexp_eatCapturingGroup(state) ||\n this.regexp_eatInvalidBracedQuantifier(state) ||\n this.regexp_eatExtendedPatternCharacter(state)\n )\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-InvalidBracedQuantifier\npp$8.regexp_eatInvalidBracedQuantifier = function(state) {\n if (this.regexp_eatBracedQuantifier(state, true)) {\n state.raise(\"Nothing to repeat\");\n }\n return false\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-SyntaxCharacter\npp$8.regexp_eatSyntaxCharacter = function(state) {\n var ch = state.current();\n if (isSyntaxCharacter(ch)) {\n state.lastIntValue = ch;\n state.advance();\n return true\n }\n return false\n};\nfunction isSyntaxCharacter(ch) {\n return (\n ch === 0x24 /* $ */ ||\n ch >= 0x28 /* ( */ && ch <= 0x2B /* + */ ||\n ch === 0x2E /* . */ ||\n ch === 0x3F /* ? */ ||\n ch >= 0x5B /* [ */ && ch <= 0x5E /* ^ */ ||\n ch >= 0x7B /* { */ && ch <= 0x7D /* } */\n )\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-PatternCharacter\n// But eat eager.\npp$8.regexp_eatPatternCharacters = function(state) {\n var start = state.pos;\n var ch = 0;\n while ((ch = state.current()) !== -1 && !isSyntaxCharacter(ch)) {\n state.advance();\n }\n return state.pos !== start\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedPatternCharacter\npp$8.regexp_eatExtendedPatternCharacter = function(state) {\n var ch = state.current();\n if (\n ch !== -1 &&\n ch !== 0x24 /* $ */ &&\n !(ch >= 0x28 /* ( */ && ch <= 0x2B /* + */) &&\n ch !== 0x2E /* . */ &&\n ch !== 0x3F /* ? */ &&\n ch !== 0x5B /* [ */ &&\n ch !== 0x5E /* ^ */ &&\n ch !== 0x7C /* | */\n ) {\n state.advance();\n return true\n }\n return false\n};\n\n// GroupSpecifier[U] ::\n// [empty]\n// `?` GroupName[?U]\npp$8.regexp_groupSpecifier = function(state) {\n if (state.eat(0x3F /* ? */)) {\n if (this.regexp_eatGroupName(state)) {\n if (state.groupNames.indexOf(state.lastStringValue) !== -1) {\n state.raise(\"Duplicate capture group name\");\n }\n state.groupNames.push(state.lastStringValue);\n return\n }\n state.raise(\"Invalid group\");\n }\n};\n\n// GroupName[U] ::\n// `<` RegExpIdentifierName[?U] `>`\n// Note: this updates `state.lastStringValue` property with the eaten name.\npp$8.regexp_eatGroupName = function(state) {\n state.lastStringValue = \"\";\n if (state.eat(0x3C /* < */)) {\n if (this.regexp_eatRegExpIdentifierName(state) && state.eat(0x3E /* > */)) {\n return true\n }\n state.raise(\"Invalid capture group name\");\n }\n return false\n};\n\n// RegExpIdentifierName[U] ::\n// RegExpIdentifierStart[?U]\n// RegExpIdentifierName[?U] RegExpIdentifierPart[?U]\n// Note: this updates `state.lastStringValue` property with the eaten name.\npp$8.regexp_eatRegExpIdentifierName = function(state) {\n state.lastStringValue = \"\";\n if (this.regexp_eatRegExpIdentifierStart(state)) {\n state.lastStringValue += codePointToString(state.lastIntValue);\n while (this.regexp_eatRegExpIdentifierPart(state)) {\n state.lastStringValue += codePointToString(state.lastIntValue);\n }\n return true\n }\n return false\n};\n\n// RegExpIdentifierStart[U] ::\n// UnicodeIDStart\n// `$`\n// `_`\n// `\\` RegExpUnicodeEscapeSequence[?U]\npp$8.regexp_eatRegExpIdentifierStart = function(state) {\n var start = state.pos;\n var ch = state.current();\n state.advance();\n\n if (ch === 0x5C /* \\ */ && this.regexp_eatRegExpUnicodeEscapeSequence(state)) {\n ch = state.lastIntValue;\n }\n if (isRegExpIdentifierStart(ch)) {\n state.lastIntValue = ch;\n return true\n }\n\n state.pos = start;\n return false\n};\nfunction isRegExpIdentifierStart(ch) {\n return isIdentifierStart(ch, true) || ch === 0x24 /* $ */ || ch === 0x5F /* _ */\n}\n\n// RegExpIdentifierPart[U] ::\n// UnicodeIDContinue\n// `$`\n// `_`\n// `\\` RegExpUnicodeEscapeSequence[?U]\n// \n// \npp$8.regexp_eatRegExpIdentifierPart = function(state) {\n var start = state.pos;\n var ch = state.current();\n state.advance();\n\n if (ch === 0x5C /* \\ */ && this.regexp_eatRegExpUnicodeEscapeSequence(state)) {\n ch = state.lastIntValue;\n }\n if (isRegExpIdentifierPart(ch)) {\n state.lastIntValue = ch;\n return true\n }\n\n state.pos = start;\n return false\n};\nfunction isRegExpIdentifierPart(ch) {\n return isIdentifierChar(ch, true) || ch === 0x24 /* $ */ || ch === 0x5F /* _ */ || ch === 0x200C /* */ || ch === 0x200D /* */\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-AtomEscape\npp$8.regexp_eatAtomEscape = function(state) {\n if (\n this.regexp_eatBackReference(state) ||\n this.regexp_eatCharacterClassEscape(state) ||\n this.regexp_eatCharacterEscape(state) ||\n (state.switchN && this.regexp_eatKGroupName(state))\n ) {\n return true\n }\n if (state.switchU) {\n // Make the same message as V8.\n if (state.current() === 0x63 /* c */) {\n state.raise(\"Invalid unicode escape\");\n }\n state.raise(\"Invalid escape\");\n }\n return false\n};\npp$8.regexp_eatBackReference = function(state) {\n var start = state.pos;\n if (this.regexp_eatDecimalEscape(state)) {\n var n = state.lastIntValue;\n if (state.switchU) {\n // For SyntaxError in https://www.ecma-international.org/ecma-262/8.0/#sec-atomescape\n if (n > state.maxBackReference) {\n state.maxBackReference = n;\n }\n return true\n }\n if (n <= state.numCapturingParens) {\n return true\n }\n state.pos = start;\n }\n return false\n};\npp$8.regexp_eatKGroupName = function(state) {\n if (state.eat(0x6B /* k */)) {\n if (this.regexp_eatGroupName(state)) {\n state.backReferenceNames.push(state.lastStringValue);\n return true\n }\n state.raise(\"Invalid named reference\");\n }\n return false\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-CharacterEscape\npp$8.regexp_eatCharacterEscape = function(state) {\n return (\n this.regexp_eatControlEscape(state) ||\n this.regexp_eatCControlLetter(state) ||\n this.regexp_eatZero(state) ||\n this.regexp_eatHexEscapeSequence(state) ||\n this.regexp_eatRegExpUnicodeEscapeSequence(state) ||\n (!state.switchU && this.regexp_eatLegacyOctalEscapeSequence(state)) ||\n this.regexp_eatIdentityEscape(state)\n )\n};\npp$8.regexp_eatCControlLetter = function(state) {\n var start = state.pos;\n if (state.eat(0x63 /* c */)) {\n if (this.regexp_eatControlLetter(state)) {\n return true\n }\n state.pos = start;\n }\n return false\n};\npp$8.regexp_eatZero = function(state) {\n if (state.current() === 0x30 /* 0 */ && !isDecimalDigit(state.lookahead())) {\n state.lastIntValue = 0;\n state.advance();\n return true\n }\n return false\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-ControlEscape\npp$8.regexp_eatControlEscape = function(state) {\n var ch = state.current();\n if (ch === 0x74 /* t */) {\n state.lastIntValue = 0x09; /* \\t */\n state.advance();\n return true\n }\n if (ch === 0x6E /* n */) {\n state.lastIntValue = 0x0A; /* \\n */\n state.advance();\n return true\n }\n if (ch === 0x76 /* v */) {\n state.lastIntValue = 0x0B; /* \\v */\n state.advance();\n return true\n }\n if (ch === 0x66 /* f */) {\n state.lastIntValue = 0x0C; /* \\f */\n state.advance();\n return true\n }\n if (ch === 0x72 /* r */) {\n state.lastIntValue = 0x0D; /* \\r */\n state.advance();\n return true\n }\n return false\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-ControlLetter\npp$8.regexp_eatControlLetter = function(state) {\n var ch = state.current();\n if (isControlLetter(ch)) {\n state.lastIntValue = ch % 0x20;\n state.advance();\n return true\n }\n return false\n};\nfunction isControlLetter(ch) {\n return (\n (ch >= 0x41 /* A */ && ch <= 0x5A /* Z */) ||\n (ch >= 0x61 /* a */ && ch <= 0x7A /* z */)\n )\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-RegExpUnicodeEscapeSequence\npp$8.regexp_eatRegExpUnicodeEscapeSequence = function(state) {\n var start = state.pos;\n\n if (state.eat(0x75 /* u */)) {\n if (this.regexp_eatFixedHexDigits(state, 4)) {\n var lead = state.lastIntValue;\n if (state.switchU && lead >= 0xD800 && lead <= 0xDBFF) {\n var leadSurrogateEnd = state.pos;\n if (state.eat(0x5C /* \\ */) && state.eat(0x75 /* u */) && this.regexp_eatFixedHexDigits(state, 4)) {\n var trail = state.lastIntValue;\n if (trail >= 0xDC00 && trail <= 0xDFFF) {\n state.lastIntValue = (lead - 0xD800) * 0x400 + (trail - 0xDC00) + 0x10000;\n return true\n }\n }\n state.pos = leadSurrogateEnd;\n state.lastIntValue = lead;\n }\n return true\n }\n if (\n state.switchU &&\n state.eat(0x7B /* { */) &&\n this.regexp_eatHexDigits(state) &&\n state.eat(0x7D /* } */) &&\n isValidUnicode(state.lastIntValue)\n ) {\n return true\n }\n if (state.switchU) {\n state.raise(\"Invalid unicode escape\");\n }\n state.pos = start;\n }\n\n return false\n};\nfunction isValidUnicode(ch) {\n return ch >= 0 && ch <= 0x10FFFF\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-IdentityEscape\npp$8.regexp_eatIdentityEscape = function(state) {\n if (state.switchU) {\n if (this.regexp_eatSyntaxCharacter(state)) {\n return true\n }\n if (state.eat(0x2F /* / */)) {\n state.lastIntValue = 0x2F; /* / */\n return true\n }\n return false\n }\n\n var ch = state.current();\n if (ch !== 0x63 /* c */ && (!state.switchN || ch !== 0x6B /* k */)) {\n state.lastIntValue = ch;\n state.advance();\n return true\n }\n\n return false\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalEscape\npp$8.regexp_eatDecimalEscape = function(state) {\n state.lastIntValue = 0;\n var ch = state.current();\n if (ch >= 0x31 /* 1 */ && ch <= 0x39 /* 9 */) {\n do {\n state.lastIntValue = 10 * state.lastIntValue + (ch - 0x30 /* 0 */);\n state.advance();\n } while ((ch = state.current()) >= 0x30 /* 0 */ && ch <= 0x39 /* 9 */)\n return true\n }\n return false\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClassEscape\npp$8.regexp_eatCharacterClassEscape = function(state) {\n var ch = state.current();\n\n if (isCharacterClassEscape(ch)) {\n state.lastIntValue = -1;\n state.advance();\n return true\n }\n\n if (\n state.switchU &&\n this.options.ecmaVersion >= 9 &&\n (ch === 0x50 /* P */ || ch === 0x70 /* p */)\n ) {\n state.lastIntValue = -1;\n state.advance();\n if (\n state.eat(0x7B /* { */) &&\n this.regexp_eatUnicodePropertyValueExpression(state) &&\n state.eat(0x7D /* } */)\n ) {\n return true\n }\n state.raise(\"Invalid property name\");\n }\n\n return false\n};\nfunction isCharacterClassEscape(ch) {\n return (\n ch === 0x64 /* d */ ||\n ch === 0x44 /* D */ ||\n ch === 0x73 /* s */ ||\n ch === 0x53 /* S */ ||\n ch === 0x77 /* w */ ||\n ch === 0x57 /* W */\n )\n}\n\n// UnicodePropertyValueExpression ::\n// UnicodePropertyName `=` UnicodePropertyValue\n// LoneUnicodePropertyNameOrValue\npp$8.regexp_eatUnicodePropertyValueExpression = function(state) {\n var start = state.pos;\n\n // UnicodePropertyName `=` UnicodePropertyValue\n if (this.regexp_eatUnicodePropertyName(state) && state.eat(0x3D /* = */)) {\n var name = state.lastStringValue;\n if (this.regexp_eatUnicodePropertyValue(state)) {\n var value = state.lastStringValue;\n this.regexp_validateUnicodePropertyNameAndValue(state, name, value);\n return true\n }\n }\n state.pos = start;\n\n // LoneUnicodePropertyNameOrValue\n if (this.regexp_eatLoneUnicodePropertyNameOrValue(state)) {\n var nameOrValue = state.lastStringValue;\n this.regexp_validateUnicodePropertyNameOrValue(state, nameOrValue);\n return true\n }\n return false\n};\npp$8.regexp_validateUnicodePropertyNameAndValue = function(state, name, value) {\n if (!has(state.unicodeProperties.nonBinary, name))\n { state.raise(\"Invalid property name\"); }\n if (!state.unicodeProperties.nonBinary[name].test(value))\n { state.raise(\"Invalid property value\"); }\n};\npp$8.regexp_validateUnicodePropertyNameOrValue = function(state, nameOrValue) {\n if (!state.unicodeProperties.binary.test(nameOrValue))\n { state.raise(\"Invalid property name\"); }\n};\n\n// UnicodePropertyName ::\n// UnicodePropertyNameCharacters\npp$8.regexp_eatUnicodePropertyName = function(state) {\n var ch = 0;\n state.lastStringValue = \"\";\n while (isUnicodePropertyNameCharacter(ch = state.current())) {\n state.lastStringValue += codePointToString(ch);\n state.advance();\n }\n return state.lastStringValue !== \"\"\n};\nfunction isUnicodePropertyNameCharacter(ch) {\n return isControlLetter(ch) || ch === 0x5F /* _ */\n}\n\n// UnicodePropertyValue ::\n// UnicodePropertyValueCharacters\npp$8.regexp_eatUnicodePropertyValue = function(state) {\n var ch = 0;\n state.lastStringValue = \"\";\n while (isUnicodePropertyValueCharacter(ch = state.current())) {\n state.lastStringValue += codePointToString(ch);\n state.advance();\n }\n return state.lastStringValue !== \"\"\n};\nfunction isUnicodePropertyValueCharacter(ch) {\n return isUnicodePropertyNameCharacter(ch) || isDecimalDigit(ch)\n}\n\n// LoneUnicodePropertyNameOrValue ::\n// UnicodePropertyValueCharacters\npp$8.regexp_eatLoneUnicodePropertyNameOrValue = function(state) {\n return this.regexp_eatUnicodePropertyValue(state)\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClass\npp$8.regexp_eatCharacterClass = function(state) {\n if (state.eat(0x5B /* [ */)) {\n state.eat(0x5E /* ^ */);\n this.regexp_classRanges(state);\n if (state.eat(0x5D /* [ */)) {\n return true\n }\n // Unreachable since it threw \"unterminated regular expression\" error before.\n state.raise(\"Unterminated character class\");\n }\n return false\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassRanges\n// https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRanges\n// https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRangesNoDash\npp$8.regexp_classRanges = function(state) {\n while (this.regexp_eatClassAtom(state)) {\n var left = state.lastIntValue;\n if (state.eat(0x2D /* - */) && this.regexp_eatClassAtom(state)) {\n var right = state.lastIntValue;\n if (state.switchU && (left === -1 || right === -1)) {\n state.raise(\"Invalid character class\");\n }\n if (left !== -1 && right !== -1 && left > right) {\n state.raise(\"Range out of order in character class\");\n }\n }\n }\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtom\n// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtomNoDash\npp$8.regexp_eatClassAtom = function(state) {\n var start = state.pos;\n\n if (state.eat(0x5C /* \\ */)) {\n if (this.regexp_eatClassEscape(state)) {\n return true\n }\n if (state.switchU) {\n // Make the same message as V8.\n var ch$1 = state.current();\n if (ch$1 === 0x63 /* c */ || isOctalDigit(ch$1)) {\n state.raise(\"Invalid class escape\");\n }\n state.raise(\"Invalid escape\");\n }\n state.pos = start;\n }\n\n var ch = state.current();\n if (ch !== 0x5D /* [ */) {\n state.lastIntValue = ch;\n state.advance();\n return true\n }\n\n return false\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassEscape\npp$8.regexp_eatClassEscape = function(state) {\n var start = state.pos;\n\n if (state.eat(0x62 /* b */)) {\n state.lastIntValue = 0x08; /* */\n return true\n }\n\n if (state.switchU && state.eat(0x2D /* - */)) {\n state.lastIntValue = 0x2D; /* - */\n return true\n }\n\n if (!state.switchU && state.eat(0x63 /* c */)) {\n if (this.regexp_eatClassControlLetter(state)) {\n return true\n }\n state.pos = start;\n }\n\n return (\n this.regexp_eatCharacterClassEscape(state) ||\n this.regexp_eatCharacterEscape(state)\n )\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassControlLetter\npp$8.regexp_eatClassControlLetter = function(state) {\n var ch = state.current();\n if (isDecimalDigit(ch) || ch === 0x5F /* _ */) {\n state.lastIntValue = ch % 0x20;\n state.advance();\n return true\n }\n return false\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence\npp$8.regexp_eatHexEscapeSequence = function(state) {\n var start = state.pos;\n if (state.eat(0x78 /* x */)) {\n if (this.regexp_eatFixedHexDigits(state, 2)) {\n return true\n }\n if (state.switchU) {\n state.raise(\"Invalid escape\");\n }\n state.pos = start;\n }\n return false\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalDigits\npp$8.regexp_eatDecimalDigits = function(state) {\n var start = state.pos;\n var ch = 0;\n state.lastIntValue = 0;\n while (isDecimalDigit(ch = state.current())) {\n state.lastIntValue = 10 * state.lastIntValue + (ch - 0x30 /* 0 */);\n state.advance();\n }\n return state.pos !== start\n};\nfunction isDecimalDigit(ch) {\n return ch >= 0x30 /* 0 */ && ch <= 0x39 /* 9 */\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigits\npp$8.regexp_eatHexDigits = function(state) {\n var start = state.pos;\n var ch = 0;\n state.lastIntValue = 0;\n while (isHexDigit(ch = state.current())) {\n state.lastIntValue = 16 * state.lastIntValue + hexToInt(ch);\n state.advance();\n }\n return state.pos !== start\n};\nfunction isHexDigit(ch) {\n return (\n (ch >= 0x30 /* 0 */ && ch <= 0x39 /* 9 */) ||\n (ch >= 0x41 /* A */ && ch <= 0x46 /* F */) ||\n (ch >= 0x61 /* a */ && ch <= 0x66 /* f */)\n )\n}\nfunction hexToInt(ch) {\n if (ch >= 0x41 /* A */ && ch <= 0x46 /* F */) {\n return 10 + (ch - 0x41 /* A */)\n }\n if (ch >= 0x61 /* a */ && ch <= 0x66 /* f */) {\n return 10 + (ch - 0x61 /* a */)\n }\n return ch - 0x30 /* 0 */\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-LegacyOctalEscapeSequence\n// Allows only 0-377(octal) i.e. 0-255(decimal).\npp$8.regexp_eatLegacyOctalEscapeSequence = function(state) {\n if (this.regexp_eatOctalDigit(state)) {\n var n1 = state.lastIntValue;\n if (this.regexp_eatOctalDigit(state)) {\n var n2 = state.lastIntValue;\n if (n1 <= 3 && this.regexp_eatOctalDigit(state)) {\n state.lastIntValue = n1 * 64 + n2 * 8 + state.lastIntValue;\n } else {\n state.lastIntValue = n1 * 8 + n2;\n }\n } else {\n state.lastIntValue = n1;\n }\n return true\n }\n return false\n};\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-OctalDigit\npp$8.regexp_eatOctalDigit = function(state) {\n var ch = state.current();\n if (isOctalDigit(ch)) {\n state.lastIntValue = ch - 0x30; /* 0 */\n state.advance();\n return true\n }\n state.lastIntValue = 0;\n return false\n};\nfunction isOctalDigit(ch) {\n return ch >= 0x30 /* 0 */ && ch <= 0x37 /* 7 */\n}\n\n// https://www.ecma-international.org/ecma-262/8.0/#prod-Hex4Digits\n// https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigit\n// And HexDigit HexDigit in https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence\npp$8.regexp_eatFixedHexDigits = function(state, length) {\n var start = state.pos;\n state.lastIntValue = 0;\n for (var i = 0; i < length; ++i) {\n var ch = state.current();\n if (!isHexDigit(ch)) {\n state.pos = start;\n return false\n }\n state.lastIntValue = 16 * state.lastIntValue + hexToInt(ch);\n state.advance();\n }\n return true\n};\n\n// Object type used to represent tokens. Note that normally, tokens\n// simply exist as properties on the parser object. This is only\n// used for the onToken callback and the external tokenizer.\n\nvar Token = function Token(p) {\n this.type = p.type;\n this.value = p.value;\n this.start = p.start;\n this.end = p.end;\n if (p.options.locations)\n { this.loc = new SourceLocation(p, p.startLoc, p.endLoc); }\n if (p.options.ranges)\n { this.range = [p.start, p.end]; }\n};\n\n// ## Tokenizer\n\nvar pp$9 = Parser.prototype;\n\n// Move to the next token\n\npp$9.next = function() {\n if (this.options.onToken)\n { this.options.onToken(new Token(this)); }\n\n this.lastTokEnd = this.end;\n this.lastTokStart = this.start;\n this.lastTokEndLoc = this.endLoc;\n this.lastTokStartLoc = this.startLoc;\n this.nextToken();\n};\n\npp$9.getToken = function() {\n this.next();\n return new Token(this)\n};\n\n// If we're in an ES6 environment, make parsers iterable\nif (typeof Symbol !== \"undefined\")\n { pp$9[Symbol.iterator] = function() {\n var this$1 = this;\n\n return {\n next: function () {\n var token = this$1.getToken();\n return {\n done: token.type === types.eof,\n value: token\n }\n }\n }\n }; }\n\n// Toggle strict mode. Re-reads the next number or string to please\n// pedantic tests (`\"use strict\"; 010;` should fail).\n\npp$9.curContext = function() {\n return this.context[this.context.length - 1]\n};\n\n// Read a single token, updating the parser object's token-related\n// properties.\n\npp$9.nextToken = function() {\n var curContext = this.curContext();\n if (!curContext || !curContext.preserveSpace) { this.skipSpace(); }\n\n this.start = this.pos;\n if (this.options.locations) { this.startLoc = this.curPosition(); }\n if (this.pos >= this.input.length) { return this.finishToken(types.eof) }\n\n if (curContext.override) { return curContext.override(this) }\n else { this.readToken(this.fullCharCodeAtPos()); }\n};\n\npp$9.readToken = function(code) {\n // Identifier or keyword. '\\uXXXX' sequences are allowed in\n // identifiers, so '\\' also dispatches to that.\n if (isIdentifierStart(code, this.options.ecmaVersion >= 6) || code === 92 /* '\\' */)\n { return this.readWord() }\n\n return this.getTokenFromCode(code)\n};\n\npp$9.fullCharCodeAtPos = function() {\n var code = this.input.charCodeAt(this.pos);\n if (code <= 0xd7ff || code >= 0xe000) { return code }\n var next = this.input.charCodeAt(this.pos + 1);\n return (code << 10) + next - 0x35fdc00\n};\n\npp$9.skipBlockComment = function() {\n var startLoc = this.options.onComment && this.curPosition();\n var start = this.pos, end = this.input.indexOf(\"*/\", this.pos += 2);\n if (end === -1) { this.raise(this.pos - 2, \"Unterminated comment\"); }\n this.pos = end + 2;\n if (this.options.locations) {\n lineBreakG.lastIndex = start;\n var match;\n while ((match = lineBreakG.exec(this.input)) && match.index < this.pos) {\n ++this.curLine;\n this.lineStart = match.index + match[0].length;\n }\n }\n if (this.options.onComment)\n { this.options.onComment(true, this.input.slice(start + 2, end), start, this.pos,\n startLoc, this.curPosition()); }\n};\n\npp$9.skipLineComment = function(startSkip) {\n var start = this.pos;\n var startLoc = this.options.onComment && this.curPosition();\n var ch = this.input.charCodeAt(this.pos += startSkip);\n while (this.pos < this.input.length && !isNewLine(ch)) {\n ch = this.input.charCodeAt(++this.pos);\n }\n if (this.options.onComment)\n { this.options.onComment(false, this.input.slice(start + startSkip, this.pos), start, this.pos,\n startLoc, this.curPosition()); }\n};\n\n// Called at the start of the parse and after every token. Skips\n// whitespace and comments, and.\n\npp$9.skipSpace = function() {\n loop: while (this.pos < this.input.length) {\n var ch = this.input.charCodeAt(this.pos);\n switch (ch) {\n case 32: case 160: // ' '\n ++this.pos;\n break\n case 13:\n if (this.input.charCodeAt(this.pos + 1) === 10) {\n ++this.pos;\n }\n case 10: case 8232: case 8233:\n ++this.pos;\n if (this.options.locations) {\n ++this.curLine;\n this.lineStart = this.pos;\n }\n break\n case 47: // '/'\n switch (this.input.charCodeAt(this.pos + 1)) {\n case 42: // '*'\n this.skipBlockComment();\n break\n case 47:\n this.skipLineComment(2);\n break\n default:\n break loop\n }\n break\n default:\n if (ch > 8 && ch < 14 || ch >= 5760 && nonASCIIwhitespace.test(String.fromCharCode(ch))) {\n ++this.pos;\n } else {\n break loop\n }\n }\n }\n};\n\n// Called at the end of every token. Sets `end`, `val`, and\n// maintains `context` and `exprAllowed`, and skips the space after\n// the token, so that the next one's `start` will point at the\n// right position.\n\npp$9.finishToken = function(type, val) {\n this.end = this.pos;\n if (this.options.locations) { this.endLoc = this.curPosition(); }\n var prevType = this.type;\n this.type = type;\n this.value = val;\n\n this.updateContext(prevType);\n};\n\n// ### Token reading\n\n// This is the function that is called to fetch the next token. It\n// is somewhat obscure, because it works in character codes rather\n// than characters, and because operator parsing has been inlined\n// into it.\n//\n// All in the name of speed.\n//\npp$9.readToken_dot = function() {\n var next = this.input.charCodeAt(this.pos + 1);\n if (next >= 48 && next <= 57) { return this.readNumber(true) }\n var next2 = this.input.charCodeAt(this.pos + 2);\n if (this.options.ecmaVersion >= 6 && next === 46 && next2 === 46) { // 46 = dot '.'\n this.pos += 3;\n return this.finishToken(types.ellipsis)\n } else {\n ++this.pos;\n return this.finishToken(types.dot)\n }\n};\n\npp$9.readToken_slash = function() { // '/'\n var next = this.input.charCodeAt(this.pos + 1);\n if (this.exprAllowed) { ++this.pos; return this.readRegexp() }\n if (next === 61) { return this.finishOp(types.assign, 2) }\n return this.finishOp(types.slash, 1)\n};\n\npp$9.readToken_mult_modulo_exp = function(code) { // '%*'\n var next = this.input.charCodeAt(this.pos + 1);\n var size = 1;\n var tokentype = code === 42 ? types.star : types.modulo;\n\n // exponentiation operator ** and **=\n if (this.options.ecmaVersion >= 7 && code === 42 && next === 42) {\n ++size;\n tokentype = types.starstar;\n next = this.input.charCodeAt(this.pos + 2);\n }\n\n if (next === 61) { return this.finishOp(types.assign, size + 1) }\n return this.finishOp(tokentype, size)\n};\n\npp$9.readToken_pipe_amp = function(code) { // '|&'\n var next = this.input.charCodeAt(this.pos + 1);\n if (next === code) { return this.finishOp(code === 124 ? types.logicalOR : types.logicalAND, 2) }\n if (next === 61) { return this.finishOp(types.assign, 2) }\n return this.finishOp(code === 124 ? types.bitwiseOR : types.bitwiseAND, 1)\n};\n\npp$9.readToken_caret = function() { // '^'\n var next = this.input.charCodeAt(this.pos + 1);\n if (next === 61) { return this.finishOp(types.assign, 2) }\n return this.finishOp(types.bitwiseXOR, 1)\n};\n\npp$9.readToken_plus_min = function(code) { // '+-'\n var next = this.input.charCodeAt(this.pos + 1);\n if (next === code) {\n if (next === 45 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 62 &&\n (this.lastTokEnd === 0 || lineBreak.test(this.input.slice(this.lastTokEnd, this.pos)))) {\n // A `-->` line comment\n this.skipLineComment(3);\n this.skipSpace();\n return this.nextToken()\n }\n return this.finishOp(types.incDec, 2)\n }\n if (next === 61) { return this.finishOp(types.assign, 2) }\n return this.finishOp(types.plusMin, 1)\n};\n\npp$9.readToken_lt_gt = function(code) { // '<>'\n var next = this.input.charCodeAt(this.pos + 1);\n var size = 1;\n if (next === code) {\n size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2;\n if (this.input.charCodeAt(this.pos + size) === 61) { return this.finishOp(types.assign, size + 1) }\n return this.finishOp(types.bitShift, size)\n }\n if (next === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 &&\n this.input.charCodeAt(this.pos + 3) === 45) {\n // `` line comment\n this.skipLineComment(3);\n this.skipSpace();\n return this.nextToken()\n }\n return this.finishOp(types.incDec, 2)\n }\n if (next === 61) { return this.finishOp(types.assign, 2) }\n return this.finishOp(types.plusMin, 1)\n};\n\npp$9.readToken_lt_gt = function(code) { // '<>'\n var next = this.input.charCodeAt(this.pos + 1);\n var size = 1;\n if (next === code) {\n size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2;\n if (this.input.charCodeAt(this.pos + size) === 61) { return this.finishOp(types.assign, size + 1) }\n return this.finishOp(types.bitShift, size)\n }\n if (next === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 &&\n this.input.charCodeAt(this.pos + 3) === 45) {\n // `` line comment\n this.skipLineComment(3);\n this.skipSpace();\n return this.nextToken()\n }\n return this.finishOp(types.incDec, 2)\n }\n if (next === 61) { return this.finishOp(types.assign, 2) }\n return this.finishOp(types.plusMin, 1)\n};\n\npp$9.readToken_lt_gt = function(code) { // '<>'\n var next = this.input.charCodeAt(this.pos + 1);\n var size = 1;\n if (next === code) {\n size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2;\n if (this.input.charCodeAt(this.pos + size) === 61) { return this.finishOp(types.assign, size + 1) }\n return this.finishOp(types.bitShift, size)\n }\n if (next === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 &&\n this.input.charCodeAt(this.pos + 3) === 45) {\n // `` line comment\n this.skipLineComment(3);\n this.skipSpace();\n return this.nextToken()\n }\n return this.finishOp(types.incDec, 2)\n }\n if (next === 61) { return this.finishOp(types.assign, 2) }\n return this.finishOp(types.plusMin, 1)\n};\n\npp$9.readToken_lt_gt = function(code) { // '<>'\n var next = this.input.charCodeAt(this.pos + 1);\n var size = 1;\n if (next === code) {\n size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2;\n if (this.input.charCodeAt(this.pos + size) === 61) { return this.finishOp(types.assign, size + 1) }\n return this.finishOp(types.bitShift, size)\n }\n if (next === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 &&\n this.input.charCodeAt(this.pos + 3) === 45) {\n // `