driftjs-compiler 0.0.5 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/dist/index-cjs.js +11 -10
- package/dist/index-es.js +747 -606
- package/package.json +14 -1
package/dist/index-es.js
CHANGED
|
@@ -59,7 +59,7 @@ var e = {
|
|
|
59
59
|
super(`ParserError [${t}:${n}]: ${e}`), this.line = t, this.column = n, this.offset = r, this.name = "DriftParserError";
|
|
60
60
|
}
|
|
61
61
|
}, a = /* @__PURE__ */ function(e) {
|
|
62
|
-
return e[e.RETURN = 0] = "RETURN", e[e.CREATE_ELEMENT = 1] = "CREATE_ELEMENT", e[e.CREATE_TEXT = 2] = "CREATE_TEXT", e[e.CREATE_COMMENT = 3] = "CREATE_COMMENT", e[e.APPEND_CHILD = 4] = "APPEND_CHILD", e[e.SET_ATTR = 5] = "SET_ATTR", e[e.CREATE_FRAGMENT = 6] = "CREATE_FRAGMENT", e[e.INTERPOLATE_TEXT = 7] = "INTERPOLATE_TEXT", e[e.
|
|
62
|
+
return e[e.RETURN = 0] = "RETURN", e[e.CREATE_ELEMENT = 1] = "CREATE_ELEMENT", e[e.CREATE_TEXT = 2] = "CREATE_TEXT", e[e.CREATE_COMMENT = 3] = "CREATE_COMMENT", e[e.APPEND_CHILD = 4] = "APPEND_CHILD", e[e.SET_ATTR = 5] = "SET_ATTR", e[e.CREATE_FRAGMENT = 6] = "CREATE_FRAGMENT", e[e.INTERPOLATE_TEXT = 7] = "INTERPOLATE_TEXT", e[e.EXEC_SCRIPT = 12] = "EXEC_SCRIPT", e[e.REACTIVE_IF = 13] = "REACTIVE_IF", e[e.REACTIVE_FOR = 14] = "REACTIVE_FOR", e;
|
|
63
63
|
}({}), o = {
|
|
64
64
|
[t.Data]: [
|
|
65
65
|
{
|
|
@@ -339,11 +339,18 @@ var c = /* @__PURE__ */ new Set([
|
|
|
339
339
|
if (this.peek() !== ">") throw new r(`Unexpected character '${this.peek()}' inside closing tag </${n.tagName}>`, i.line, i.column, i.offset);
|
|
340
340
|
return this.advance(), this.transitionTo({ kind: t.Data }), this.createToken(e.TagClose, ">", i);
|
|
341
341
|
}
|
|
342
|
+
if (this.peek() === "/") {
|
|
343
|
+
let n = 1;
|
|
344
|
+
for (; this.peek(n) === " " || this.peek(n) === " " || this.peek(n) === "\n" || this.peek(n) === "\r";) n++;
|
|
345
|
+
if (this.peek(n) === ">") {
|
|
346
|
+
for (let e = 0; e <= n; e++) this.advance();
|
|
347
|
+
return this.transitionTo({ kind: t.Data }), this.createToken(e.TagSelfClose, "/>", i);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
342
350
|
if (this.peek() === ">") return this.advance(), n.entersRawText && s(n.tagName) ? this.transitionTo({
|
|
343
351
|
kind: t.RawText,
|
|
344
352
|
tagName: n.tagName
|
|
345
353
|
}) : this.transitionTo({ kind: t.Data }), this.createToken(e.TagClose, ">", i);
|
|
346
|
-
if (this.peek() === "/" && this.peek(1) === ">") return this.advance(), this.advance(), this.transitionTo({ kind: t.Data }), this.createToken(e.TagSelfClose, "/>", i);
|
|
347
354
|
if (!this.isIdentifierStart(this.peek())) throw new r(`Unexpected character '${this.peek()}' inside tag <${n.tagName}>`, i.line, i.column, i.offset);
|
|
348
355
|
return this.transitionTo({
|
|
349
356
|
kind: t.AttributeName,
|
|
@@ -583,12 +590,12 @@ var c = /* @__PURE__ */ new Set([
|
|
|
583
590
|
isIdentifierStart(e) {
|
|
584
591
|
if (e.length === 0) return !1;
|
|
585
592
|
let t = e.charCodeAt(0);
|
|
586
|
-
return t >= 65 && t <= 90 || t >= 97 && t <= 122;
|
|
593
|
+
return t >= 65 && t <= 90 || t >= 97 && t <= 122 || t === 95 || t === 36;
|
|
587
594
|
}
|
|
588
595
|
isIdentifierChar(e) {
|
|
589
596
|
if (e.length === 0) return !1;
|
|
590
597
|
let t = e.charCodeAt(0);
|
|
591
|
-
return t >= 65 && t <= 90 || t >= 97 && t <= 122 || t >= 48 && t <= 57 || t === 95 || t === 45;
|
|
598
|
+
return t >= 65 && t <= 90 || t >= 97 && t <= 122 || t >= 48 && t <= 57 || t === 95 || t === 36 || t === 45;
|
|
592
599
|
}
|
|
593
600
|
isRawTextClosingTagAhead(e) {
|
|
594
601
|
if (!this.startsWith(e)) return !1;
|
|
@@ -2051,23 +2058,23 @@ function A(e) {
|
|
|
2051
2058
|
function j(e) {
|
|
2052
2059
|
return e <= 65535 ? String.fromCharCode(e) : (e -= 65536, String.fromCharCode((e >> 10) + 55296, (e & 1023) + 56320));
|
|
2053
2060
|
}
|
|
2054
|
-
var he = /(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,
|
|
2061
|
+
var he = /(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/, ge = function(e, t) {
|
|
2055
2062
|
this.line = e, this.column = t;
|
|
2056
2063
|
};
|
|
2057
|
-
|
|
2058
|
-
return new
|
|
2064
|
+
ge.prototype.offset = function(e) {
|
|
2065
|
+
return new ge(this.line, this.column + e);
|
|
2059
2066
|
};
|
|
2060
|
-
var
|
|
2067
|
+
var _e = function(e, t, n) {
|
|
2061
2068
|
this.start = t, this.end = n, e.sourceFile !== null && (this.source = e.sourceFile);
|
|
2062
2069
|
};
|
|
2063
|
-
function
|
|
2070
|
+
function ve(e, t) {
|
|
2064
2071
|
for (var n = 1, r = 0;;) {
|
|
2065
2072
|
var i = ce(e, r, t);
|
|
2066
|
-
if (i < 0) return new
|
|
2073
|
+
if (i < 0) return new ge(n, t - r);
|
|
2067
2074
|
++n, r = i;
|
|
2068
2075
|
}
|
|
2069
2076
|
}
|
|
2070
|
-
var
|
|
2077
|
+
var ye = {
|
|
2071
2078
|
ecmaVersion: null,
|
|
2072
2079
|
sourceType: "script",
|
|
2073
2080
|
strict: !1,
|
|
@@ -2088,20 +2095,20 @@ var ve = {
|
|
|
2088
2095
|
sourceFile: null,
|
|
2089
2096
|
directSourceFile: null,
|
|
2090
2097
|
preserveParens: !1
|
|
2091
|
-
},
|
|
2092
|
-
function
|
|
2098
|
+
}, be = !1;
|
|
2099
|
+
function xe(e) {
|
|
2093
2100
|
var t = {};
|
|
2094
|
-
for (var n in
|
|
2095
|
-
if (t.ecmaVersion === "latest" ? t.ecmaVersion = 1e8 : t.ecmaVersion == null ? (!
|
|
2101
|
+
for (var n in ye) t[n] = e && k(e, n) ? e[n] : ye[n];
|
|
2102
|
+
if (t.ecmaVersion === "latest" ? t.ecmaVersion = 1e8 : t.ecmaVersion == null ? (!be && typeof console == "object" && console.warn && (be = !0, console.warn("Since Acorn 8.0.0, options.ecmaVersion is required.\nDefaulting to 2020, but this will stop working in the future.")), t.ecmaVersion = 11) : t.ecmaVersion >= 2015 && (t.ecmaVersion -= 2009), t.allowReserved ??= t.ecmaVersion < 5, (!e || e.allowHashBang == null) && (t.allowHashBang = t.ecmaVersion >= 14), pe(t.onToken)) {
|
|
2096
2103
|
var r = t.onToken;
|
|
2097
2104
|
t.onToken = function(e) {
|
|
2098
2105
|
return r.push(e);
|
|
2099
2106
|
};
|
|
2100
2107
|
}
|
|
2101
|
-
if (pe(t.onComment) && (t.onComment =
|
|
2108
|
+
if (pe(t.onComment) && (t.onComment = Se(t, t.onComment)), t.sourceType === "commonjs" && t.allowAwaitOutsideFunction) throw Error("Cannot use allowAwaitOutsideFunction with sourceType: commonjs");
|
|
2102
2109
|
return t;
|
|
2103
2110
|
}
|
|
2104
|
-
function
|
|
2111
|
+
function Se(e, t) {
|
|
2105
2112
|
return function(n, r, i, a, o, s) {
|
|
2106
2113
|
var c = {
|
|
2107
2114
|
type: n ? "Block" : "Line",
|
|
@@ -2109,20 +2116,20 @@ function xe(e, t) {
|
|
|
2109
2116
|
start: i,
|
|
2110
2117
|
end: a
|
|
2111
2118
|
};
|
|
2112
|
-
e.locations && (c.loc = new
|
|
2119
|
+
e.locations && (c.loc = new _e(this, o, s)), e.ranges && (c.range = [i, a]), t.push(c);
|
|
2113
2120
|
};
|
|
2114
2121
|
}
|
|
2115
|
-
var
|
|
2116
|
-
function
|
|
2117
|
-
return
|
|
2122
|
+
var M = 1, N = 2, Ce = 4, we = 8, Te = 16, Ee = 32, De = 64, Oe = 128, P = 256, ke = 512, Ae = 1024, je = M | N | P;
|
|
2123
|
+
function Me(e, t) {
|
|
2124
|
+
return N | (e ? Ce : 0) | (t ? we : 0);
|
|
2118
2125
|
}
|
|
2119
|
-
var
|
|
2120
|
-
this.options = e =
|
|
2126
|
+
var Ne = 0, Pe = 1, F = 2, Fe = 3, Ie = 4, Le = 5, I = function(e, t, n) {
|
|
2127
|
+
this.options = e = xe(e), this.sourceFile = e.sourceFile, this.keywords = A(te[e.ecmaVersion >= 6 ? 6 : e.sourceType === "module" ? "5module" : 5]);
|
|
2121
2128
|
var r = "";
|
|
2122
2129
|
e.allowReserved !== !0 && (r = _[e.ecmaVersion >= 6 ? 6 : e.ecmaVersion === 5 ? 5 : 3], e.sourceType === "module" && (r += " await")), this.reservedWords = A(r);
|
|
2123
2130
|
var i = (r ? r + " " : "") + _.strict;
|
|
2124
|
-
this.reservedWordsStrict = A(i), this.reservedWordsStrictBind = A(i + " " + _.strictBind), this.input = String(t), this.containsEsc = !1, n ? (this.pos = n, this.lineStart = this.input.lastIndexOf("\n", n - 1) + 1, this.curLine = this.input.slice(0, this.lineStart).split(E).length) : (this.pos = this.lineStart = 0, this.curLine = 1), this.type = T.eof, this.value = null, this.start = this.end = this.pos, this.startLoc = this.endLoc = this.curPosition(), this.lastTokEndLoc = this.lastTokStartLoc = null, this.lastTokStart = this.lastTokEnd = this.pos, this.context = this.initialContext(), this.exprAllowed = !0, this.inModule = e.sourceType === "module", this.strict = this.inModule || e.strict === !0 || this.strictDirective(this.pos), this.potentialArrowAt = -1, this.potentialArrowInForAwait = !1, this.yieldPos = this.awaitPos = this.awaitIdentPos = 0, this.labels = [], this.undefinedExports = Object.create(null), this.pos === 0 && e.allowHashBang && this.input.slice(0, 2) === "#!" && this.skipLineComment(2), this.scopeStack = [], this.enterScope(this.options.sourceType === "commonjs" ?
|
|
2125
|
-
},
|
|
2131
|
+
this.reservedWordsStrict = A(i), this.reservedWordsStrictBind = A(i + " " + _.strictBind), this.input = String(t), this.containsEsc = !1, n ? (this.pos = n, this.lineStart = this.input.lastIndexOf("\n", n - 1) + 1, this.curLine = this.input.slice(0, this.lineStart).split(E).length) : (this.pos = this.lineStart = 0, this.curLine = 1), this.type = T.eof, this.value = null, this.start = this.end = this.pos, this.startLoc = this.endLoc = this.curPosition(), this.lastTokEndLoc = this.lastTokStartLoc = null, this.lastTokStart = this.lastTokEnd = this.pos, this.context = this.initialContext(), this.exprAllowed = !0, this.inModule = e.sourceType === "module", this.strict = this.inModule || e.strict === !0 || this.strictDirective(this.pos), this.potentialArrowAt = -1, this.potentialArrowInForAwait = !1, this.yieldPos = this.awaitPos = this.awaitIdentPos = 0, this.labels = [], this.undefinedExports = Object.create(null), this.pos === 0 && e.allowHashBang && this.input.slice(0, 2) === "#!" && this.skipLineComment(2), this.scopeStack = [], this.enterScope(this.options.sourceType === "commonjs" ? N : M), this.regexpState = null, this.privateNameStack = [];
|
|
2132
|
+
}, L = {
|
|
2126
2133
|
inFunction: { configurable: !0 },
|
|
2127
2134
|
inGenerator: { configurable: !0 },
|
|
2128
2135
|
inAsync: { configurable: !0 },
|
|
@@ -2135,61 +2142,61 @@ var Me = 0, Ne = 1, I = 2, Pe = 3, Fe = 4, Ie = 5, L = function(e, t, n) {
|
|
|
2135
2142
|
allowUsing: { configurable: !0 },
|
|
2136
2143
|
inClassStaticBlock: { configurable: !0 }
|
|
2137
2144
|
};
|
|
2138
|
-
|
|
2145
|
+
I.prototype.parse = function() {
|
|
2139
2146
|
var e = this, t = this.options.program || this.startNode();
|
|
2140
2147
|
return this.nextToken(), this.catchStackOverflow(function() {
|
|
2141
2148
|
return e.parseTopLevel(t);
|
|
2142
2149
|
});
|
|
2143
|
-
},
|
|
2144
|
-
return (this.currentVarScope().flags &
|
|
2145
|
-
},
|
|
2150
|
+
}, L.inFunction.get = function() {
|
|
2151
|
+
return (this.currentVarScope().flags & N) > 0;
|
|
2152
|
+
}, L.inGenerator.get = function() {
|
|
2153
|
+
return (this.currentVarScope().flags & we) > 0;
|
|
2154
|
+
}, L.inAsync.get = function() {
|
|
2146
2155
|
return (this.currentVarScope().flags & Ce) > 0;
|
|
2147
|
-
},
|
|
2148
|
-
return (this.currentVarScope().flags & Se) > 0;
|
|
2149
|
-
}, R.canAwait.get = function() {
|
|
2156
|
+
}, L.canAwait.get = function() {
|
|
2150
2157
|
for (var e = this.scopeStack.length - 1; e >= 0; e--) {
|
|
2151
2158
|
var t = this.scopeStack[e].flags;
|
|
2152
|
-
if (t & (
|
|
2153
|
-
if (t &
|
|
2159
|
+
if (t & (P | ke)) return !1;
|
|
2160
|
+
if (t & N) return (t & Ce) > 0;
|
|
2154
2161
|
}
|
|
2155
2162
|
return this.inModule && this.options.ecmaVersion >= 13 || this.options.allowAwaitOutsideFunction;
|
|
2156
|
-
},
|
|
2157
|
-
return !!(this.inFunction || this.options.allowReturnOutsideFunction && this.currentVarScope().flags &
|
|
2158
|
-
},
|
|
2159
|
-
return (this.currentThisScope().flags &
|
|
2160
|
-
},
|
|
2161
|
-
return (this.currentThisScope().flags &
|
|
2162
|
-
},
|
|
2163
|
+
}, L.allowReturn.get = function() {
|
|
2164
|
+
return !!(this.inFunction || this.options.allowReturnOutsideFunction && this.currentVarScope().flags & M);
|
|
2165
|
+
}, L.allowSuper.get = function() {
|
|
2166
|
+
return (this.currentThisScope().flags & De) > 0 || this.options.allowSuperOutsideMethod;
|
|
2167
|
+
}, L.allowDirectSuper.get = function() {
|
|
2168
|
+
return (this.currentThisScope().flags & Oe) > 0;
|
|
2169
|
+
}, L.treatFunctionsAsVar.get = function() {
|
|
2163
2170
|
return this.treatFunctionsAsVarInScope(this.currentScope());
|
|
2164
|
-
},
|
|
2171
|
+
}, L.allowNewDotTarget.get = function() {
|
|
2165
2172
|
for (var e = this.scopeStack.length - 1; e >= 0; e--) {
|
|
2166
2173
|
var t = this.scopeStack[e].flags;
|
|
2167
|
-
if (t & (
|
|
2174
|
+
if (t & (P | ke) || t & N && !(t & Te)) return !0;
|
|
2168
2175
|
}
|
|
2169
2176
|
return !1;
|
|
2170
|
-
},
|
|
2177
|
+
}, L.allowUsing.get = function() {
|
|
2171
2178
|
var e = this.currentScope().flags;
|
|
2172
|
-
return !(e &
|
|
2173
|
-
},
|
|
2174
|
-
return (this.currentVarScope().flags &
|
|
2175
|
-
},
|
|
2179
|
+
return !(e & Ae || !this.inModule && e & M);
|
|
2180
|
+
}, L.inClassStaticBlock.get = function() {
|
|
2181
|
+
return (this.currentVarScope().flags & P) > 0;
|
|
2182
|
+
}, I.extend = function() {
|
|
2176
2183
|
for (var e = [], t = arguments.length; t--;) e[t] = arguments[t];
|
|
2177
2184
|
for (var n = this, r = 0; r < e.length; r++) n = e[r](n);
|
|
2178
2185
|
return n;
|
|
2179
|
-
},
|
|
2186
|
+
}, I.parse = function(e, t) {
|
|
2180
2187
|
return new this(t, e).parse();
|
|
2181
|
-
},
|
|
2188
|
+
}, I.parseExpressionAt = function(e, t, n) {
|
|
2182
2189
|
var r = new this(n, e, t);
|
|
2183
2190
|
return r.nextToken(), r.parseExpression();
|
|
2184
|
-
},
|
|
2191
|
+
}, I.tokenizer = function(e, t) {
|
|
2185
2192
|
return new this(t, e);
|
|
2186
|
-
}, Object.defineProperties(
|
|
2187
|
-
var
|
|
2188
|
-
|
|
2193
|
+
}, Object.defineProperties(I.prototype, L);
|
|
2194
|
+
var R = I.prototype, Re = /^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;
|
|
2195
|
+
R.strictDirective = function(e) {
|
|
2189
2196
|
if (this.options.ecmaVersion < 5) return !1;
|
|
2190
2197
|
for (;;) {
|
|
2191
2198
|
O.lastIndex = e, e += O.exec(this.input)[0].length;
|
|
2192
|
-
var t =
|
|
2199
|
+
var t = Re.exec(this.input.slice(e));
|
|
2193
2200
|
if (!t) return !1;
|
|
2194
2201
|
if ((t[1] || t[2]) === "use strict") {
|
|
2195
2202
|
O.lastIndex = e + t[0].length;
|
|
@@ -2198,55 +2205,55 @@ z.strictDirective = function(e) {
|
|
|
2198
2205
|
}
|
|
2199
2206
|
e += t[0].length, O.lastIndex = e, e += O.exec(this.input)[0].length, this.input[e] === ";" && e++;
|
|
2200
2207
|
}
|
|
2201
|
-
},
|
|
2208
|
+
}, R.eat = function(e) {
|
|
2202
2209
|
return this.type === e ? (this.next(), !0) : !1;
|
|
2203
|
-
},
|
|
2210
|
+
}, R.isContextual = function(e) {
|
|
2204
2211
|
return this.type === T.name && this.value === e && !this.containsEsc;
|
|
2205
|
-
},
|
|
2212
|
+
}, R.eatContextual = function(e) {
|
|
2206
2213
|
return this.isContextual(e) ? (this.next(), !0) : !1;
|
|
2207
|
-
},
|
|
2214
|
+
}, R.catchStackOverflow = function(e) {
|
|
2208
2215
|
try {
|
|
2209
2216
|
return e();
|
|
2210
2217
|
} catch (e) {
|
|
2211
2218
|
if (e instanceof Error && (/\bstack\b.*\b(exceeded|overflow)\b/i.test(e.message) || /\btoo much recursion\b/i.test(e.message))) this.raise(this.start, "Not enough stack space to parse input");
|
|
2212
2219
|
else throw e;
|
|
2213
2220
|
}
|
|
2214
|
-
},
|
|
2221
|
+
}, R.expectContextual = function(e) {
|
|
2215
2222
|
this.eatContextual(e) || this.unexpected();
|
|
2216
|
-
},
|
|
2223
|
+
}, R.canInsertSemicolon = function() {
|
|
2217
2224
|
return this.type === T.eof || this.type === T.braceR || E.test(this.input.slice(this.lastTokEnd, this.start));
|
|
2218
|
-
},
|
|
2225
|
+
}, R.insertSemicolon = function() {
|
|
2219
2226
|
if (this.canInsertSemicolon()) return this.options.onInsertedSemicolon && this.options.onInsertedSemicolon(this.lastTokEnd, this.lastTokEndLoc), !0;
|
|
2220
|
-
},
|
|
2227
|
+
}, R.semicolon = function() {
|
|
2221
2228
|
!this.eat(T.semi) && !this.insertSemicolon() && this.unexpected();
|
|
2222
|
-
},
|
|
2229
|
+
}, R.afterTrailingComma = function(e, t) {
|
|
2223
2230
|
if (this.type === e) return this.options.onTrailingComma && this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc), t || this.next(), !0;
|
|
2224
|
-
},
|
|
2231
|
+
}, R.expect = function(e) {
|
|
2225
2232
|
this.eat(e) || this.unexpected();
|
|
2226
|
-
},
|
|
2233
|
+
}, R.unexpected = function(e) {
|
|
2227
2234
|
this.raise(e ?? this.start, "Unexpected token");
|
|
2228
2235
|
};
|
|
2229
|
-
var
|
|
2236
|
+
var ze = function() {
|
|
2230
2237
|
this.shorthandAssign = this.trailingComma = this.parenthesizedAssign = this.parenthesizedBind = this.doubleProto = -1;
|
|
2231
2238
|
};
|
|
2232
|
-
|
|
2239
|
+
R.checkPatternErrors = function(e, t) {
|
|
2233
2240
|
if (e) {
|
|
2234
2241
|
e.trailingComma > -1 && this.raiseRecoverable(e.trailingComma, "Comma is not permitted after the rest element");
|
|
2235
2242
|
var n = t ? e.parenthesizedAssign : e.parenthesizedBind;
|
|
2236
2243
|
n > -1 && this.raiseRecoverable(n, t ? "Assigning to rvalue" : "Parenthesized pattern");
|
|
2237
2244
|
}
|
|
2238
|
-
},
|
|
2245
|
+
}, R.checkExpressionErrors = function(e, t) {
|
|
2239
2246
|
if (!e) return !1;
|
|
2240
2247
|
var n = e.shorthandAssign, r = e.doubleProto;
|
|
2241
2248
|
if (!t) return n >= 0 || r >= 0;
|
|
2242
2249
|
n >= 0 && this.raise(n, "Shorthand property assignments are valid only in destructuring patterns"), r >= 0 && this.raiseRecoverable(r, "Redefinition of __proto__ property");
|
|
2243
|
-
},
|
|
2250
|
+
}, R.checkYieldAwaitInDefaultParams = function() {
|
|
2244
2251
|
this.yieldPos && (!this.awaitPos || this.yieldPos < this.awaitPos) && this.raise(this.yieldPos, "Yield expression cannot be a default value"), this.awaitPos && this.raise(this.awaitPos, "Await expression cannot be a default value");
|
|
2245
|
-
},
|
|
2252
|
+
}, R.isSimpleAssignTarget = function(e) {
|
|
2246
2253
|
return e.type === "ParenthesizedExpression" ? this.isSimpleAssignTarget(e.expression) : e.type === "Identifier" || e.type === "MemberExpression";
|
|
2247
2254
|
};
|
|
2248
|
-
var
|
|
2249
|
-
|
|
2255
|
+
var z = I.prototype;
|
|
2256
|
+
z.parseTopLevel = function(e) {
|
|
2250
2257
|
var t = Object.create(null);
|
|
2251
2258
|
for (e.body ||= []; this.type !== T.eof;) {
|
|
2252
2259
|
var n = this.parseStatement(null, !0, t);
|
|
@@ -2258,8 +2265,8 @@ B.parseTopLevel = function(e) {
|
|
|
2258
2265
|
}
|
|
2259
2266
|
return this.adaptDirectivePrologue(e.body), this.next(), e.sourceType = this.options.sourceType === "commonjs" ? "script" : this.options.sourceType, this.finishNode(e, "Program");
|
|
2260
2267
|
};
|
|
2261
|
-
var
|
|
2262
|
-
|
|
2268
|
+
var Be = { kind: "loop" }, Ve = { kind: "switch" };
|
|
2269
|
+
z.isLet = function(e) {
|
|
2263
2270
|
if (this.options.ecmaVersion < 6 || !this.isContextual("let")) return !1;
|
|
2264
2271
|
O.lastIndex = this.pos;
|
|
2265
2272
|
var t = O.exec(this.input), n = this.pos + t[0].length, r = this.fullCharCodeAt(n);
|
|
@@ -2276,12 +2283,12 @@ B.isLet = function(e) {
|
|
|
2276
2283
|
if (!ne.test(a)) return !0;
|
|
2277
2284
|
}
|
|
2278
2285
|
return !1;
|
|
2279
|
-
},
|
|
2286
|
+
}, z.isAsyncFunction = function() {
|
|
2280
2287
|
if (this.options.ecmaVersion < 8 || !this.isContextual("async")) return !1;
|
|
2281
2288
|
O.lastIndex = this.pos;
|
|
2282
2289
|
var e = O.exec(this.input), t = this.pos + e[0].length, n;
|
|
2283
2290
|
return !E.test(this.input.slice(this.pos, t)) && this.input.slice(t, t + 8) === "function" && (t + 8 === this.input.length || !(y(n = this.fullCharCodeAt(t + 8)) || n === 92));
|
|
2284
|
-
},
|
|
2291
|
+
}, z.isUsingKeyword = function(e, t) {
|
|
2285
2292
|
if (this.options.ecmaVersion < 17 || !this.isContextual(e ? "await" : "using")) return !1;
|
|
2286
2293
|
O.lastIndex = this.pos;
|
|
2287
2294
|
var n = O.exec(this.input), r = this.pos + n[0].length;
|
|
@@ -2308,11 +2315,11 @@ B.isLet = function(e) {
|
|
|
2308
2315
|
if (r += u[0].length, this.input.charCodeAt(r) !== 61 || (s = this.input.charCodeAt(r + 1)) === 61 || s === 62) return !1;
|
|
2309
2316
|
}
|
|
2310
2317
|
return !0;
|
|
2311
|
-
},
|
|
2318
|
+
}, z.isAwaitUsing = function(e) {
|
|
2312
2319
|
return this.isUsingKeyword(!0, e);
|
|
2313
|
-
},
|
|
2320
|
+
}, z.isUsing = function(e) {
|
|
2314
2321
|
return this.isUsingKeyword(!1, e);
|
|
2315
|
-
},
|
|
2322
|
+
}, z.parseStatement = function(e, t, n) {
|
|
2316
2323
|
var r = this.type, i = this.startNode(), a;
|
|
2317
2324
|
switch (this.isLet(e) && (r = T._var, a = "let"), r) {
|
|
2318
2325
|
case T._break:
|
|
@@ -2348,7 +2355,7 @@ B.isLet = function(e) {
|
|
|
2348
2355
|
var u = this.value, d = this.parseExpression();
|
|
2349
2356
|
return r === T.name && d.type === "Identifier" && this.eat(T.colon) ? this.parseLabeledStatement(i, u, d, e) : this.parseExpressionStatement(i, d);
|
|
2350
2357
|
}
|
|
2351
|
-
},
|
|
2358
|
+
}, z.parseBreakContinueStatement = function(e, t) {
|
|
2352
2359
|
var n = t === "break";
|
|
2353
2360
|
this.next(), this.eat(T.semi) || this.insertSemicolon() ? e.label = null : this.type === T.name ? (e.label = this.parseIdent(), this.semicolon()) : this.unexpected();
|
|
2354
2361
|
for (var r = 0; r < this.labels.length; ++r) {
|
|
@@ -2356,14 +2363,14 @@ B.isLet = function(e) {
|
|
|
2356
2363
|
if ((e.label == null || i.name === e.label.name) && (i.kind != null && (n || i.kind === "loop") || e.label && n)) break;
|
|
2357
2364
|
}
|
|
2358
2365
|
return r === this.labels.length && this.raise(e.start, "Unsyntactic " + t), this.finishNode(e, n ? "BreakStatement" : "ContinueStatement");
|
|
2359
|
-
},
|
|
2366
|
+
}, z.parseDebuggerStatement = function(e) {
|
|
2360
2367
|
return this.next(), this.semicolon(), this.finishNode(e, "DebuggerStatement");
|
|
2361
|
-
},
|
|
2362
|
-
return this.next(), this.labels.push(
|
|
2363
|
-
},
|
|
2368
|
+
}, z.parseDoStatement = function(e) {
|
|
2369
|
+
return this.next(), this.labels.push(Be), e.body = this.parseStatement("do"), this.labels.pop(), this.expect(T._while), e.test = this.parseParenExpression(), this.options.ecmaVersion >= 6 ? this.eat(T.semi) : this.semicolon(), this.finishNode(e, "DoWhileStatement");
|
|
2370
|
+
}, z.parseForStatement = function(e) {
|
|
2364
2371
|
this.next();
|
|
2365
2372
|
var t = this.options.ecmaVersion >= 9 && this.canAwait && this.eatContextual("await") ? this.lastTokStart : -1;
|
|
2366
|
-
if (this.labels.push(
|
|
2373
|
+
if (this.labels.push(Be), this.enterScope(0), this.expect(T.parenL), this.type === T.semi) return t > -1 && this.unexpected(t), this.parseFor(e, null);
|
|
2367
2374
|
var n = this.isLet();
|
|
2368
2375
|
if (this.type === T._var || this.type === T._const || n) {
|
|
2369
2376
|
var r = this.startNode(), i = n ? "let" : this.value;
|
|
@@ -2374,45 +2381,45 @@ B.isLet = function(e) {
|
|
|
2374
2381
|
var c = this.startNode();
|
|
2375
2382
|
return this.next(), s === "await using" && (this.canAwait || this.raise(this.start, "Await using cannot appear outside of async function"), this.next()), this.parseVar(c, !0, s), this.finishNode(c, "VariableDeclaration"), this.parseForAfterInit(e, c, t);
|
|
2376
2383
|
}
|
|
2377
|
-
var l = this.containsEsc, u = new
|
|
2384
|
+
var l = this.containsEsc, u = new ze(), d = this.start, f = t > -1 ? this.parseExprSubscripts(u, "await") : this.parseExpression(!0, u);
|
|
2378
2385
|
return this.type === T._in || (o = this.options.ecmaVersion >= 6 && this.isContextual("of")) ? (t > -1 ? (this.type === T._in && this.unexpected(t), e.await = !0) : o && this.options.ecmaVersion >= 8 && (f.start === d && !l && f.type === "Identifier" && f.name === "async" ? this.unexpected() : this.options.ecmaVersion >= 9 && (e.await = !1)), a && o && this.raise(f.start, "The left-hand side of a for-of loop may not start with 'let'."), this.toAssignable(f, !1, u), this.checkLValPattern(f), this.parseForIn(e, f)) : (this.checkExpressionErrors(u, !0), t > -1 && this.unexpected(t), this.parseFor(e, f));
|
|
2379
|
-
},
|
|
2386
|
+
}, z.parseForAfterInit = function(e, t, n) {
|
|
2380
2387
|
return (this.type === T._in || this.options.ecmaVersion >= 6 && this.isContextual("of")) && t.declarations.length === 1 ? (this.type === T._in ? ((t.kind === "using" || t.kind === "await using") && !t.declarations[0].init && this.raise(this.start, "Using declaration is not allowed in for-in loops"), this.options.ecmaVersion >= 9 && n > -1 && this.unexpected(n)) : this.options.ecmaVersion >= 9 && (e.await = n > -1), this.parseForIn(e, t)) : (n > -1 && this.unexpected(n), this.parseFor(e, t));
|
|
2381
|
-
},
|
|
2382
|
-
return this.next(), this.parseFunction(e,
|
|
2383
|
-
},
|
|
2388
|
+
}, z.parseFunctionStatement = function(e, t, n) {
|
|
2389
|
+
return this.next(), this.parseFunction(e, Ue | (n ? 0 : We), !1, t);
|
|
2390
|
+
}, z.parseIfStatement = function(e) {
|
|
2384
2391
|
return this.next(), e.test = this.parseParenExpression(), e.consequent = this.parseStatement("if"), e.alternate = this.eat(T._else) ? this.parseStatement("if") : null, this.finishNode(e, "IfStatement");
|
|
2385
|
-
},
|
|
2392
|
+
}, z.parseReturnStatement = function(e) {
|
|
2386
2393
|
return this.allowReturn || this.raise(this.start, "'return' outside of function"), this.next(), this.eat(T.semi) || this.insertSemicolon() ? e.argument = null : (e.argument = this.parseExpression(), this.semicolon()), this.finishNode(e, "ReturnStatement");
|
|
2387
|
-
},
|
|
2388
|
-
this.next(), e.discriminant = this.parseParenExpression(), e.cases = [], this.expect(T.braceL), this.labels.push(
|
|
2394
|
+
}, z.parseSwitchStatement = function(e) {
|
|
2395
|
+
this.next(), e.discriminant = this.parseParenExpression(), e.cases = [], this.expect(T.braceL), this.labels.push(Ve), this.enterScope(Ae);
|
|
2389
2396
|
for (var t, n = !1; this.type !== T.braceR;) if (this.type === T._case || this.type === T._default) {
|
|
2390
2397
|
var r = this.type === T._case;
|
|
2391
2398
|
t && this.finishNode(t, "SwitchCase"), e.cases.push(t = this.startNode()), t.consequent = [], this.next(), r ? t.test = this.parseExpression() : (n && this.raiseRecoverable(this.lastTokStart, "Multiple default clauses"), n = !0, t.test = null), this.expect(T.colon);
|
|
2392
2399
|
} else t || this.unexpected(), t.consequent.push(this.parseStatement(null));
|
|
2393
2400
|
return this.exitScope(), t && this.finishNode(t, "SwitchCase"), this.next(), this.labels.pop(), this.finishNode(e, "SwitchStatement");
|
|
2394
|
-
},
|
|
2401
|
+
}, z.parseThrowStatement = function(e) {
|
|
2395
2402
|
return this.next(), E.test(this.input.slice(this.lastTokEnd, this.start)) && this.raise(this.lastTokEnd, "Illegal newline after throw"), e.argument = this.parseExpression(), this.semicolon(), this.finishNode(e, "ThrowStatement");
|
|
2396
2403
|
};
|
|
2397
|
-
var
|
|
2398
|
-
|
|
2404
|
+
var He = [];
|
|
2405
|
+
z.parseCatchClauseParam = function() {
|
|
2399
2406
|
var e = this.parseBindingAtom(), t = e.type === "Identifier";
|
|
2400
|
-
return this.enterScope(t ?
|
|
2401
|
-
},
|
|
2407
|
+
return this.enterScope(t ? Ee : 0), this.checkLValPattern(e, t ? Ie : F), this.expect(T.parenR), e;
|
|
2408
|
+
}, z.parseTryStatement = function(e) {
|
|
2402
2409
|
if (this.next(), e.block = this.parseBlock(), e.handler = null, this.type === T._catch) {
|
|
2403
2410
|
var t = this.startNode();
|
|
2404
2411
|
this.next(), this.eat(T.parenL) ? t.param = this.parseCatchClauseParam() : (this.options.ecmaVersion < 10 && this.unexpected(), t.param = null, this.enterScope(0)), t.body = this.parseBlock(!1), this.exitScope(), e.handler = this.finishNode(t, "CatchClause");
|
|
2405
2412
|
}
|
|
2406
2413
|
return e.finalizer = this.eat(T._finally) ? this.parseBlock() : null, !e.handler && !e.finalizer && this.raise(e.start, "Missing catch or finally clause"), this.finishNode(e, "TryStatement");
|
|
2407
|
-
},
|
|
2414
|
+
}, z.parseVarStatement = function(e, t, n) {
|
|
2408
2415
|
return this.next(), this.parseVar(e, !1, t, n), this.semicolon(), this.finishNode(e, "VariableDeclaration");
|
|
2409
|
-
},
|
|
2410
|
-
return this.next(), e.test = this.parseParenExpression(), this.labels.push(
|
|
2411
|
-
},
|
|
2416
|
+
}, z.parseWhileStatement = function(e) {
|
|
2417
|
+
return this.next(), e.test = this.parseParenExpression(), this.labels.push(Be), e.body = this.parseStatement("while"), this.labels.pop(), this.finishNode(e, "WhileStatement");
|
|
2418
|
+
}, z.parseWithStatement = function(e) {
|
|
2412
2419
|
return this.strict && this.raise(this.start, "'with' in strict mode"), this.next(), e.object = this.parseParenExpression(), e.body = this.parseStatement("with"), this.finishNode(e, "WithStatement");
|
|
2413
|
-
},
|
|
2420
|
+
}, z.parseEmptyStatement = function(e) {
|
|
2414
2421
|
return this.next(), this.finishNode(e, "EmptyStatement");
|
|
2415
|
-
},
|
|
2422
|
+
}, z.parseLabeledStatement = function(e, t, n, r) {
|
|
2416
2423
|
for (var i = 0, a = this.labels; i < a.length; i += 1) a[i].name === t && this.raise(n.start, "Label '" + t + "' is already declared");
|
|
2417
2424
|
for (var o = this.type.isLoop ? "loop" : this.type === T._switch ? "switch" : null, s = this.labels.length - 1; s >= 0; s--) {
|
|
2418
2425
|
var c = this.labels[s];
|
|
@@ -2424,46 +2431,46 @@ B.parseCatchClauseParam = function() {
|
|
|
2424
2431
|
kind: o,
|
|
2425
2432
|
statementStart: this.start
|
|
2426
2433
|
}), e.body = this.parseStatement(r ? r.indexOf("label") === -1 ? r + "label" : r : "label"), this.labels.pop(), e.label = n, this.finishNode(e, "LabeledStatement");
|
|
2427
|
-
},
|
|
2434
|
+
}, z.parseExpressionStatement = function(e, t) {
|
|
2428
2435
|
return e.expression = t, this.semicolon(), this.finishNode(e, "ExpressionStatement");
|
|
2429
|
-
},
|
|
2436
|
+
}, z.parseBlock = function(e, t, n) {
|
|
2430
2437
|
for (e === void 0 && (e = !0), t === void 0 && (t = this.startNode()), t.body = [], this.expect(T.braceL), e && this.enterScope(0); this.type !== T.braceR;) {
|
|
2431
2438
|
var r = this.parseStatement(null);
|
|
2432
2439
|
t.body.push(r);
|
|
2433
2440
|
}
|
|
2434
2441
|
return n && (this.strict = !1), this.next(), e && this.exitScope(), this.finishNode(t, "BlockStatement");
|
|
2435
|
-
},
|
|
2442
|
+
}, z.parseFor = function(e, t) {
|
|
2436
2443
|
return e.init = t, this.expect(T.semi), e.test = this.type === T.semi ? null : this.parseExpression(), this.expect(T.semi), e.update = this.type === T.parenR ? null : this.parseExpression(), this.expect(T.parenR), e.body = this.parseStatement("for"), this.exitScope(), this.labels.pop(), this.finishNode(e, "ForStatement");
|
|
2437
|
-
},
|
|
2444
|
+
}, z.parseForIn = function(e, t) {
|
|
2438
2445
|
var n = this.type === T._in;
|
|
2439
2446
|
return this.next(), t.type === "VariableDeclaration" && t.declarations[0].init != null && (!n || this.options.ecmaVersion < 8 || this.strict || t.kind !== "var" || t.declarations[0].id.type !== "Identifier") && this.raise(t.start, (n ? "for-in" : "for-of") + " loop variable declaration may not have an initializer"), e.left = t, e.right = n ? this.parseExpression() : this.parseMaybeAssign(), this.expect(T.parenR), e.body = this.parseStatement("for"), this.exitScope(), this.labels.pop(), this.finishNode(e, n ? "ForInStatement" : "ForOfStatement");
|
|
2440
|
-
},
|
|
2447
|
+
}, z.parseVar = function(e, t, n, r) {
|
|
2441
2448
|
for (e.declarations = [], e.kind = n;;) {
|
|
2442
2449
|
var i = this.startNode();
|
|
2443
2450
|
if (this.parseVarId(i, n), this.eat(T.eq) ? i.init = this.parseMaybeAssign(t) : !r && n === "const" && !(this.type === T._in || this.options.ecmaVersion >= 6 && this.isContextual("of")) ? this.unexpected() : !r && (n === "using" || n === "await using") && this.options.ecmaVersion >= 17 && this.type !== T._in && !this.isContextual("of") ? this.raise(this.lastTokEnd, "Missing initializer in " + n + " declaration") : !r && i.id.type !== "Identifier" && !(t && (this.type === T._in || this.isContextual("of"))) ? this.raise(this.lastTokEnd, "Complex binding patterns require an initialization value") : i.init = null, e.declarations.push(this.finishNode(i, "VariableDeclarator")), !this.eat(T.comma)) break;
|
|
2444
2451
|
}
|
|
2445
2452
|
return e;
|
|
2446
|
-
},
|
|
2447
|
-
e.id = t === "using" || t === "await using" ? this.parseIdent() : this.parseBindingAtom(), this.checkLValPattern(e.id, t === "var" ?
|
|
2453
|
+
}, z.parseVarId = function(e, t) {
|
|
2454
|
+
e.id = t === "using" || t === "await using" ? this.parseIdent() : this.parseBindingAtom(), this.checkLValPattern(e.id, t === "var" ? Pe : F, !1);
|
|
2448
2455
|
};
|
|
2449
|
-
var
|
|
2450
|
-
|
|
2451
|
-
this.initFunction(e), (this.options.ecmaVersion >= 9 || this.options.ecmaVersion >= 6 && !r) && (this.type === T.star && t &
|
|
2456
|
+
var Ue = 1, We = 2, Ge = 4;
|
|
2457
|
+
z.parseFunction = function(e, t, n, r, i) {
|
|
2458
|
+
this.initFunction(e), (this.options.ecmaVersion >= 9 || this.options.ecmaVersion >= 6 && !r) && (this.type === T.star && t & We && this.unexpected(), e.generator = this.eat(T.star)), this.options.ecmaVersion >= 8 && (e.async = !!r), t & Ue && (e.id = t & Ge && this.type !== T.name ? null : this.parseIdent(), e.id && !(t & We) && this.checkLValSimple(e.id, this.strict || e.generator || e.async ? this.treatFunctionsAsVar ? Pe : F : Fe));
|
|
2452
2459
|
var a = this.yieldPos, o = this.awaitPos, s = this.awaitIdentPos;
|
|
2453
|
-
return this.yieldPos = 0, this.awaitPos = 0, this.awaitIdentPos = 0, this.enterScope(
|
|
2454
|
-
},
|
|
2460
|
+
return this.yieldPos = 0, this.awaitPos = 0, this.awaitIdentPos = 0, this.enterScope(Me(e.async, e.generator)), t & Ue || (e.id = this.type === T.name ? this.parseIdent() : null), this.parseFunctionParams(e), this.parseFunctionBody(e, n, !1, i), this.yieldPos = a, this.awaitPos = o, this.awaitIdentPos = s, this.finishNode(e, t & Ue ? "FunctionDeclaration" : "FunctionExpression");
|
|
2461
|
+
}, z.parseFunctionParams = function(e) {
|
|
2455
2462
|
this.expect(T.parenL), e.params = this.parseBindingList(T.parenR, !1, this.options.ecmaVersion >= 8), this.checkYieldAwaitInDefaultParams();
|
|
2456
|
-
},
|
|
2463
|
+
}, z.parseClass = function(e, t) {
|
|
2457
2464
|
this.next();
|
|
2458
2465
|
var n = this.strict;
|
|
2459
2466
|
this.strict = !0, this.parseClassId(e, t), this.parseClassSuper(e);
|
|
2460
2467
|
var r = this.enterClassBody(), i = this.startNode(), a = !1;
|
|
2461
2468
|
for (i.body = [], this.expect(T.braceL); this.type !== T.braceR;) {
|
|
2462
2469
|
var o = this.parseClassElement(e.superClass !== null);
|
|
2463
|
-
o && (i.body.push(o), o.type === "MethodDefinition" && o.kind === "constructor" ? (a && this.raiseRecoverable(o.start, "Duplicate constructor in the same class"), a = !0) : o.key && o.key.type === "PrivateIdentifier" &&
|
|
2470
|
+
o && (i.body.push(o), o.type === "MethodDefinition" && o.kind === "constructor" ? (a && this.raiseRecoverable(o.start, "Duplicate constructor in the same class"), a = !0) : o.key && o.key.type === "PrivateIdentifier" && Ke(r, o) && this.raiseRecoverable(o.key.start, "Identifier '#" + o.key.name + "' has already been declared"));
|
|
2464
2471
|
}
|
|
2465
2472
|
return this.strict = n, this.next(), e.body = this.finishNode(i, "ClassBody"), this.exitClassBody(), this.finishNode(e, t ? "ClassDeclaration" : "ClassExpression");
|
|
2466
|
-
},
|
|
2473
|
+
}, z.parseClassElement = function(e) {
|
|
2467
2474
|
if (this.eat(T.semi)) return null;
|
|
2468
2475
|
var t = this.options.ecmaVersion, n = this.startNode(), r = "", i = !1, a = !1, o = "method", s = !1;
|
|
2469
2476
|
if (this.eatContextual("static")) {
|
|
@@ -2475,57 +2482,57 @@ B.parseFunction = function(e, t, n, r, i) {
|
|
|
2475
2482
|
(this.eatContextual("get") || this.eatContextual("set")) && (this.isClassElementNameStart() ? o = c : r = c);
|
|
2476
2483
|
}
|
|
2477
2484
|
if (r ? (n.computed = !1, n.key = this.startNodeAt(this.lastTokStart, this.lastTokStartLoc), n.key.name = r, this.finishNode(n.key, "Identifier")) : this.parseClassElementName(n), t < 13 || this.type === T.parenL || o !== "method" || i || a) {
|
|
2478
|
-
var l = !n.static &&
|
|
2485
|
+
var l = !n.static && qe(n, "constructor"), u = l && e;
|
|
2479
2486
|
l && o !== "method" && this.raise(n.key.start, "Constructor can't have get/set modifier"), n.kind = l ? "constructor" : o, this.parseClassMethod(n, i, a, u);
|
|
2480
2487
|
} else this.parseClassField(n);
|
|
2481
2488
|
return n;
|
|
2482
|
-
},
|
|
2489
|
+
}, z.isClassElementNameStart = function() {
|
|
2483
2490
|
return this.type === T.name || this.type === T.privateId || this.type === T.num || this.type === T.string || this.type === T.bracketL || this.type.keyword;
|
|
2484
|
-
},
|
|
2491
|
+
}, z.parseClassElementName = function(e) {
|
|
2485
2492
|
this.type === T.privateId ? (this.value === "constructor" && this.raise(this.start, "Classes can't have an element named '#constructor'"), e.computed = !1, e.key = this.parsePrivateIdent()) : this.parsePropertyName(e);
|
|
2486
|
-
},
|
|
2493
|
+
}, z.parseClassMethod = function(e, t, n, r) {
|
|
2487
2494
|
var i = e.key;
|
|
2488
|
-
e.kind === "constructor" ? (t && this.raise(i.start, "Constructor can't be a generator"), n && this.raise(i.start, "Constructor can't be an async method")) : e.static &&
|
|
2495
|
+
e.kind === "constructor" ? (t && this.raise(i.start, "Constructor can't be a generator"), n && this.raise(i.start, "Constructor can't be an async method")) : e.static && qe(e, "prototype") && this.raise(i.start, "Classes may not have a static property named prototype");
|
|
2489
2496
|
var a = e.value = this.parseMethod(t, n, r);
|
|
2490
2497
|
return e.kind === "get" && a.params.length !== 0 && this.raiseRecoverable(a.start, "getter should have no params"), e.kind === "set" && a.params.length !== 1 && this.raiseRecoverable(a.start, "setter should have exactly one param"), e.kind === "set" && a.params[0].type === "RestElement" && this.raiseRecoverable(a.params[0].start, "Setter cannot use rest params"), this.finishNode(e, "MethodDefinition");
|
|
2491
|
-
},
|
|
2492
|
-
return
|
|
2493
|
-
},
|
|
2498
|
+
}, z.parseClassField = function(e) {
|
|
2499
|
+
return qe(e, "constructor") ? this.raise(e.key.start, "Classes can't have a field named 'constructor'") : e.static && qe(e, "prototype") && this.raise(e.key.start, "Classes can't have a static field named 'prototype'"), this.eat(T.eq) ? (this.enterScope(ke | De), e.value = this.parseMaybeAssign(), this.exitScope()) : e.value = null, this.semicolon(), this.finishNode(e, "PropertyDefinition");
|
|
2500
|
+
}, z.parseClassStaticBlock = function(e) {
|
|
2494
2501
|
e.body = [];
|
|
2495
2502
|
var t = this.labels;
|
|
2496
|
-
for (this.labels = [], this.enterScope(
|
|
2503
|
+
for (this.labels = [], this.enterScope(P | De); this.type !== T.braceR;) {
|
|
2497
2504
|
var n = this.parseStatement(null);
|
|
2498
2505
|
e.body.push(n);
|
|
2499
2506
|
}
|
|
2500
2507
|
return this.next(), this.exitScope(), this.labels = t, this.finishNode(e, "StaticBlock");
|
|
2501
|
-
},
|
|
2502
|
-
this.type === T.name ? (e.id = this.parseIdent(), t && this.checkLValSimple(e.id,
|
|
2503
|
-
},
|
|
2508
|
+
}, z.parseClassId = function(e, t) {
|
|
2509
|
+
this.type === T.name ? (e.id = this.parseIdent(), t && this.checkLValSimple(e.id, F, !1)) : (t === !0 && this.unexpected(), e.id = null);
|
|
2510
|
+
}, z.parseClassSuper = function(e) {
|
|
2504
2511
|
e.superClass = this.eat(T._extends) ? this.parseExprSubscripts(null, !1) : null;
|
|
2505
|
-
},
|
|
2512
|
+
}, z.enterClassBody = function() {
|
|
2506
2513
|
var e = {
|
|
2507
2514
|
declared: Object.create(null),
|
|
2508
2515
|
used: []
|
|
2509
2516
|
};
|
|
2510
2517
|
return this.privateNameStack.push(e), e.declared;
|
|
2511
|
-
},
|
|
2518
|
+
}, z.exitClassBody = function() {
|
|
2512
2519
|
var e = this.privateNameStack.pop(), t = e.declared, n = e.used;
|
|
2513
2520
|
if (this.options.checkPrivateFields) for (var r = this.privateNameStack.length, i = r === 0 ? null : this.privateNameStack[r - 1], a = 0; a < n.length; ++a) {
|
|
2514
2521
|
var o = n[a];
|
|
2515
2522
|
k(t, o.name) || (i ? i.used.push(o) : this.raiseRecoverable(o.start, "Private field '#" + o.name + "' must be declared in an enclosing class"));
|
|
2516
2523
|
}
|
|
2517
2524
|
};
|
|
2518
|
-
function
|
|
2525
|
+
function Ke(e, t) {
|
|
2519
2526
|
var n = t.key.name, r = e[n], i = "true";
|
|
2520
2527
|
return t.type === "MethodDefinition" && (t.kind === "get" || t.kind === "set") && (i = (t.static ? "s" : "i") + t.kind), r === "iget" && i === "iset" || r === "iset" && i === "iget" || r === "sget" && i === "sset" || r === "sset" && i === "sget" ? (e[n] = "true", !1) : r ? !0 : (e[n] = i, !1);
|
|
2521
2528
|
}
|
|
2522
|
-
function
|
|
2529
|
+
function qe(e, t) {
|
|
2523
2530
|
var n = e.computed, r = e.key;
|
|
2524
2531
|
return !n && (r.type === "Identifier" && r.name === t || r.type === "Literal" && r.value === t);
|
|
2525
2532
|
}
|
|
2526
|
-
|
|
2533
|
+
z.parseExportAllDeclaration = function(e, t) {
|
|
2527
2534
|
return this.options.ecmaVersion >= 11 && (this.eatContextual("as") ? (e.exported = this.parseModuleExportName(), this.checkExport(t, e.exported, this.lastTokStart)) : e.exported = null), this.expectContextual("from"), this.type !== T.string && this.unexpected(), e.source = this.parseExprAtom(), this.options.ecmaVersion >= 16 && (e.attributes = this.parseWithClause()), this.semicolon(), this.finishNode(e, "ExportAllDeclaration");
|
|
2528
|
-
},
|
|
2535
|
+
}, z.parseExport = function(e, t) {
|
|
2529
2536
|
if (this.next(), this.eat(T.star)) return this.parseExportAllDeclaration(e, t);
|
|
2530
2537
|
if (this.eat(T._default)) return this.checkExport(t, "default", this.lastTokStart), e.declaration = this.parseExportDefaultDeclaration(), this.finishNode(e, "ExportDefaultDeclaration");
|
|
2531
2538
|
if (this.shouldParseExportStatement()) e.declaration = this.parseExportDeclaration(e), e.declaration.type === "VariableDeclaration" ? this.checkVariableExport(t, e.declaration.declarations) : this.checkExport(t, e.declaration.id, e.declaration.id.start), e.specifiers = [], e.source = null, this.options.ecmaVersion >= 16 && (e.attributes = []);
|
|
@@ -2541,13 +2548,13 @@ B.parseExportAllDeclaration = function(e, t) {
|
|
|
2541
2548
|
this.semicolon();
|
|
2542
2549
|
}
|
|
2543
2550
|
return this.finishNode(e, "ExportNamedDeclaration");
|
|
2544
|
-
},
|
|
2551
|
+
}, z.parseExportDeclaration = function(e) {
|
|
2545
2552
|
return this.parseStatement(null);
|
|
2546
|
-
},
|
|
2553
|
+
}, z.parseExportDefaultDeclaration = function() {
|
|
2547
2554
|
var e;
|
|
2548
2555
|
if (this.type === T._function || (e = this.isAsyncFunction())) {
|
|
2549
2556
|
var t = this.startNode();
|
|
2550
|
-
return this.next(), e && this.next(), this.parseFunction(t,
|
|
2557
|
+
return this.next(), e && this.next(), this.parseFunction(t, Ue | Ge, !1, e);
|
|
2551
2558
|
} else if (this.type === T._class) {
|
|
2552
2559
|
var n = this.startNode();
|
|
2553
2560
|
return this.parseClass(n, "nullableID");
|
|
@@ -2555,9 +2562,9 @@ B.parseExportAllDeclaration = function(e, t) {
|
|
|
2555
2562
|
var r = this.parseMaybeAssign();
|
|
2556
2563
|
return this.semicolon(), r;
|
|
2557
2564
|
}
|
|
2558
|
-
},
|
|
2565
|
+
}, z.checkExport = function(e, t, n) {
|
|
2559
2566
|
e && (typeof t != "string" && (t = t.type === "Identifier" ? t.name : t.value), k(e, t) && this.raiseRecoverable(n, "Duplicate export '" + t + "'"), e[t] = !0);
|
|
2560
|
-
},
|
|
2567
|
+
}, z.checkPatternExport = function(e, t) {
|
|
2561
2568
|
var n = t.type;
|
|
2562
2569
|
if (n === "Identifier") this.checkExport(e, t, t.start);
|
|
2563
2570
|
else if (n === "ObjectPattern") for (var r = 0, i = t.properties; r < i.length; r += 1) {
|
|
@@ -2569,17 +2576,17 @@ B.parseExportAllDeclaration = function(e, t) {
|
|
|
2569
2576
|
c && this.checkPatternExport(e, c);
|
|
2570
2577
|
}
|
|
2571
2578
|
else n === "Property" ? this.checkPatternExport(e, t.value) : n === "AssignmentPattern" ? this.checkPatternExport(e, t.left) : n === "RestElement" && this.checkPatternExport(e, t.argument);
|
|
2572
|
-
},
|
|
2579
|
+
}, z.checkVariableExport = function(e, t) {
|
|
2573
2580
|
if (e) for (var n = 0, r = t; n < r.length; n += 1) {
|
|
2574
2581
|
var i = r[n];
|
|
2575
2582
|
this.checkPatternExport(e, i.id);
|
|
2576
2583
|
}
|
|
2577
|
-
},
|
|
2584
|
+
}, z.shouldParseExportStatement = function() {
|
|
2578
2585
|
return this.type.keyword === "var" || this.type.keyword === "const" || this.type.keyword === "class" || this.type.keyword === "function" || this.isLet() || this.isAsyncFunction();
|
|
2579
|
-
},
|
|
2586
|
+
}, z.parseExportSpecifier = function(e) {
|
|
2580
2587
|
var t = this.startNode();
|
|
2581
2588
|
return t.local = this.parseModuleExportName(), t.exported = this.eatContextual("as") ? this.parseModuleExportName() : t.local, this.checkExport(e, t.exported, t.exported.start), this.finishNode(t, "ExportSpecifier");
|
|
2582
|
-
},
|
|
2589
|
+
}, z.parseExportSpecifiers = function(e) {
|
|
2583
2590
|
var t = [], n = !0;
|
|
2584
2591
|
for (this.expect(T.braceL); !this.eat(T.braceR);) {
|
|
2585
2592
|
if (n) n = !1;
|
|
@@ -2587,18 +2594,18 @@ B.parseExportAllDeclaration = function(e, t) {
|
|
|
2587
2594
|
t.push(this.parseExportSpecifier(e));
|
|
2588
2595
|
}
|
|
2589
2596
|
return t;
|
|
2590
|
-
},
|
|
2591
|
-
return this.next(), this.type === T.string ? (e.specifiers =
|
|
2592
|
-
},
|
|
2597
|
+
}, z.parseImport = function(e) {
|
|
2598
|
+
return this.next(), this.type === T.string ? (e.specifiers = He, e.source = this.parseExprAtom()) : (e.specifiers = this.parseImportSpecifiers(), this.expectContextual("from"), e.source = this.type === T.string ? this.parseExprAtom() : this.unexpected()), this.options.ecmaVersion >= 16 && (e.attributes = this.parseWithClause()), this.semicolon(), this.finishNode(e, "ImportDeclaration");
|
|
2599
|
+
}, z.parseImportSpecifier = function() {
|
|
2593
2600
|
var e = this.startNode();
|
|
2594
|
-
return e.imported = this.parseModuleExportName(), this.eatContextual("as") ? e.local = this.parseIdent() : (this.checkUnreserved(e.imported), e.local = e.imported), this.checkLValSimple(e.local,
|
|
2595
|
-
},
|
|
2601
|
+
return e.imported = this.parseModuleExportName(), this.eatContextual("as") ? e.local = this.parseIdent() : (this.checkUnreserved(e.imported), e.local = e.imported), this.checkLValSimple(e.local, F), this.finishNode(e, "ImportSpecifier");
|
|
2602
|
+
}, z.parseImportDefaultSpecifier = function() {
|
|
2596
2603
|
var e = this.startNode();
|
|
2597
|
-
return e.local = this.parseIdent(), this.checkLValSimple(e.local,
|
|
2598
|
-
},
|
|
2604
|
+
return e.local = this.parseIdent(), this.checkLValSimple(e.local, F), this.finishNode(e, "ImportDefaultSpecifier");
|
|
2605
|
+
}, z.parseImportNamespaceSpecifier = function() {
|
|
2599
2606
|
var e = this.startNode();
|
|
2600
|
-
return this.next(), this.expectContextual("as"), e.local = this.parseIdent(), this.checkLValSimple(e.local,
|
|
2601
|
-
},
|
|
2607
|
+
return this.next(), this.expectContextual("as"), e.local = this.parseIdent(), this.checkLValSimple(e.local, F), this.finishNode(e, "ImportNamespaceSpecifier");
|
|
2608
|
+
}, z.parseImportSpecifiers = function() {
|
|
2602
2609
|
var e = [], t = !0;
|
|
2603
2610
|
if (this.type === T.name && (e.push(this.parseImportDefaultSpecifier()), !this.eat(T.comma))) return e;
|
|
2604
2611
|
if (this.type === T.star) return e.push(this.parseImportNamespaceSpecifier()), e;
|
|
@@ -2608,7 +2615,7 @@ B.parseExportAllDeclaration = function(e, t) {
|
|
|
2608
2615
|
e.push(this.parseImportSpecifier());
|
|
2609
2616
|
}
|
|
2610
2617
|
return e;
|
|
2611
|
-
},
|
|
2618
|
+
}, z.parseWithClause = function() {
|
|
2612
2619
|
var e = [];
|
|
2613
2620
|
if (!this.eat(T._with)) return e;
|
|
2614
2621
|
this.expect(T.braceL);
|
|
@@ -2619,22 +2626,22 @@ B.parseExportAllDeclaration = function(e, t) {
|
|
|
2619
2626
|
k(t, i) && this.raiseRecoverable(r.key.start, "Duplicate attribute key '" + i + "'"), t[i] = !0, e.push(r);
|
|
2620
2627
|
}
|
|
2621
2628
|
return e;
|
|
2622
|
-
},
|
|
2629
|
+
}, z.parseImportAttribute = function() {
|
|
2623
2630
|
var e = this.startNode();
|
|
2624
2631
|
return e.key = this.type === T.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never"), this.expect(T.colon), this.type !== T.string && this.unexpected(), e.value = this.parseExprAtom(), this.finishNode(e, "ImportAttribute");
|
|
2625
|
-
},
|
|
2632
|
+
}, z.parseModuleExportName = function() {
|
|
2626
2633
|
if (this.options.ecmaVersion >= 13 && this.type === T.string) {
|
|
2627
2634
|
var e = this.parseLiteral(this.value);
|
|
2628
2635
|
return he.test(e.value) && this.raise(e.start, "An export name cannot include a lone surrogate."), e;
|
|
2629
2636
|
}
|
|
2630
2637
|
return this.parseIdent(!0);
|
|
2631
|
-
},
|
|
2638
|
+
}, z.adaptDirectivePrologue = function(e) {
|
|
2632
2639
|
for (var t = 0; t < e.length && this.isDirectiveCandidate(e[t]); ++t) e[t].directive = e[t].expression.raw.slice(1, -1);
|
|
2633
|
-
},
|
|
2640
|
+
}, z.isDirectiveCandidate = function(e) {
|
|
2634
2641
|
return this.options.ecmaVersion >= 5 && e.type === "ExpressionStatement" && e.expression.type === "Literal" && typeof e.expression.value == "string" && (this.input[e.start] === "\"" || this.input[e.start] === "'");
|
|
2635
2642
|
};
|
|
2636
|
-
var
|
|
2637
|
-
|
|
2643
|
+
var B = I.prototype;
|
|
2644
|
+
B.toAssignable = function(e, t, n) {
|
|
2638
2645
|
if (this.options.ecmaVersion >= 6 && e) switch (e.type) {
|
|
2639
2646
|
case "Identifier":
|
|
2640
2647
|
this.inAsync && e.name === "await" && this.raise(e.start, "Cannot use 'await' as identifier inside an async function");
|
|
@@ -2673,7 +2680,7 @@ V.toAssignable = function(e, t, n) {
|
|
|
2673
2680
|
}
|
|
2674
2681
|
else n && this.checkPatternErrors(n, !0);
|
|
2675
2682
|
return e;
|
|
2676
|
-
},
|
|
2683
|
+
}, B.toAssignableList = function(e, t) {
|
|
2677
2684
|
for (var n = e.length, r = 0; r < n; r++) {
|
|
2678
2685
|
var i = e[r];
|
|
2679
2686
|
i && this.toAssignable(i, t);
|
|
@@ -2683,13 +2690,13 @@ V.toAssignable = function(e, t, n) {
|
|
|
2683
2690
|
this.options.ecmaVersion === 6 && t && a && a.type === "RestElement" && a.argument.type !== "Identifier" && this.unexpected(a.argument.start);
|
|
2684
2691
|
}
|
|
2685
2692
|
return e;
|
|
2686
|
-
},
|
|
2693
|
+
}, B.parseSpread = function(e) {
|
|
2687
2694
|
var t = this.startNode();
|
|
2688
2695
|
return this.next(), t.argument = this.parseMaybeAssign(!1, e), this.finishNode(t, "SpreadElement");
|
|
2689
|
-
},
|
|
2696
|
+
}, B.parseRestBinding = function() {
|
|
2690
2697
|
var e = this.startNode();
|
|
2691
2698
|
return this.next(), this.options.ecmaVersion === 6 && this.type !== T.name && this.unexpected(), e.argument = this.parseBindingAtom(), this.finishNode(e, "RestElement");
|
|
2692
|
-
},
|
|
2699
|
+
}, B.parseBindingAtom = function() {
|
|
2693
2700
|
if (this.options.ecmaVersion >= 6) switch (this.type) {
|
|
2694
2701
|
case T.bracketL:
|
|
2695
2702
|
var e = this.startNode();
|
|
@@ -2697,7 +2704,7 @@ V.toAssignable = function(e, t, n) {
|
|
|
2697
2704
|
case T.braceL: return this.parseObj(!0);
|
|
2698
2705
|
}
|
|
2699
2706
|
return this.parseIdent();
|
|
2700
|
-
},
|
|
2707
|
+
}, B.parseBindingList = function(e, t, n, r) {
|
|
2701
2708
|
for (var i = [], a = !0; !this.eat(e);) if (a ? a = !1 : this.expect(T.comma), t && this.type === T.comma) i.push(null);
|
|
2702
2709
|
else if (n && this.afterTrailingComma(e)) break;
|
|
2703
2710
|
else if (this.type === T.ellipsis) {
|
|
@@ -2706,21 +2713,21 @@ V.toAssignable = function(e, t, n) {
|
|
|
2706
2713
|
break;
|
|
2707
2714
|
} else i.push(this.parseAssignableListItem(r));
|
|
2708
2715
|
return i;
|
|
2709
|
-
},
|
|
2716
|
+
}, B.parseAssignableListItem = function(e) {
|
|
2710
2717
|
var t = this.parseMaybeDefault(this.start, this.startLoc);
|
|
2711
2718
|
return this.parseBindingListItem(t), t;
|
|
2712
|
-
},
|
|
2719
|
+
}, B.parseBindingListItem = function(e) {
|
|
2713
2720
|
return e;
|
|
2714
|
-
},
|
|
2721
|
+
}, B.parseMaybeDefault = function(e, t, n) {
|
|
2715
2722
|
if (n ||= this.parseBindingAtom(), this.options.ecmaVersion < 6 || !this.eat(T.eq)) return n;
|
|
2716
2723
|
var r = this.startNodeAt(e, t);
|
|
2717
2724
|
return r.left = n, r.right = this.parseMaybeAssign(), this.finishNode(r, "AssignmentPattern");
|
|
2718
|
-
},
|
|
2719
|
-
t === void 0 && (t =
|
|
2720
|
-
var r = t !==
|
|
2725
|
+
}, B.checkLValSimple = function(e, t, n) {
|
|
2726
|
+
t === void 0 && (t = Ne);
|
|
2727
|
+
var r = t !== Ne;
|
|
2721
2728
|
switch (e.type) {
|
|
2722
2729
|
case "Identifier":
|
|
2723
|
-
this.strict && this.reservedWordsStrictBind.test(e.name) && this.raiseRecoverable(e.start, (r ? "Binding " : "Assigning to ") + e.name + " in strict mode"), r && (t ===
|
|
2730
|
+
this.strict && this.reservedWordsStrictBind.test(e.name) && this.raiseRecoverable(e.start, (r ? "Binding " : "Assigning to ") + e.name + " in strict mode"), r && (t === F && e.name === "let" && this.raiseRecoverable(e.start, "let is disallowed as a lexically bound name"), n && (k(n, e.name) && this.raiseRecoverable(e.start, "Argument name clash"), n[e.name] = !0), t !== Le && this.declareName(e.name, t, e.start));
|
|
2724
2731
|
break;
|
|
2725
2732
|
case "ChainExpression":
|
|
2726
2733
|
this.raiseRecoverable(e.start, "Optional chaining cannot appear in left-hand side");
|
|
@@ -2731,8 +2738,8 @@ V.toAssignable = function(e, t, n) {
|
|
|
2731
2738
|
case "ParenthesizedExpression": return r && this.raiseRecoverable(e.start, "Binding parenthesized expression"), this.checkLValSimple(e.expression, t, n);
|
|
2732
2739
|
default: this.raise(e.start, (r ? "Binding" : "Assigning to") + " rvalue");
|
|
2733
2740
|
}
|
|
2734
|
-
},
|
|
2735
|
-
switch (t === void 0 && (t =
|
|
2741
|
+
}, B.checkLValPattern = function(e, t, n) {
|
|
2742
|
+
switch (t === void 0 && (t = Ne), e.type) {
|
|
2736
2743
|
case "ObjectPattern":
|
|
2737
2744
|
for (var r = 0, i = e.properties; r < i.length; r += 1) {
|
|
2738
2745
|
var a = i[r];
|
|
@@ -2747,8 +2754,8 @@ V.toAssignable = function(e, t, n) {
|
|
|
2747
2754
|
break;
|
|
2748
2755
|
default: this.checkLValSimple(e, t, n);
|
|
2749
2756
|
}
|
|
2750
|
-
},
|
|
2751
|
-
switch (t === void 0 && (t =
|
|
2757
|
+
}, B.checkLValInnerPattern = function(e, t, n) {
|
|
2758
|
+
switch (t === void 0 && (t = Ne), e.type) {
|
|
2752
2759
|
case "Property":
|
|
2753
2760
|
this.checkLValInnerPattern(e.value, t, n);
|
|
2754
2761
|
break;
|
|
@@ -2761,39 +2768,39 @@ V.toAssignable = function(e, t, n) {
|
|
|
2761
2768
|
default: this.checkLValPattern(e, t, n);
|
|
2762
2769
|
}
|
|
2763
2770
|
};
|
|
2764
|
-
var
|
|
2771
|
+
var V = function(e, t, n, r, i) {
|
|
2765
2772
|
this.token = e, this.isExpr = !!t, this.preserveSpace = !!n, this.override = r, this.generator = !!i;
|
|
2766
|
-
},
|
|
2767
|
-
b_stat: new
|
|
2768
|
-
b_expr: new
|
|
2769
|
-
b_tmpl: new
|
|
2770
|
-
p_stat: new
|
|
2771
|
-
p_expr: new
|
|
2772
|
-
q_tmpl: new
|
|
2773
|
+
}, H = {
|
|
2774
|
+
b_stat: new V("{", !1),
|
|
2775
|
+
b_expr: new V("{", !0),
|
|
2776
|
+
b_tmpl: new V("${", !1),
|
|
2777
|
+
p_stat: new V("(", !1),
|
|
2778
|
+
p_expr: new V("(", !0),
|
|
2779
|
+
q_tmpl: new V("`", !0, !0, function(e) {
|
|
2773
2780
|
return e.tryReadTemplateToken();
|
|
2774
2781
|
}),
|
|
2775
|
-
f_stat: new
|
|
2776
|
-
f_expr: new
|
|
2777
|
-
f_expr_gen: new
|
|
2778
|
-
f_gen: new
|
|
2779
|
-
},
|
|
2780
|
-
|
|
2781
|
-
return [
|
|
2782
|
-
},
|
|
2782
|
+
f_stat: new V("function", !1),
|
|
2783
|
+
f_expr: new V("function", !0),
|
|
2784
|
+
f_expr_gen: new V("function", !0, !1, null, !0),
|
|
2785
|
+
f_gen: new V("function", !1, !1, null, !0)
|
|
2786
|
+
}, U = I.prototype;
|
|
2787
|
+
U.initialContext = function() {
|
|
2788
|
+
return [H.b_stat];
|
|
2789
|
+
}, U.curContext = function() {
|
|
2783
2790
|
return this.context[this.context.length - 1];
|
|
2784
|
-
},
|
|
2791
|
+
}, U.braceIsBlock = function(e) {
|
|
2785
2792
|
var t = this.curContext();
|
|
2786
|
-
return t ===
|
|
2787
|
-
},
|
|
2793
|
+
return t === H.f_expr || t === H.f_stat ? !0 : e === T.colon && (t === H.b_stat || t === H.b_expr) ? !t.isExpr : e === T._return || e === T.name && this.exprAllowed ? E.test(this.input.slice(this.lastTokEnd, this.start)) : e === T._else || e === T.semi || e === T.eof || e === T.parenR || e === T.arrow ? !0 : e === T.braceL ? t === H.b_stat : e === T._var || e === T._const || e === T.name ? !1 : !this.exprAllowed;
|
|
2794
|
+
}, U.inGeneratorContext = function() {
|
|
2788
2795
|
for (var e = this.context.length - 1; e >= 1; e--) {
|
|
2789
2796
|
var t = this.context[e];
|
|
2790
2797
|
if (t.token === "function") return t.generator;
|
|
2791
2798
|
}
|
|
2792
2799
|
return !1;
|
|
2793
|
-
},
|
|
2800
|
+
}, U.updateContext = function(e) {
|
|
2794
2801
|
var t, n = this.type;
|
|
2795
2802
|
n.keyword && e === T.dot ? this.exprAllowed = !1 : (t = n.updateContext) ? t.call(this, e) : this.exprAllowed = n.beforeExpr;
|
|
2796
|
-
},
|
|
2803
|
+
}, U.overrideContext = function(e) {
|
|
2797
2804
|
this.curContext() !== e && (this.context[this.context.length - 1] = e);
|
|
2798
2805
|
}, T.parenR.updateContext = T.braceR.updateContext = function() {
|
|
2799
2806
|
if (this.context.length === 1) {
|
|
@@ -2801,32 +2808,32 @@ W.initialContext = function() {
|
|
|
2801
2808
|
return;
|
|
2802
2809
|
}
|
|
2803
2810
|
var e = this.context.pop();
|
|
2804
|
-
e ===
|
|
2811
|
+
e === H.b_stat && this.curContext().token === "function" && (e = this.context.pop()), this.exprAllowed = !e.isExpr;
|
|
2805
2812
|
}, T.braceL.updateContext = function(e) {
|
|
2806
|
-
this.context.push(this.braceIsBlock(e) ?
|
|
2813
|
+
this.context.push(this.braceIsBlock(e) ? H.b_stat : H.b_expr), this.exprAllowed = !0;
|
|
2807
2814
|
}, T.dollarBraceL.updateContext = function() {
|
|
2808
|
-
this.context.push(
|
|
2815
|
+
this.context.push(H.b_tmpl), this.exprAllowed = !0;
|
|
2809
2816
|
}, T.parenL.updateContext = function(e) {
|
|
2810
2817
|
var t = e === T._if || e === T._for || e === T._with || e === T._while;
|
|
2811
|
-
this.context.push(t ?
|
|
2818
|
+
this.context.push(t ? H.p_stat : H.p_expr), this.exprAllowed = !0;
|
|
2812
2819
|
}, T.incDec.updateContext = function() {}, T._function.updateContext = T._class.updateContext = function(e) {
|
|
2813
|
-
e.beforeExpr && e !== T._else && !(e === T.semi && this.curContext() !==
|
|
2820
|
+
e.beforeExpr && e !== T._else && !(e === T.semi && this.curContext() !== H.p_stat) && !(e === T._return && E.test(this.input.slice(this.lastTokEnd, this.start))) && !((e === T.colon || e === T.braceL) && this.curContext() === H.b_stat) ? this.context.push(H.f_expr) : this.context.push(H.f_stat), this.exprAllowed = !1;
|
|
2814
2821
|
}, T.colon.updateContext = function() {
|
|
2815
2822
|
this.curContext().token === "function" && this.context.pop(), this.exprAllowed = !0;
|
|
2816
2823
|
}, T.backQuote.updateContext = function() {
|
|
2817
|
-
this.curContext() ===
|
|
2824
|
+
this.curContext() === H.q_tmpl ? this.context.pop() : this.context.push(H.q_tmpl), this.exprAllowed = !1;
|
|
2818
2825
|
}, T.star.updateContext = function(e) {
|
|
2819
2826
|
if (e === T._function) {
|
|
2820
2827
|
var t = this.context.length - 1;
|
|
2821
|
-
this.context[t] ===
|
|
2828
|
+
this.context[t] === H.f_expr ? this.context[t] = H.f_expr_gen : this.context[t] = H.f_gen;
|
|
2822
2829
|
}
|
|
2823
2830
|
this.exprAllowed = !0;
|
|
2824
2831
|
}, T.name.updateContext = function(e) {
|
|
2825
2832
|
var t = !1;
|
|
2826
2833
|
this.options.ecmaVersion >= 6 && e !== T.dot && (this.value === "of" && !this.exprAllowed || this.value === "yield" && this.inGeneratorContext()) && (t = !0), this.exprAllowed = t;
|
|
2827
2834
|
};
|
|
2828
|
-
var
|
|
2829
|
-
|
|
2835
|
+
var W = I.prototype;
|
|
2836
|
+
W.checkPropClash = function(e, t, n) {
|
|
2830
2837
|
if (!(this.options.ecmaVersion >= 9 && e.type === "SpreadElement") && !(this.options.ecmaVersion >= 6 && (e.computed || e.method || e.shorthand))) {
|
|
2831
2838
|
var r = e.key, i;
|
|
2832
2839
|
switch (r.type) {
|
|
@@ -2851,7 +2858,7 @@ G.checkPropClash = function(e, t, n) {
|
|
|
2851
2858
|
set: !1
|
|
2852
2859
|
}, o[a] = !0;
|
|
2853
2860
|
}
|
|
2854
|
-
},
|
|
2861
|
+
}, W.parseExpression = function(e, t) {
|
|
2855
2862
|
var n = this;
|
|
2856
2863
|
return this.catchStackOverflow(function() {
|
|
2857
2864
|
var r = n.start, i = n.startLoc, a = n.parseMaybeAssign(e, t);
|
|
@@ -2862,13 +2869,13 @@ G.checkPropClash = function(e, t, n) {
|
|
|
2862
2869
|
}
|
|
2863
2870
|
return a;
|
|
2864
2871
|
});
|
|
2865
|
-
},
|
|
2872
|
+
}, W.parseMaybeAssign = function(e, t, n) {
|
|
2866
2873
|
if (this.isContextual("yield")) {
|
|
2867
2874
|
if (this.inGenerator) return this.parseYield(e);
|
|
2868
2875
|
this.exprAllowed = !1;
|
|
2869
2876
|
}
|
|
2870
2877
|
var r = !1, i = -1, a = -1, o = -1;
|
|
2871
|
-
t ? (i = t.parenthesizedAssign, a = t.trailingComma, o = t.doubleProto, t.parenthesizedAssign = t.trailingComma = -1) : (t = new
|
|
2878
|
+
t ? (i = t.parenthesizedAssign, a = t.trailingComma, o = t.doubleProto, t.parenthesizedAssign = t.trailingComma = -1) : (t = new ze(), r = !0);
|
|
2872
2879
|
var s = this.start, c = this.startLoc;
|
|
2873
2880
|
(this.type === T.parenL || this.type === T.name) && (this.potentialArrowAt = this.start, this.potentialArrowInForAwait = e === "await");
|
|
2874
2881
|
var l = this.parseMaybeConditional(e, t);
|
|
@@ -2877,7 +2884,7 @@ G.checkPropClash = function(e, t, n) {
|
|
|
2877
2884
|
return u.operator = this.value, this.type === T.eq && (l = this.toAssignable(l, !1, t)), r || (t.parenthesizedAssign = t.trailingComma = t.doubleProto = -1), t.shorthandAssign >= l.start && (t.shorthandAssign = -1), this.type === T.eq ? this.checkLValPattern(l) : this.checkLValSimple(l), u.left = l, this.next(), u.right = this.parseMaybeAssign(e), o > -1 && (t.doubleProto = o), this.finishNode(u, "AssignmentExpression");
|
|
2878
2885
|
} else r && this.checkExpressionErrors(t, !0);
|
|
2879
2886
|
return i > -1 && (t.parenthesizedAssign = i), a > -1 && (t.trailingComma = a), l;
|
|
2880
|
-
},
|
|
2887
|
+
}, W.parseMaybeConditional = function(e, t) {
|
|
2881
2888
|
var n = this.start, r = this.startLoc, i = this.parseExprOps(e, t);
|
|
2882
2889
|
if (this.checkExpressionErrors(t)) return i;
|
|
2883
2890
|
if (!(i.type === "ArrowFunctionExpression" && i.start === n) && this.eat(T.question)) {
|
|
@@ -2885,10 +2892,10 @@ G.checkPropClash = function(e, t, n) {
|
|
|
2885
2892
|
return a.test = i, a.consequent = this.parseMaybeAssign(), this.expect(T.colon), a.alternate = this.parseMaybeAssign(e), this.finishNode(a, "ConditionalExpression");
|
|
2886
2893
|
}
|
|
2887
2894
|
return i;
|
|
2888
|
-
},
|
|
2895
|
+
}, W.parseExprOps = function(e, t) {
|
|
2889
2896
|
var n = this.start, r = this.startLoc, i = this.parseMaybeUnary(t, !1, !1, e);
|
|
2890
2897
|
return this.checkExpressionErrors(t) || i.start === n && i.type === "ArrowFunctionExpression" ? i : this.parseExprOp(i, n, r, -1, e);
|
|
2891
|
-
},
|
|
2898
|
+
}, W.parseExprOp = function(e, t, n, r, i) {
|
|
2892
2899
|
var a = this.type.binop;
|
|
2893
2900
|
if (a != null && (!i || this.type !== T._in) && a > r) {
|
|
2894
2901
|
var o = this.type === T.logicalOR || this.type === T.logicalAND, s = this.type === T.coalesce;
|
|
@@ -2899,16 +2906,16 @@ G.checkPropClash = function(e, t, n) {
|
|
|
2899
2906
|
return (o && this.type === T.coalesce || s && (this.type === T.logicalOR || this.type === T.logicalAND)) && this.raiseRecoverable(this.start, "Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"), this.parseExprOp(f, t, n, r, i);
|
|
2900
2907
|
}
|
|
2901
2908
|
return e;
|
|
2902
|
-
},
|
|
2909
|
+
}, W.buildBinary = function(e, t, n, r, i, a) {
|
|
2903
2910
|
r.type === "PrivateIdentifier" && this.raise(r.start, "Private identifier can only be left side of binary expression");
|
|
2904
2911
|
var o = this.startNodeAt(e, t);
|
|
2905
2912
|
return o.left = n, o.operator = i, o.right = r, this.finishNode(o, a ? "LogicalExpression" : "BinaryExpression");
|
|
2906
|
-
},
|
|
2913
|
+
}, W.parseMaybeUnary = function(e, t, n, r) {
|
|
2907
2914
|
var i = this.start, a = this.startLoc, o;
|
|
2908
2915
|
if (this.isContextual("await") && this.canAwait) o = this.parseAwait(r), t = !0;
|
|
2909
2916
|
else if (this.type.prefix) {
|
|
2910
2917
|
var s = this.startNode(), c = this.type === T.incDec;
|
|
2911
|
-
s.operator = this.value, s.prefix = !0, this.next(), s.argument = this.parseMaybeUnary(null, !0, c, r), this.checkExpressionErrors(e, !0), c ? this.checkLValSimple(s.argument) : this.strict && s.operator === "delete" &&
|
|
2918
|
+
s.operator = this.value, s.prefix = !0, this.next(), s.argument = this.parseMaybeUnary(null, !0, c, r), this.checkExpressionErrors(e, !0), c ? this.checkLValSimple(s.argument) : this.strict && s.operator === "delete" && Je(s.argument) ? this.raiseRecoverable(s.start, "Deleting local variable in strict mode") : s.operator === "delete" && Ye(s.argument) ? this.raiseRecoverable(s.start, "Private fields can not be deleted") : t = !0, o = this.finishNode(s, c ? "UpdateExpression" : "UnaryExpression");
|
|
2912
2919
|
} else if (!t && this.type === T.privateId) (r || this.privateNameStack.length === 0) && this.options.checkPrivateFields && this.unexpected(), o = this.parsePrivateIdent(), this.type !== T._in && this.unexpected();
|
|
2913
2920
|
else {
|
|
2914
2921
|
if (o = this.parseExprSubscripts(e, r), this.checkExpressionErrors(e)) return o;
|
|
@@ -2921,18 +2928,18 @@ G.checkPropClash = function(e, t, n) {
|
|
|
2921
2928
|
else return this.buildBinary(i, a, o, this.parseMaybeUnary(null, !1, !1, r), "**", !1);
|
|
2922
2929
|
else return o;
|
|
2923
2930
|
};
|
|
2924
|
-
function qe(e) {
|
|
2925
|
-
return e.type === "Identifier" || e.type === "ParenthesizedExpression" && qe(e.expression);
|
|
2926
|
-
}
|
|
2927
2931
|
function Je(e) {
|
|
2928
|
-
return e.type === "
|
|
2932
|
+
return e.type === "Identifier" || e.type === "ParenthesizedExpression" && Je(e.expression);
|
|
2933
|
+
}
|
|
2934
|
+
function Ye(e) {
|
|
2935
|
+
return e.type === "MemberExpression" && e.property.type === "PrivateIdentifier" || e.type === "ChainExpression" && Ye(e.expression) || e.type === "ParenthesizedExpression" && Ye(e.expression);
|
|
2929
2936
|
}
|
|
2930
|
-
|
|
2937
|
+
W.parseExprSubscripts = function(e, t) {
|
|
2931
2938
|
var n = this.start, r = this.startLoc, i = this.parseExprAtom(e, t);
|
|
2932
2939
|
if (i.type === "ArrowFunctionExpression" && this.input.slice(this.lastTokStart, this.lastTokEnd) !== ")") return i;
|
|
2933
2940
|
var a = this.parseSubscripts(i, n, r, !1, t);
|
|
2934
2941
|
return e && a.type === "MemberExpression" && (e.parenthesizedAssign >= a.start && (e.parenthesizedAssign = -1), e.parenthesizedBind >= a.start && (e.parenthesizedBind = -1), e.trailingComma >= a.start && (e.trailingComma = -1)), a;
|
|
2935
|
-
},
|
|
2942
|
+
}, W.parseSubscripts = function(e, t, n, r, i) {
|
|
2936
2943
|
for (var a = this.options.ecmaVersion >= 8 && e.type === "Identifier" && e.name === "async" && this.lastTokEnd === e.end && !this.canInsertSemicolon() && e.end - e.start === 5 && this.potentialArrowAt === e.start, o = !1;;) {
|
|
2937
2944
|
var s = this.parseSubscript(e, t, n, r, a, o, i);
|
|
2938
2945
|
if (s.optional && (o = !0), s === e || s.type === "ArrowFunctionExpression") {
|
|
@@ -2944,11 +2951,11 @@ G.parseExprSubscripts = function(e, t) {
|
|
|
2944
2951
|
}
|
|
2945
2952
|
e = s;
|
|
2946
2953
|
}
|
|
2947
|
-
},
|
|
2954
|
+
}, W.shouldParseAsyncArrow = function() {
|
|
2948
2955
|
return !this.canInsertSemicolon() && this.eat(T.arrow);
|
|
2949
|
-
},
|
|
2956
|
+
}, W.parseSubscriptAsyncArrow = function(e, t, n, r) {
|
|
2950
2957
|
return this.parseArrowExpression(this.startNodeAt(e, t), n, !0, r);
|
|
2951
|
-
},
|
|
2958
|
+
}, W.parseSubscript = function(e, t, n, r, i, a, o) {
|
|
2952
2959
|
var s = this.options.ecmaVersion >= 11, c = s && this.eat(T.questionDot);
|
|
2953
2960
|
r && c && this.raise(this.lastTokStart, "Optional chaining cannot appear in the callee of new expressions");
|
|
2954
2961
|
var l = this.eat(T.bracketL);
|
|
@@ -2956,7 +2963,7 @@ G.parseExprSubscripts = function(e, t) {
|
|
|
2956
2963
|
var u = this.startNodeAt(t, n);
|
|
2957
2964
|
u.object = e, l ? (u.property = this.parseExpression(), this.expect(T.bracketR)) : this.type === T.privateId && e.type !== "Super" ? u.property = this.parsePrivateIdent() : u.property = this.parseIdent(this.options.allowReserved !== "never"), u.computed = !!l, s && (u.optional = c), e = this.finishNode(u, "MemberExpression");
|
|
2958
2965
|
} else if (!r && this.eat(T.parenL)) {
|
|
2959
|
-
var d = new
|
|
2966
|
+
var d = new ze(), f = this.yieldPos, p = this.awaitPos, m = this.awaitIdentPos;
|
|
2960
2967
|
this.yieldPos = 0, this.awaitPos = 0, this.awaitIdentPos = 0;
|
|
2961
2968
|
var h = this.parseExprList(T.parenR, this.options.ecmaVersion >= 8, !1, d);
|
|
2962
2969
|
if (i && !c && this.shouldParseAsyncArrow()) return this.checkPatternErrors(d, !1), this.checkYieldAwaitInDefaultParams(), this.awaitIdentPos > 0 && this.raise(this.awaitIdentPos, "Cannot use 'await' as identifier inside an async function"), this.yieldPos = f, this.awaitPos = p, this.awaitIdentPos = m, this.parseSubscriptAsyncArrow(t, n, h, o);
|
|
@@ -2969,7 +2976,7 @@ G.parseExprSubscripts = function(e, t) {
|
|
|
2969
2976
|
_.tag = e, _.quasi = this.parseTemplate({ isTagged: !0 }), e = this.finishNode(_, "TaggedTemplateExpression");
|
|
2970
2977
|
}
|
|
2971
2978
|
return e;
|
|
2972
|
-
},
|
|
2979
|
+
}, W.parseExprAtom = function(e, t, n) {
|
|
2973
2980
|
this.type === T.slash && this.readRegexp();
|
|
2974
2981
|
var r, i = this.potentialArrowAt === this.start;
|
|
2975
2982
|
switch (this.type) {
|
|
@@ -2977,7 +2984,7 @@ G.parseExprSubscripts = function(e, t) {
|
|
|
2977
2984
|
case T._this: return r = this.startNode(), this.next(), this.finishNode(r, "ThisExpression");
|
|
2978
2985
|
case T.name:
|
|
2979
2986
|
var a = this.start, o = this.startLoc, s = this.containsEsc, c = this.parseIdent(!1);
|
|
2980
|
-
if (this.options.ecmaVersion >= 8 && !s && c.name === "async" && !this.canInsertSemicolon() && this.eat(T._function)) return this.overrideContext(
|
|
2987
|
+
if (this.options.ecmaVersion >= 8 && !s && c.name === "async" && !this.canInsertSemicolon() && this.eat(T._function)) return this.overrideContext(H.f_expr), this.parseFunction(this.startNodeAt(a, o), 0, !1, !0, t);
|
|
2981
2988
|
if (i && !this.canInsertSemicolon()) {
|
|
2982
2989
|
if (this.eat(T.arrow)) return this.parseArrowExpression(this.startNodeAt(a, o), [c], !1, t);
|
|
2983
2990
|
if (this.options.ecmaVersion >= 8 && c.name === "async" && this.type === T.name && !s && (!this.potentialArrowInForAwait || this.value !== "of" || this.containsEsc)) return c = this.parseIdent(!1), (this.canInsertSemicolon() || !this.eat(T.arrow)) && this.unexpected(), this.parseArrowExpression(this.startNodeAt(a, o), [c], !0, t);
|
|
@@ -2998,7 +3005,7 @@ G.parseExprSubscripts = function(e, t) {
|
|
|
2998
3005
|
var u = this.start, d = this.parseParenAndDistinguishExpression(i, t);
|
|
2999
3006
|
return e && (e.parenthesizedAssign < 0 && !this.isSimpleAssignTarget(d) && (e.parenthesizedAssign = u), e.parenthesizedBind < 0 && (e.parenthesizedBind = u)), d;
|
|
3000
3007
|
case T.bracketL: return r = this.startNode(), this.next(), r.elements = this.parseExprList(T.bracketR, !0, !0, e), this.finishNode(r, "ArrayExpression");
|
|
3001
|
-
case T.braceL: return this.overrideContext(
|
|
3008
|
+
case T.braceL: return this.overrideContext(H.b_expr), this.parseObj(!1, e);
|
|
3002
3009
|
case T._function: return r = this.startNode(), this.next(), this.parseFunction(r, 0);
|
|
3003
3010
|
case T._class: return this.parseClass(this.startNode(), !1);
|
|
3004
3011
|
case T._new: return this.parseNew();
|
|
@@ -3006,40 +3013,40 @@ G.parseExprSubscripts = function(e, t) {
|
|
|
3006
3013
|
case T._import: return this.options.ecmaVersion >= 11 ? this.parseExprImport(n) : this.unexpected();
|
|
3007
3014
|
default: return this.parseExprAtomDefault();
|
|
3008
3015
|
}
|
|
3009
|
-
},
|
|
3016
|
+
}, W.parseExprAtomDefault = function() {
|
|
3010
3017
|
this.unexpected();
|
|
3011
|
-
},
|
|
3018
|
+
}, W.parseExprImport = function(e) {
|
|
3012
3019
|
var t = this.startNode();
|
|
3013
3020
|
if (this.containsEsc && this.raiseRecoverable(this.start, "Escape sequence in keyword import"), this.next(), this.type === T.parenL && !e) return this.parseDynamicImport(t);
|
|
3014
3021
|
if (this.type === T.dot) {
|
|
3015
3022
|
var n = this.startNodeAt(t.start, t.loc && t.loc.start);
|
|
3016
3023
|
return n.name = "import", t.meta = this.finishNode(n, "Identifier"), this.parseImportMeta(t);
|
|
3017
3024
|
} else this.unexpected();
|
|
3018
|
-
},
|
|
3025
|
+
}, W.parseDynamicImport = function(e) {
|
|
3019
3026
|
if (this.next(), e.source = this.parseMaybeAssign(), this.options.ecmaVersion >= 16) this.eat(T.parenR) ? e.options = null : (this.expect(T.comma), this.afterTrailingComma(T.parenR) ? e.options = null : (e.options = this.parseMaybeAssign(), this.eat(T.parenR) || (this.expect(T.comma), this.afterTrailingComma(T.parenR) || this.unexpected())));
|
|
3020
3027
|
else if (!this.eat(T.parenR)) {
|
|
3021
3028
|
var t = this.start;
|
|
3022
3029
|
this.eat(T.comma) && this.eat(T.parenR) ? this.raiseRecoverable(t, "Trailing comma is not allowed in import()") : this.unexpected(t);
|
|
3023
3030
|
}
|
|
3024
3031
|
return this.finishNode(e, "ImportExpression");
|
|
3025
|
-
},
|
|
3032
|
+
}, W.parseImportMeta = function(e) {
|
|
3026
3033
|
this.next();
|
|
3027
3034
|
var t = this.containsEsc;
|
|
3028
3035
|
return e.property = this.parseIdent(!0), e.property.name !== "meta" && this.raiseRecoverable(e.property.start, "The only valid meta property for import is 'import.meta'"), t && this.raiseRecoverable(e.start, "'import.meta' must not contain escaped characters"), this.options.sourceType !== "module" && !this.options.allowImportExportEverywhere && this.raiseRecoverable(e.start, "Cannot use 'import.meta' outside a module"), this.finishNode(e, "MetaProperty");
|
|
3029
|
-
},
|
|
3036
|
+
}, W.parseLiteral = function(e) {
|
|
3030
3037
|
var t = this.startNode();
|
|
3031
3038
|
return t.value = e, t.raw = this.input.slice(this.start, this.end), t.raw.charCodeAt(t.raw.length - 1) === 110 && (t.bigint = t.value == null ? t.raw.slice(0, -1).replace(/_/g, "") : t.value.toString()), this.next(), this.finishNode(t, "Literal");
|
|
3032
|
-
},
|
|
3039
|
+
}, W.parseParenExpression = function() {
|
|
3033
3040
|
this.expect(T.parenL);
|
|
3034
3041
|
var e = this.parseExpression();
|
|
3035
3042
|
return this.expect(T.parenR), e;
|
|
3036
|
-
},
|
|
3043
|
+
}, W.shouldParseArrow = function(e) {
|
|
3037
3044
|
return !this.canInsertSemicolon();
|
|
3038
|
-
},
|
|
3045
|
+
}, W.parseParenAndDistinguishExpression = function(e, t) {
|
|
3039
3046
|
var n = this.start, r = this.startLoc, i, a = this.options.ecmaVersion >= 8;
|
|
3040
3047
|
if (this.options.ecmaVersion >= 6) {
|
|
3041
3048
|
this.next();
|
|
3042
|
-
var o = this.start, s = this.startLoc, c = [], l = !0, u = !1, d = new
|
|
3049
|
+
var o = this.start, s = this.startLoc, c = [], l = !0, u = !1, d = new ze(), f = this.yieldPos, p = this.awaitPos, m;
|
|
3043
3050
|
for (this.yieldPos = 0, this.awaitPos = 0; this.type !== T.parenR;) if (l ? l = !1 : this.expect(T.comma), a && this.afterTrailingComma(T.parenR, !0)) {
|
|
3044
3051
|
u = !0;
|
|
3045
3052
|
break;
|
|
@@ -3055,13 +3062,13 @@ G.parseExprSubscripts = function(e, t) {
|
|
|
3055
3062
|
var _ = this.startNodeAt(n, r);
|
|
3056
3063
|
return _.expression = i, this.finishNode(_, "ParenthesizedExpression");
|
|
3057
3064
|
} else return i;
|
|
3058
|
-
},
|
|
3065
|
+
}, W.parseParenItem = function(e) {
|
|
3059
3066
|
return e;
|
|
3060
|
-
},
|
|
3067
|
+
}, W.parseParenArrowList = function(e, t, n, r) {
|
|
3061
3068
|
return this.parseArrowExpression(this.startNodeAt(e, t), n, !1, r);
|
|
3062
3069
|
};
|
|
3063
|
-
var
|
|
3064
|
-
|
|
3070
|
+
var Xe = [];
|
|
3071
|
+
W.parseNew = function() {
|
|
3065
3072
|
this.containsEsc && this.raiseRecoverable(this.start, "Escape sequence in keyword new");
|
|
3066
3073
|
var e = this.startNode();
|
|
3067
3074
|
if (this.next(), this.options.ecmaVersion >= 6 && this.type === T.dot) {
|
|
@@ -3071,8 +3078,8 @@ G.parseNew = function() {
|
|
|
3071
3078
|
return e.property = this.parseIdent(!0), e.property.name !== "target" && this.raiseRecoverable(e.property.start, "The only valid meta property for new is 'new.target'"), n && this.raiseRecoverable(e.start, "'new.target' must not contain escaped characters"), this.allowNewDotTarget || this.raiseRecoverable(e.start, "'new.target' can only be used in functions and class static block"), this.finishNode(e, "MetaProperty");
|
|
3072
3079
|
}
|
|
3073
3080
|
var r = this.start, i = this.startLoc;
|
|
3074
|
-
return e.callee = this.parseSubscripts(this.parseExprAtom(null, !1, !0), r, i, !0, !1), e.callee.type === "Super" && this.raiseRecoverable(r, "Invalid use of 'super'"), this.eat(T.parenL) ? e.arguments = this.parseExprList(T.parenR, this.options.ecmaVersion >= 8, !1) : e.arguments =
|
|
3075
|
-
},
|
|
3081
|
+
return e.callee = this.parseSubscripts(this.parseExprAtom(null, !1, !0), r, i, !0, !1), e.callee.type === "Super" && this.raiseRecoverable(r, "Invalid use of 'super'"), this.eat(T.parenL) ? e.arguments = this.parseExprList(T.parenR, this.options.ecmaVersion >= 8, !1) : e.arguments = Xe, this.finishNode(e, "NewExpression");
|
|
3082
|
+
}, W.parseTemplateElement = function(e) {
|
|
3076
3083
|
var t = e.isTagged, n = this.startNode();
|
|
3077
3084
|
return this.type === T.invalidTemplate ? (t || this.raiseRecoverable(this.start, "Bad escape sequence in untagged template literal"), n.value = {
|
|
3078
3085
|
raw: this.value.replace(/\r\n?/g, "\n"),
|
|
@@ -3081,7 +3088,7 @@ G.parseNew = function() {
|
|
|
3081
3088
|
raw: this.input.slice(this.start, this.end).replace(/\r\n?/g, "\n"),
|
|
3082
3089
|
cooked: this.value
|
|
3083
3090
|
}, this.next(), n.tail = this.type === T.backQuote, this.finishNode(n, "TemplateElement");
|
|
3084
|
-
},
|
|
3091
|
+
}, W.parseTemplate = function(e) {
|
|
3085
3092
|
e === void 0 && (e = {});
|
|
3086
3093
|
var t = e.isTagged;
|
|
3087
3094
|
t === void 0 && (t = !1);
|
|
@@ -3090,9 +3097,9 @@ G.parseNew = function() {
|
|
|
3090
3097
|
var r = this.parseTemplateElement({ isTagged: t });
|
|
3091
3098
|
for (n.quasis = [r]; !r.tail;) this.type === T.eof && this.raise(this.pos, "Unterminated template literal"), this.expect(T.dollarBraceL), n.expressions.push(this.parseExpression()), this.expect(T.braceR), n.quasis.push(r = this.parseTemplateElement({ isTagged: t }));
|
|
3092
3099
|
return this.next(), this.finishNode(n, "TemplateLiteral");
|
|
3093
|
-
},
|
|
3100
|
+
}, W.isAsyncProp = function(e) {
|
|
3094
3101
|
return !e.computed && e.key.type === "Identifier" && e.key.name === "async" && (this.type === T.name || this.type === T.num || this.type === T.string || this.type === T.bracketL || this.type.keyword || this.options.ecmaVersion >= 9 && this.type === T.star) && !E.test(this.input.slice(this.lastTokEnd, this.start));
|
|
3095
|
-
},
|
|
3102
|
+
}, W.parseObj = function(e, t) {
|
|
3096
3103
|
var n = this.startNode(), r = !0, i = {};
|
|
3097
3104
|
for (n.properties = [], this.next(); !this.eat(T.braceR);) {
|
|
3098
3105
|
if (r) r = !1;
|
|
@@ -3101,13 +3108,13 @@ G.parseNew = function() {
|
|
|
3101
3108
|
e || this.checkPropClash(a, i, t), n.properties.push(a);
|
|
3102
3109
|
}
|
|
3103
3110
|
return this.finishNode(n, e ? "ObjectPattern" : "ObjectExpression");
|
|
3104
|
-
},
|
|
3111
|
+
}, W.parseProperty = function(e, t) {
|
|
3105
3112
|
var n = this.startNode(), r, i, a, o;
|
|
3106
3113
|
if (this.options.ecmaVersion >= 9 && this.eat(T.ellipsis)) return e ? (n.argument = this.parseIdent(!1), this.type === T.comma && this.raiseRecoverable(this.start, "Comma is not permitted after the rest element"), this.finishNode(n, "RestElement")) : (n.argument = this.parseMaybeAssign(!1, t), this.type === T.comma && t && t.trailingComma < 0 && (t.trailingComma = this.start), this.finishNode(n, "SpreadElement"));
|
|
3107
3114
|
this.options.ecmaVersion >= 6 && (n.method = !1, n.shorthand = !1, (e || t) && (a = this.start, o = this.startLoc), e || (r = this.eat(T.star)));
|
|
3108
3115
|
var s = this.containsEsc;
|
|
3109
3116
|
return this.parsePropertyName(n), !e && !s && this.options.ecmaVersion >= 8 && !r && this.isAsyncProp(n) ? (i = !0, r = this.options.ecmaVersion >= 9 && this.eat(T.star), this.parsePropertyName(n)) : i = !1, this.parsePropertyValue(n, e, r, i, a, o, t, s), this.finishNode(n, "Property");
|
|
3110
|
-
},
|
|
3117
|
+
}, W.parseGetterSetter = function(e) {
|
|
3111
3118
|
var t = e.key.name;
|
|
3112
3119
|
this.parsePropertyName(e), e.value = this.parseMethod(!1), e.kind = t;
|
|
3113
3120
|
var n = e.kind === "get" ? 0 : 1;
|
|
@@ -3115,41 +3122,41 @@ G.parseNew = function() {
|
|
|
3115
3122
|
var r = e.value.start;
|
|
3116
3123
|
e.kind === "get" ? this.raiseRecoverable(r, "getter should have no params") : this.raiseRecoverable(r, "setter should have exactly one param");
|
|
3117
3124
|
} else e.kind === "set" && e.value.params[0].type === "RestElement" && this.raiseRecoverable(e.value.params[0].start, "Setter cannot use rest params");
|
|
3118
|
-
},
|
|
3125
|
+
}, W.parsePropertyValue = function(e, t, n, r, i, a, o, s) {
|
|
3119
3126
|
(n || r) && this.type === T.colon && this.unexpected(), this.eat(T.colon) ? (e.value = t ? this.parseMaybeDefault(this.start, this.startLoc) : this.parseMaybeAssign(!1, o), e.kind = "init") : this.options.ecmaVersion >= 6 && this.type === T.parenL ? (t && this.unexpected(), e.method = !0, e.value = this.parseMethod(n, r), e.kind = "init") : !t && !s && this.options.ecmaVersion >= 5 && !e.computed && e.key.type === "Identifier" && (e.key.name === "get" || e.key.name === "set") && this.type !== T.comma && this.type !== T.braceR && this.type !== T.eq ? ((n || r) && this.unexpected(), this.parseGetterSetter(e)) : this.options.ecmaVersion >= 6 && !e.computed && e.key.type === "Identifier" ? ((n || r) && this.unexpected(), this.checkUnreserved(e.key), e.key.name === "await" && !this.awaitIdentPos && (this.awaitIdentPos = i), t ? e.value = this.parseMaybeDefault(i, a, this.copyNode(e.key)) : this.type === T.eq && o ? (o.shorthandAssign < 0 && (o.shorthandAssign = this.start), e.value = this.parseMaybeDefault(i, a, this.copyNode(e.key))) : e.value = this.copyNode(e.key), e.kind = "init", e.shorthand = !0) : this.unexpected();
|
|
3120
|
-
},
|
|
3127
|
+
}, W.parsePropertyName = function(e) {
|
|
3121
3128
|
if (this.options.ecmaVersion >= 6) {
|
|
3122
3129
|
if (this.eat(T.bracketL)) return e.computed = !0, e.key = this.parseMaybeAssign(), this.expect(T.bracketR), e.key;
|
|
3123
3130
|
e.computed = !1;
|
|
3124
3131
|
}
|
|
3125
3132
|
return e.key = this.type === T.num || this.type === T.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never");
|
|
3126
|
-
},
|
|
3133
|
+
}, W.initFunction = function(e) {
|
|
3127
3134
|
e.id = null, this.options.ecmaVersion >= 6 && (e.generator = e.expression = !1), this.options.ecmaVersion >= 8 && (e.async = !1);
|
|
3128
|
-
},
|
|
3135
|
+
}, W.parseMethod = function(e, t, n) {
|
|
3129
3136
|
var r = this.startNode(), i = this.yieldPos, a = this.awaitPos, o = this.awaitIdentPos;
|
|
3130
|
-
return this.initFunction(r), this.options.ecmaVersion >= 6 && (r.generator = e), this.options.ecmaVersion >= 8 && (r.async = !!t), this.yieldPos = 0, this.awaitPos = 0, this.awaitIdentPos = 0, this.enterScope(
|
|
3131
|
-
},
|
|
3137
|
+
return this.initFunction(r), this.options.ecmaVersion >= 6 && (r.generator = e), this.options.ecmaVersion >= 8 && (r.async = !!t), this.yieldPos = 0, this.awaitPos = 0, this.awaitIdentPos = 0, this.enterScope(Me(t, r.generator) | De | (n ? Oe : 0)), this.expect(T.parenL), r.params = this.parseBindingList(T.parenR, !1, this.options.ecmaVersion >= 8), this.checkYieldAwaitInDefaultParams(), this.parseFunctionBody(r, !1, !0, !1), this.yieldPos = i, this.awaitPos = a, this.awaitIdentPos = o, this.finishNode(r, "FunctionExpression");
|
|
3138
|
+
}, W.parseArrowExpression = function(e, t, n, r) {
|
|
3132
3139
|
var i = this.yieldPos, a = this.awaitPos, o = this.awaitIdentPos;
|
|
3133
|
-
return this.enterScope(
|
|
3134
|
-
},
|
|
3140
|
+
return this.enterScope(Me(n, !1) | Te), this.initFunction(e), this.options.ecmaVersion >= 8 && (e.async = !!n), this.yieldPos = 0, this.awaitPos = 0, this.awaitIdentPos = 0, e.params = this.toAssignableList(t, !0), this.parseFunctionBody(e, !0, !1, r), this.yieldPos = i, this.awaitPos = a, this.awaitIdentPos = o, this.finishNode(e, "ArrowFunctionExpression");
|
|
3141
|
+
}, W.parseFunctionBody = function(e, t, n, r) {
|
|
3135
3142
|
var i = t && this.type !== T.braceL, a = this.strict, o = !1;
|
|
3136
3143
|
if (i) e.body = this.parseMaybeAssign(r), e.expression = !0, this.checkParams(e, !1);
|
|
3137
3144
|
else {
|
|
3138
3145
|
var s = this.options.ecmaVersion >= 7 && !this.isSimpleParamList(e.params);
|
|
3139
3146
|
(!a || s) && (o = this.strictDirective(this.end), o && s && this.raiseRecoverable(e.start, "Illegal 'use strict' directive in function with non-simple parameter list"));
|
|
3140
3147
|
var c = this.labels;
|
|
3141
|
-
this.labels = [], o && (this.strict = !0), this.checkParams(e, !a && !o && !t && !n && this.isSimpleParamList(e.params)), this.strict && e.id && this.checkLValSimple(e.id,
|
|
3148
|
+
this.labels = [], o && (this.strict = !0), this.checkParams(e, !a && !o && !t && !n && this.isSimpleParamList(e.params)), this.strict && e.id && this.checkLValSimple(e.id, Le), e.body = this.parseBlock(!1, void 0, o && !a), e.expression = !1, this.adaptDirectivePrologue(e.body.body), this.labels = c;
|
|
3142
3149
|
}
|
|
3143
3150
|
this.exitScope();
|
|
3144
|
-
},
|
|
3151
|
+
}, W.isSimpleParamList = function(e) {
|
|
3145
3152
|
for (var t = 0, n = e; t < n.length; t += 1) if (n[t].type !== "Identifier") return !1;
|
|
3146
3153
|
return !0;
|
|
3147
|
-
},
|
|
3154
|
+
}, W.checkParams = function(e, t) {
|
|
3148
3155
|
for (var n = Object.create(null), r = 0, i = e.params; r < i.length; r += 1) {
|
|
3149
3156
|
var a = i[r];
|
|
3150
|
-
this.checkLValInnerPattern(a,
|
|
3157
|
+
this.checkLValInnerPattern(a, Pe, t ? null : n);
|
|
3151
3158
|
}
|
|
3152
|
-
},
|
|
3159
|
+
}, W.parseExprList = function(e, t, n, r) {
|
|
3153
3160
|
for (var i = [], a = !0; !this.eat(e);) {
|
|
3154
3161
|
if (a) a = !1;
|
|
3155
3162
|
else if (this.expect(T.comma), t && this.afterTrailingComma(e)) break;
|
|
@@ -3157,160 +3164,160 @@ G.parseNew = function() {
|
|
|
3157
3164
|
n && this.type === T.comma ? o = null : this.type === T.ellipsis ? (o = this.parseSpread(r), r && this.type === T.comma && r.trailingComma < 0 && (r.trailingComma = this.start)) : o = this.parseMaybeAssign(!1, r), i.push(o);
|
|
3158
3165
|
}
|
|
3159
3166
|
return i;
|
|
3160
|
-
},
|
|
3167
|
+
}, W.checkUnreserved = function(e) {
|
|
3161
3168
|
var t = e.start, n = e.end, r = e.name;
|
|
3162
|
-
this.inGenerator && r === "yield" && this.raiseRecoverable(t, "Cannot use 'yield' as identifier inside a generator"), this.inAsync && r === "await" && this.raiseRecoverable(t, "Cannot use 'await' as identifier inside an async function"), !(this.currentThisScope().flags &
|
|
3163
|
-
},
|
|
3169
|
+
this.inGenerator && r === "yield" && this.raiseRecoverable(t, "Cannot use 'yield' as identifier inside a generator"), this.inAsync && r === "await" && this.raiseRecoverable(t, "Cannot use 'await' as identifier inside an async function"), !(this.currentThisScope().flags & je) && r === "arguments" && this.raiseRecoverable(t, "Cannot use 'arguments' in class field initializer"), this.inClassStaticBlock && (r === "arguments" || r === "await") && this.raise(t, "Cannot use " + r + " in class static initialization block"), this.keywords.test(r) && this.raise(t, "Unexpected keyword '" + r + "'"), !(this.options.ecmaVersion < 6 && this.input.slice(t, n).indexOf("\\") !== -1) && (this.strict ? this.reservedWordsStrict : this.reservedWords).test(r) && (!this.inAsync && r === "await" && this.raiseRecoverable(t, "Cannot use keyword 'await' outside an async function"), this.raiseRecoverable(t, "The keyword '" + r + "' is reserved"));
|
|
3170
|
+
}, W.parseIdent = function(e) {
|
|
3164
3171
|
var t = this.parseIdentNode();
|
|
3165
3172
|
return this.next(!!e), this.finishNode(t, "Identifier"), e || (this.checkUnreserved(t), t.name === "await" && !this.awaitIdentPos && (this.awaitIdentPos = t.start)), t;
|
|
3166
|
-
},
|
|
3173
|
+
}, W.parseIdentNode = function() {
|
|
3167
3174
|
var e = this.startNode();
|
|
3168
3175
|
return this.type === T.name ? e.name = this.value : this.type.keyword ? (e.name = this.type.keyword, (e.name === "class" || e.name === "function") && (this.lastTokEnd !== this.lastTokStart + 1 || this.input.charCodeAt(this.lastTokStart) !== 46) && this.context.pop(), this.type = T.name) : this.unexpected(), e;
|
|
3169
|
-
},
|
|
3176
|
+
}, W.parsePrivateIdent = function() {
|
|
3170
3177
|
var e = this.startNode();
|
|
3171
3178
|
return this.type === T.privateId ? e.name = this.value : this.unexpected(), this.next(), this.finishNode(e, "PrivateIdentifier"), this.options.checkPrivateFields && (this.privateNameStack.length === 0 ? this.raise(e.start, "Private field '#" + e.name + "' must be declared in an enclosing class") : this.privateNameStack[this.privateNameStack.length - 1].used.push(e)), e;
|
|
3172
|
-
},
|
|
3179
|
+
}, W.parseYield = function(e) {
|
|
3173
3180
|
this.yieldPos ||= this.start;
|
|
3174
3181
|
var t = this.startNode();
|
|
3175
3182
|
return this.next(), this.type === T.semi || this.canInsertSemicolon() || this.type !== T.star && !this.type.startsExpr ? (t.delegate = !1, t.argument = null) : (t.delegate = this.eat(T.star), t.argument = this.parseMaybeAssign(e)), this.finishNode(t, "YieldExpression");
|
|
3176
|
-
},
|
|
3183
|
+
}, W.parseAwait = function(e) {
|
|
3177
3184
|
this.awaitPos ||= this.start;
|
|
3178
3185
|
var t = this.startNode();
|
|
3179
3186
|
return this.next(), t.argument = this.parseMaybeUnary(null, !0, !1, e), this.finishNode(t, "AwaitExpression");
|
|
3180
3187
|
};
|
|
3181
|
-
var
|
|
3182
|
-
|
|
3183
|
-
var n =
|
|
3188
|
+
var Ze = I.prototype;
|
|
3189
|
+
Ze.raise = function(e, t) {
|
|
3190
|
+
var n = ve(this.input, e);
|
|
3184
3191
|
t += " (" + n.line + ":" + n.column + ")", this.sourceFile && (t += " in " + this.sourceFile);
|
|
3185
3192
|
var r = SyntaxError(t);
|
|
3186
3193
|
throw r.pos = e, r.loc = n, r.raisedAt = this.pos, r;
|
|
3187
|
-
},
|
|
3188
|
-
if (this.options.locations) return new
|
|
3194
|
+
}, Ze.raiseRecoverable = Ze.raise, Ze.curPosition = function() {
|
|
3195
|
+
if (this.options.locations) return new ge(this.curLine, this.pos - this.lineStart);
|
|
3189
3196
|
};
|
|
3190
|
-
var
|
|
3197
|
+
var G = I.prototype, Qe = function(e) {
|
|
3191
3198
|
this.flags = e, this.var = [], this.lexical = [], this.functions = [];
|
|
3192
3199
|
};
|
|
3193
|
-
|
|
3194
|
-
this.scopeStack.push(new
|
|
3195
|
-
},
|
|
3200
|
+
G.enterScope = function(e) {
|
|
3201
|
+
this.scopeStack.push(new Qe(e));
|
|
3202
|
+
}, G.exitScope = function() {
|
|
3196
3203
|
this.scopeStack.pop();
|
|
3197
|
-
},
|
|
3198
|
-
return e.flags &
|
|
3199
|
-
},
|
|
3204
|
+
}, G.treatFunctionsAsVarInScope = function(e) {
|
|
3205
|
+
return e.flags & N || !this.inModule && e.flags & M;
|
|
3206
|
+
}, G.declareName = function(e, t, n) {
|
|
3200
3207
|
var r = !1;
|
|
3201
|
-
if (t ===
|
|
3208
|
+
if (t === F) {
|
|
3202
3209
|
var i = this.currentScope();
|
|
3203
|
-
r = i.lexical.indexOf(e) > -1 || i.functions.indexOf(e) > -1 || i.var.indexOf(e) > -1, i.lexical.push(e), this.inModule && i.flags &
|
|
3204
|
-
} else if (t ===
|
|
3205
|
-
else if (t ===
|
|
3210
|
+
r = i.lexical.indexOf(e) > -1 || i.functions.indexOf(e) > -1 || i.var.indexOf(e) > -1, i.lexical.push(e), this.inModule && i.flags & M && delete this.undefinedExports[e];
|
|
3211
|
+
} else if (t === Ie) this.currentScope().lexical.push(e);
|
|
3212
|
+
else if (t === Fe) {
|
|
3206
3213
|
var a = this.currentScope();
|
|
3207
3214
|
r = this.treatFunctionsAsVar ? a.lexical.indexOf(e) > -1 : a.lexical.indexOf(e) > -1 || a.var.indexOf(e) > -1, a.functions.push(e);
|
|
3208
3215
|
} else for (var o = this.scopeStack.length - 1; o >= 0; --o) {
|
|
3209
3216
|
var s = this.scopeStack[o];
|
|
3210
|
-
if (s.lexical.indexOf(e) > -1 && !(s.flags &
|
|
3217
|
+
if (s.lexical.indexOf(e) > -1 && !(s.flags & Ee && s.lexical[0] === e) || !this.treatFunctionsAsVarInScope(s) && s.functions.indexOf(e) > -1) {
|
|
3211
3218
|
r = !0;
|
|
3212
3219
|
break;
|
|
3213
3220
|
}
|
|
3214
|
-
if (s.var.push(e), this.inModule && s.flags &
|
|
3221
|
+
if (s.var.push(e), this.inModule && s.flags & M && delete this.undefinedExports[e], s.flags & je) break;
|
|
3215
3222
|
}
|
|
3216
3223
|
r && this.raiseRecoverable(n, "Identifier '" + e + "' has already been declared");
|
|
3217
|
-
},
|
|
3224
|
+
}, G.checkLocalExport = function(e) {
|
|
3218
3225
|
this.scopeStack[0].lexical.indexOf(e.name) === -1 && this.scopeStack[0].var.indexOf(e.name) === -1 && (this.undefinedExports[e.name] = e);
|
|
3219
|
-
},
|
|
3226
|
+
}, G.currentScope = function() {
|
|
3220
3227
|
return this.scopeStack[this.scopeStack.length - 1];
|
|
3221
|
-
},
|
|
3228
|
+
}, G.currentVarScope = function() {
|
|
3222
3229
|
for (var e = this.scopeStack.length - 1;; e--) {
|
|
3223
3230
|
var t = this.scopeStack[e];
|
|
3224
|
-
if (t.flags & (
|
|
3231
|
+
if (t.flags & (je | ke | P)) return t;
|
|
3225
3232
|
}
|
|
3226
|
-
},
|
|
3233
|
+
}, G.currentThisScope = function() {
|
|
3227
3234
|
for (var e = this.scopeStack.length - 1;; e--) {
|
|
3228
3235
|
var t = this.scopeStack[e];
|
|
3229
|
-
if (t.flags & (
|
|
3236
|
+
if (t.flags & (je | ke | P) && !(t.flags & Te)) return t;
|
|
3230
3237
|
}
|
|
3231
3238
|
};
|
|
3232
|
-
var
|
|
3233
|
-
this.type = "", this.start = t, this.end = 0, e.options.locations && (this.loc = new
|
|
3234
|
-
},
|
|
3235
|
-
|
|
3236
|
-
return new
|
|
3237
|
-
},
|
|
3238
|
-
return new
|
|
3239
|
+
var $e = function(e, t, n) {
|
|
3240
|
+
this.type = "", this.start = t, this.end = 0, e.options.locations && (this.loc = new _e(e, n)), e.options.directSourceFile && (this.sourceFile = e.options.directSourceFile), e.options.ranges && (this.range = [t, 0]);
|
|
3241
|
+
}, et = I.prototype;
|
|
3242
|
+
et.startNode = function() {
|
|
3243
|
+
return new $e(this, this.start, this.startLoc);
|
|
3244
|
+
}, et.startNodeAt = function(e, t) {
|
|
3245
|
+
return new $e(this, e, t);
|
|
3239
3246
|
};
|
|
3240
|
-
function
|
|
3247
|
+
function tt(e, t, n, r) {
|
|
3241
3248
|
return e.type = t, e.end = n, this.options.locations && (e.loc.end = r), this.options.ranges && (e.range[1] = n), e;
|
|
3242
3249
|
}
|
|
3243
|
-
|
|
3244
|
-
return
|
|
3245
|
-
},
|
|
3246
|
-
return
|
|
3247
|
-
},
|
|
3248
|
-
var t = new
|
|
3250
|
+
et.finishNode = function(e, t) {
|
|
3251
|
+
return tt.call(this, e, t, this.lastTokEnd, this.lastTokEndLoc);
|
|
3252
|
+
}, et.finishNodeAt = function(e, t, n, r) {
|
|
3253
|
+
return tt.call(this, e, t, n, r);
|
|
3254
|
+
}, et.copyNode = function(e) {
|
|
3255
|
+
var t = new $e(this, e.start, this.startLoc);
|
|
3249
3256
|
for (var n in e) t[n] = e[n];
|
|
3250
3257
|
return t;
|
|
3251
3258
|
};
|
|
3252
|
-
var
|
|
3253
|
-
9:
|
|
3254
|
-
10:
|
|
3255
|
-
11:
|
|
3256
|
-
12:
|
|
3257
|
-
13:
|
|
3258
|
-
14:
|
|
3259
|
-
},
|
|
3259
|
+
var nt = "Berf Beria_Erfe Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sidetic Sidt Sunu Sunuwar Tai_Yo Tayo Todhri Todr Tolong_Siki Tols Tulu_Tigalari Tutg Unknown Zzzz", rt = "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", it = rt + " Extended_Pictographic", at = it, ot = at + " EBase EComp EMod EPres ExtPict", st = ot, ct = {
|
|
3260
|
+
9: rt,
|
|
3261
|
+
10: it,
|
|
3262
|
+
11: at,
|
|
3263
|
+
12: ot,
|
|
3264
|
+
13: st,
|
|
3265
|
+
14: st
|
|
3266
|
+
}, lt = {
|
|
3260
3267
|
9: "",
|
|
3261
3268
|
10: "",
|
|
3262
3269
|
11: "",
|
|
3263
3270
|
12: "",
|
|
3264
3271
|
13: "",
|
|
3265
3272
|
14: "Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji"
|
|
3266
|
-
},
|
|
3267
|
-
9:
|
|
3268
|
-
10:
|
|
3269
|
-
11:
|
|
3270
|
-
12:
|
|
3271
|
-
13:
|
|
3272
|
-
14:
|
|
3273
|
-
},
|
|
3274
|
-
function
|
|
3275
|
-
var t =
|
|
3276
|
-
binary: A(
|
|
3277
|
-
binaryOfStrings: A(
|
|
3273
|
+
}, ut = "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", dt = "Adlam Adlm 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 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", ft = dt + " Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd", pt = ft + " Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho", mt = pt + " Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi", ht = mt + " Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith", gt = {
|
|
3274
|
+
9: dt,
|
|
3275
|
+
10: ft,
|
|
3276
|
+
11: pt,
|
|
3277
|
+
12: mt,
|
|
3278
|
+
13: ht,
|
|
3279
|
+
14: ht + " " + nt
|
|
3280
|
+
}, _t = {};
|
|
3281
|
+
function vt(e) {
|
|
3282
|
+
var t = _t[e] = {
|
|
3283
|
+
binary: A(ct[e] + " " + ut),
|
|
3284
|
+
binaryOfStrings: A(lt[e]),
|
|
3278
3285
|
nonBinary: {
|
|
3279
|
-
General_Category: A(
|
|
3280
|
-
Script: A(
|
|
3286
|
+
General_Category: A(ut),
|
|
3287
|
+
Script: A(gt[e])
|
|
3281
3288
|
}
|
|
3282
3289
|
};
|
|
3283
3290
|
t.nonBinary.Script_Extensions = t.nonBinary.Script, t.nonBinary.gc = t.nonBinary.General_Category, t.nonBinary.sc = t.nonBinary.Script, t.nonBinary.scx = t.nonBinary.Script_Extensions;
|
|
3284
3291
|
}
|
|
3285
|
-
for (var
|
|
3292
|
+
for (var yt = 0, bt = [
|
|
3286
3293
|
9,
|
|
3287
3294
|
10,
|
|
3288
3295
|
11,
|
|
3289
3296
|
12,
|
|
3290
3297
|
13,
|
|
3291
3298
|
14
|
|
3292
|
-
];
|
|
3293
|
-
var
|
|
3294
|
-
|
|
3299
|
+
]; yt < bt.length; yt += 1) {
|
|
3300
|
+
var xt = bt[yt];
|
|
3301
|
+
vt(xt);
|
|
3295
3302
|
}
|
|
3296
|
-
var
|
|
3303
|
+
var K = I.prototype, St = function(e, t) {
|
|
3297
3304
|
this.parent = e, this.base = t || this;
|
|
3298
3305
|
};
|
|
3299
|
-
|
|
3306
|
+
St.prototype.separatedFrom = function(e) {
|
|
3300
3307
|
for (var t = this; t; t = t.parent) for (var n = e; n; n = n.parent) if (t.base === n.base && t !== n) return !0;
|
|
3301
3308
|
return !1;
|
|
3302
|
-
},
|
|
3303
|
-
return new
|
|
3309
|
+
}, St.prototype.sibling = function() {
|
|
3310
|
+
return new St(this.parent, this.base);
|
|
3304
3311
|
};
|
|
3305
|
-
var
|
|
3306
|
-
this.parser = e, this.validFlags = "gim" + (e.options.ecmaVersion >= 6 ? "uy" : "") + (e.options.ecmaVersion >= 9 ? "s" : "") + (e.options.ecmaVersion >= 13 ? "d" : "") + (e.options.ecmaVersion >= 15 ? "v" : ""), this.unicodeProperties =
|
|
3312
|
+
var q = function(e) {
|
|
3313
|
+
this.parser = e, this.validFlags = "gim" + (e.options.ecmaVersion >= 6 ? "uy" : "") + (e.options.ecmaVersion >= 9 ? "s" : "") + (e.options.ecmaVersion >= 13 ? "d" : "") + (e.options.ecmaVersion >= 15 ? "v" : ""), this.unicodeProperties = _t[e.options.ecmaVersion >= 14 ? 14 : e.options.ecmaVersion], this.source = "", this.flags = "", this.start = 0, this.switchU = !1, this.switchV = !1, this.switchN = !1, this.pos = 0, this.lastIntValue = 0, this.lastStringValue = "", this.lastAssertionIsQuantifiable = !1, this.numCapturingParens = 0, this.maxBackReference = 0, this.groupNames = Object.create(null), this.backReferenceNames = [], this.branchID = null;
|
|
3307
3314
|
};
|
|
3308
|
-
|
|
3315
|
+
q.prototype.reset = function(e, t, n) {
|
|
3309
3316
|
var r = n.indexOf("v") !== -1, i = n.indexOf("u") !== -1;
|
|
3310
3317
|
this.start = e | 0, this.source = t + "", this.flags = n, r && this.parser.options.ecmaVersion >= 15 ? (this.switchU = !0, this.switchV = !0, this.switchN = !0) : (this.switchU = i && this.parser.options.ecmaVersion >= 6, this.switchV = !1, this.switchN = i && this.parser.options.ecmaVersion >= 9);
|
|
3311
|
-
},
|
|
3318
|
+
}, q.prototype.raise = function(e) {
|
|
3312
3319
|
this.parser.raiseRecoverable(this.start, "Invalid regular expression: /" + this.source + "/: " + e);
|
|
3313
|
-
},
|
|
3320
|
+
}, q.prototype.at = function(e, t) {
|
|
3314
3321
|
t === void 0 && (t = !1);
|
|
3315
3322
|
var n = this.source, r = n.length;
|
|
3316
3323
|
if (e >= r) return -1;
|
|
@@ -3318,21 +3325,21 @@ J.prototype.reset = function(e, t, n) {
|
|
|
3318
3325
|
if (!(t || this.switchU) || i <= 55295 || i >= 57344 || e + 1 >= r) return i;
|
|
3319
3326
|
var a = n.charCodeAt(e + 1);
|
|
3320
3327
|
return a >= 56320 && a <= 57343 ? (i << 10) + a - 56613888 : i;
|
|
3321
|
-
},
|
|
3328
|
+
}, q.prototype.nextIndex = function(e, t) {
|
|
3322
3329
|
t === void 0 && (t = !1);
|
|
3323
3330
|
var n = this.source, r = n.length;
|
|
3324
3331
|
if (e >= r) return r;
|
|
3325
3332
|
var i = n.charCodeAt(e), a;
|
|
3326
3333
|
return !(t || this.switchU) || i <= 55295 || i >= 57344 || e + 1 >= r || (a = n.charCodeAt(e + 1)) < 56320 || a > 57343 ? e + 1 : e + 2;
|
|
3327
|
-
},
|
|
3334
|
+
}, q.prototype.current = function(e) {
|
|
3328
3335
|
return e === void 0 && (e = !1), this.at(this.pos, e);
|
|
3329
|
-
},
|
|
3336
|
+
}, q.prototype.lookahead = function(e) {
|
|
3330
3337
|
return e === void 0 && (e = !1), this.at(this.nextIndex(this.pos, e), e);
|
|
3331
|
-
},
|
|
3338
|
+
}, q.prototype.advance = function(e) {
|
|
3332
3339
|
e === void 0 && (e = !1), this.pos = this.nextIndex(this.pos, e);
|
|
3333
|
-
},
|
|
3340
|
+
}, q.prototype.eat = function(e, t) {
|
|
3334
3341
|
return t === void 0 && (t = !1), this.current(t) === e ? (this.advance(t), !0) : !1;
|
|
3335
|
-
},
|
|
3342
|
+
}, q.prototype.eatChars = function(e, t) {
|
|
3336
3343
|
t === void 0 && (t = !1);
|
|
3337
3344
|
for (var n = this.pos, r = 0, i = e; r < i.length; r += 1) {
|
|
3338
3345
|
var a = i[r], o = this.at(n, t);
|
|
@@ -3340,34 +3347,34 @@ J.prototype.reset = function(e, t, n) {
|
|
|
3340
3347
|
n = this.nextIndex(n, t);
|
|
3341
3348
|
}
|
|
3342
3349
|
return this.pos = n, !0;
|
|
3343
|
-
},
|
|
3350
|
+
}, K.validateRegExpFlags = function(e) {
|
|
3344
3351
|
for (var t = e.validFlags, n = e.flags, r = !1, i = !1, a = 0; a < n.length; a++) {
|
|
3345
3352
|
var o = n.charAt(a);
|
|
3346
3353
|
t.indexOf(o) === -1 && this.raise(e.start, "Invalid regular expression flag"), n.indexOf(o, a + 1) > -1 && this.raise(e.start, "Duplicate regular expression flag"), o === "u" && (r = !0), o === "v" && (i = !0);
|
|
3347
3354
|
}
|
|
3348
3355
|
this.options.ecmaVersion >= 15 && r && i && this.raise(e.start, "Invalid regular expression flag");
|
|
3349
3356
|
};
|
|
3350
|
-
function
|
|
3357
|
+
function Ct(e) {
|
|
3351
3358
|
for (var t in e) return !0;
|
|
3352
3359
|
return !1;
|
|
3353
3360
|
}
|
|
3354
|
-
|
|
3355
|
-
this.regexp_pattern(e), !e.switchN && this.options.ecmaVersion >= 9 &&
|
|
3356
|
-
},
|
|
3361
|
+
K.validateRegExpPattern = function(e) {
|
|
3362
|
+
this.regexp_pattern(e), !e.switchN && this.options.ecmaVersion >= 9 && Ct(e.groupNames) && (e.switchN = !0, this.regexp_pattern(e));
|
|
3363
|
+
}, K.regexp_pattern = function(e) {
|
|
3357
3364
|
e.pos = 0, e.lastIntValue = 0, e.lastStringValue = "", e.lastAssertionIsQuantifiable = !1, e.numCapturingParens = 0, e.maxBackReference = 0, e.groupNames = Object.create(null), e.backReferenceNames.length = 0, e.branchID = null, this.regexp_disjunction(e), e.pos !== e.source.length && (e.eat(41) && e.raise("Unmatched ')'"), (e.eat(93) || e.eat(125)) && e.raise("Lone quantifier brackets")), e.maxBackReference > e.numCapturingParens && e.raise("Invalid escape");
|
|
3358
3365
|
for (var t = 0, n = e.backReferenceNames; t < n.length; t += 1) {
|
|
3359
3366
|
var r = n[t];
|
|
3360
3367
|
e.groupNames[r] || e.raise("Invalid named capture referenced");
|
|
3361
3368
|
}
|
|
3362
|
-
},
|
|
3369
|
+
}, K.regexp_disjunction = function(e) {
|
|
3363
3370
|
var t = this.options.ecmaVersion >= 16;
|
|
3364
|
-
for (t && (e.branchID = new
|
|
3371
|
+
for (t && (e.branchID = new St(e.branchID, null)), this.regexp_alternative(e); e.eat(124);) t && (e.branchID = e.branchID.sibling()), this.regexp_alternative(e);
|
|
3365
3372
|
t && (e.branchID = e.branchID.parent), this.regexp_eatQuantifier(e, !0) && e.raise("Nothing to repeat"), e.eat(123) && e.raise("Lone quantifier brackets");
|
|
3366
|
-
},
|
|
3373
|
+
}, K.regexp_alternative = function(e) {
|
|
3367
3374
|
for (; e.pos < e.source.length && this.regexp_eatTerm(e););
|
|
3368
|
-
},
|
|
3375
|
+
}, K.regexp_eatTerm = function(e) {
|
|
3369
3376
|
return this.regexp_eatAssertion(e) ? (e.lastAssertionIsQuantifiable && this.regexp_eatQuantifier(e) && e.switchU && e.raise("Invalid quantifier"), !0) : (e.switchU ? this.regexp_eatAtom(e) : this.regexp_eatExtendedAtom(e)) ? (this.regexp_eatQuantifier(e), !0) : !1;
|
|
3370
|
-
},
|
|
3377
|
+
}, K.regexp_eatAssertion = function(e) {
|
|
3371
3378
|
var t = e.pos;
|
|
3372
3379
|
if (e.lastAssertionIsQuantifiable = !1, e.eat(94) || e.eat(36)) return !0;
|
|
3373
3380
|
if (e.eat(92)) {
|
|
@@ -3379,11 +3386,11 @@ q.validateRegExpPattern = function(e) {
|
|
|
3379
3386
|
if (this.options.ecmaVersion >= 9 && (n = e.eat(60)), e.eat(61) || e.eat(33)) return this.regexp_disjunction(e), e.eat(41) || e.raise("Unterminated group"), e.lastAssertionIsQuantifiable = !n, !0;
|
|
3380
3387
|
}
|
|
3381
3388
|
return e.pos = t, !1;
|
|
3382
|
-
},
|
|
3389
|
+
}, K.regexp_eatQuantifier = function(e, t) {
|
|
3383
3390
|
return t === void 0 && (t = !1), this.regexp_eatQuantifierPrefix(e, t) ? (e.eat(63), !0) : !1;
|
|
3384
|
-
},
|
|
3391
|
+
}, K.regexp_eatQuantifierPrefix = function(e, t) {
|
|
3385
3392
|
return e.eat(42) || e.eat(43) || e.eat(63) || this.regexp_eatBracedQuantifier(e, t);
|
|
3386
|
-
},
|
|
3393
|
+
}, K.regexp_eatBracedQuantifier = function(e, t) {
|
|
3387
3394
|
var n = e.pos;
|
|
3388
3395
|
if (e.eat(123)) {
|
|
3389
3396
|
var r = 0, i = -1;
|
|
@@ -3391,16 +3398,16 @@ q.validateRegExpPattern = function(e) {
|
|
|
3391
3398
|
e.switchU && !t && e.raise("Incomplete quantifier"), e.pos = n;
|
|
3392
3399
|
}
|
|
3393
3400
|
return !1;
|
|
3394
|
-
},
|
|
3401
|
+
}, K.regexp_eatAtom = function(e) {
|
|
3395
3402
|
return this.regexp_eatPatternCharacters(e) || e.eat(46) || this.regexp_eatReverseSolidusAtomEscape(e) || this.regexp_eatCharacterClass(e) || this.regexp_eatUncapturingGroup(e) || this.regexp_eatCapturingGroup(e);
|
|
3396
|
-
},
|
|
3403
|
+
}, K.regexp_eatReverseSolidusAtomEscape = function(e) {
|
|
3397
3404
|
var t = e.pos;
|
|
3398
3405
|
if (e.eat(92)) {
|
|
3399
3406
|
if (this.regexp_eatAtomEscape(e)) return !0;
|
|
3400
3407
|
e.pos = t;
|
|
3401
3408
|
}
|
|
3402
3409
|
return !1;
|
|
3403
|
-
},
|
|
3410
|
+
}, K.regexp_eatUncapturingGroup = function(e) {
|
|
3404
3411
|
var t = e.pos;
|
|
3405
3412
|
if (e.eat(40)) {
|
|
3406
3413
|
if (e.eat(63)) {
|
|
@@ -3429,37 +3436,37 @@ q.validateRegExpPattern = function(e) {
|
|
|
3429
3436
|
e.pos = t;
|
|
3430
3437
|
}
|
|
3431
3438
|
return !1;
|
|
3432
|
-
},
|
|
3439
|
+
}, K.regexp_eatCapturingGroup = function(e) {
|
|
3433
3440
|
if (e.eat(40)) {
|
|
3434
3441
|
if (this.options.ecmaVersion >= 9 ? this.regexp_groupSpecifier(e) : e.current() === 63 && e.raise("Invalid group"), this.regexp_disjunction(e), e.eat(41)) return e.numCapturingParens += 1, !0;
|
|
3435
3442
|
e.raise("Unterminated group");
|
|
3436
3443
|
}
|
|
3437
3444
|
return !1;
|
|
3438
|
-
},
|
|
3439
|
-
for (var t = "", n = 0; (n = e.current()) !== -1 &&
|
|
3445
|
+
}, K.regexp_eatModifiers = function(e) {
|
|
3446
|
+
for (var t = "", n = 0; (n = e.current()) !== -1 && wt(n);) t += j(n), e.advance();
|
|
3440
3447
|
return t;
|
|
3441
3448
|
};
|
|
3442
|
-
function
|
|
3449
|
+
function wt(e) {
|
|
3443
3450
|
return e === 105 || e === 109 || e === 115;
|
|
3444
3451
|
}
|
|
3445
|
-
|
|
3452
|
+
K.regexp_eatExtendedAtom = function(e) {
|
|
3446
3453
|
return e.eat(46) || this.regexp_eatReverseSolidusAtomEscape(e) || this.regexp_eatCharacterClass(e) || this.regexp_eatUncapturingGroup(e) || this.regexp_eatCapturingGroup(e) || this.regexp_eatInvalidBracedQuantifier(e) || this.regexp_eatExtendedPatternCharacter(e);
|
|
3447
|
-
},
|
|
3454
|
+
}, K.regexp_eatInvalidBracedQuantifier = function(e) {
|
|
3448
3455
|
return this.regexp_eatBracedQuantifier(e, !0) && e.raise("Nothing to repeat"), !1;
|
|
3449
|
-
},
|
|
3456
|
+
}, K.regexp_eatSyntaxCharacter = function(e) {
|
|
3450
3457
|
var t = e.current();
|
|
3451
|
-
return
|
|
3458
|
+
return Tt(t) ? (e.lastIntValue = t, e.advance(), !0) : !1;
|
|
3452
3459
|
};
|
|
3453
|
-
function
|
|
3460
|
+
function Tt(e) {
|
|
3454
3461
|
return e === 36 || e >= 40 && e <= 43 || e === 46 || e === 63 || e >= 91 && e <= 94 || e >= 123 && e <= 125;
|
|
3455
3462
|
}
|
|
3456
|
-
|
|
3457
|
-
for (var t = e.pos, n = 0; (n = e.current()) !== -1 && !
|
|
3463
|
+
K.regexp_eatPatternCharacters = function(e) {
|
|
3464
|
+
for (var t = e.pos, n = 0; (n = e.current()) !== -1 && !Tt(n);) e.advance();
|
|
3458
3465
|
return e.pos !== t;
|
|
3459
|
-
},
|
|
3466
|
+
}, K.regexp_eatExtendedPatternCharacter = function(e) {
|
|
3460
3467
|
var t = e.current();
|
|
3461
3468
|
return t !== -1 && t !== 36 && !(t >= 40 && t <= 43) && t !== 46 && t !== 63 && t !== 91 && t !== 94 && t !== 124 ? (e.advance(), !0) : !1;
|
|
3462
|
-
},
|
|
3469
|
+
}, K.regexp_groupSpecifier = function(e) {
|
|
3463
3470
|
if (e.eat(63)) {
|
|
3464
3471
|
this.regexp_eatGroupName(e) || e.raise("Invalid group");
|
|
3465
3472
|
var t = this.options.ecmaVersion >= 16, n = e.groupNames[e.lastStringValue];
|
|
@@ -3467,35 +3474,35 @@ q.regexp_eatPatternCharacters = function(e) {
|
|
|
3467
3474
|
else e.raise("Duplicate capture group name");
|
|
3468
3475
|
t ? (n || (e.groupNames[e.lastStringValue] = [])).push(e.branchID) : e.groupNames[e.lastStringValue] = !0;
|
|
3469
3476
|
}
|
|
3470
|
-
},
|
|
3477
|
+
}, K.regexp_eatGroupName = function(e) {
|
|
3471
3478
|
if (e.lastStringValue = "", e.eat(60)) {
|
|
3472
3479
|
if (this.regexp_eatRegExpIdentifierName(e) && e.eat(62)) return !0;
|
|
3473
3480
|
e.raise("Invalid capture group name");
|
|
3474
3481
|
}
|
|
3475
3482
|
return !1;
|
|
3476
|
-
},
|
|
3483
|
+
}, K.regexp_eatRegExpIdentifierName = function(e) {
|
|
3477
3484
|
if (e.lastStringValue = "", this.regexp_eatRegExpIdentifierStart(e)) {
|
|
3478
3485
|
for (e.lastStringValue += j(e.lastIntValue); this.regexp_eatRegExpIdentifierPart(e);) e.lastStringValue += j(e.lastIntValue);
|
|
3479
3486
|
return !0;
|
|
3480
3487
|
}
|
|
3481
3488
|
return !1;
|
|
3482
|
-
},
|
|
3489
|
+
}, K.regexp_eatRegExpIdentifierStart = function(e) {
|
|
3483
3490
|
var t = e.pos, n = this.options.ecmaVersion >= 11, r = e.current(n);
|
|
3484
|
-
return e.advance(n), r === 92 && this.regexp_eatRegExpUnicodeEscapeSequence(e, n) && (r = e.lastIntValue),
|
|
3491
|
+
return e.advance(n), r === 92 && this.regexp_eatRegExpUnicodeEscapeSequence(e, n) && (r = e.lastIntValue), Et(r) ? (e.lastIntValue = r, !0) : (e.pos = t, !1);
|
|
3485
3492
|
};
|
|
3486
|
-
function
|
|
3493
|
+
function Et(e) {
|
|
3487
3494
|
return v(e, !0) || e === 36 || e === 95;
|
|
3488
3495
|
}
|
|
3489
|
-
|
|
3496
|
+
K.regexp_eatRegExpIdentifierPart = function(e) {
|
|
3490
3497
|
var t = e.pos, n = this.options.ecmaVersion >= 11, r = e.current(n);
|
|
3491
|
-
return e.advance(n), r === 92 && this.regexp_eatRegExpUnicodeEscapeSequence(e, n) && (r = e.lastIntValue),
|
|
3498
|
+
return e.advance(n), r === 92 && this.regexp_eatRegExpUnicodeEscapeSequence(e, n) && (r = e.lastIntValue), Dt(r) ? (e.lastIntValue = r, !0) : (e.pos = t, !1);
|
|
3492
3499
|
};
|
|
3493
|
-
function
|
|
3500
|
+
function Dt(e) {
|
|
3494
3501
|
return y(e, !0) || e === 36 || e === 95 || e === 8204 || e === 8205;
|
|
3495
3502
|
}
|
|
3496
|
-
|
|
3503
|
+
K.regexp_eatAtomEscape = function(e) {
|
|
3497
3504
|
return this.regexp_eatBackReference(e) || this.regexp_eatCharacterClassEscape(e) || this.regexp_eatCharacterEscape(e) || e.switchN && this.regexp_eatKGroupName(e) ? !0 : (e.switchU && (e.current() === 99 && e.raise("Invalid unicode escape"), e.raise("Invalid escape")), !1);
|
|
3498
|
-
},
|
|
3505
|
+
}, K.regexp_eatBackReference = function(e) {
|
|
3499
3506
|
var t = e.pos;
|
|
3500
3507
|
if (this.regexp_eatDecimalEscape(e)) {
|
|
3501
3508
|
var n = e.lastIntValue;
|
|
@@ -3504,34 +3511,34 @@ q.regexp_eatAtomEscape = function(e) {
|
|
|
3504
3511
|
e.pos = t;
|
|
3505
3512
|
}
|
|
3506
3513
|
return !1;
|
|
3507
|
-
},
|
|
3514
|
+
}, K.regexp_eatKGroupName = function(e) {
|
|
3508
3515
|
if (e.eat(107)) {
|
|
3509
3516
|
if (this.regexp_eatGroupName(e)) return e.backReferenceNames.push(e.lastStringValue), !0;
|
|
3510
3517
|
e.raise("Invalid named reference");
|
|
3511
3518
|
}
|
|
3512
3519
|
return !1;
|
|
3513
|
-
},
|
|
3520
|
+
}, K.regexp_eatCharacterEscape = function(e) {
|
|
3514
3521
|
return this.regexp_eatControlEscape(e) || this.regexp_eatCControlLetter(e) || this.regexp_eatZero(e) || this.regexp_eatHexEscapeSequence(e) || this.regexp_eatRegExpUnicodeEscapeSequence(e, !1) || !e.switchU && this.regexp_eatLegacyOctalEscapeSequence(e) || this.regexp_eatIdentityEscape(e);
|
|
3515
|
-
},
|
|
3522
|
+
}, K.regexp_eatCControlLetter = function(e) {
|
|
3516
3523
|
var t = e.pos;
|
|
3517
3524
|
if (e.eat(99)) {
|
|
3518
3525
|
if (this.regexp_eatControlLetter(e)) return !0;
|
|
3519
3526
|
e.pos = t;
|
|
3520
3527
|
}
|
|
3521
3528
|
return !1;
|
|
3522
|
-
},
|
|
3523
|
-
return e.current() === 48 && !
|
|
3524
|
-
},
|
|
3529
|
+
}, K.regexp_eatZero = function(e) {
|
|
3530
|
+
return e.current() === 48 && !Lt(e.lookahead()) ? (e.lastIntValue = 0, e.advance(), !0) : !1;
|
|
3531
|
+
}, K.regexp_eatControlEscape = function(e) {
|
|
3525
3532
|
var t = e.current();
|
|
3526
3533
|
return t === 116 ? (e.lastIntValue = 9, e.advance(), !0) : t === 110 ? (e.lastIntValue = 10, e.advance(), !0) : t === 118 ? (e.lastIntValue = 11, e.advance(), !0) : t === 102 ? (e.lastIntValue = 12, e.advance(), !0) : t === 114 ? (e.lastIntValue = 13, e.advance(), !0) : !1;
|
|
3527
|
-
},
|
|
3534
|
+
}, K.regexp_eatControlLetter = function(e) {
|
|
3528
3535
|
var t = e.current();
|
|
3529
|
-
return
|
|
3536
|
+
return Ot(t) ? (e.lastIntValue = t % 32, e.advance(), !0) : !1;
|
|
3530
3537
|
};
|
|
3531
|
-
function
|
|
3538
|
+
function Ot(e) {
|
|
3532
3539
|
return e >= 65 && e <= 90 || e >= 97 && e <= 122;
|
|
3533
3540
|
}
|
|
3534
|
-
|
|
3541
|
+
K.regexp_eatRegExpUnicodeEscapeSequence = function(e, t) {
|
|
3535
3542
|
t === void 0 && (t = !1);
|
|
3536
3543
|
var n = e.pos, r = t || e.switchU;
|
|
3537
3544
|
if (e.eat(117)) {
|
|
@@ -3547,19 +3554,19 @@ q.regexp_eatRegExpUnicodeEscapeSequence = function(e, t) {
|
|
|
3547
3554
|
}
|
|
3548
3555
|
return !0;
|
|
3549
3556
|
}
|
|
3550
|
-
if (r && e.eat(123) && this.regexp_eatHexDigits(e) && e.eat(125) &&
|
|
3557
|
+
if (r && e.eat(123) && this.regexp_eatHexDigits(e) && e.eat(125) && kt(e.lastIntValue)) return !0;
|
|
3551
3558
|
r && e.raise("Invalid unicode escape"), e.pos = n;
|
|
3552
3559
|
}
|
|
3553
3560
|
return !1;
|
|
3554
3561
|
};
|
|
3555
|
-
function
|
|
3562
|
+
function kt(e) {
|
|
3556
3563
|
return e >= 0 && e <= 1114111;
|
|
3557
3564
|
}
|
|
3558
|
-
|
|
3565
|
+
K.regexp_eatIdentityEscape = function(e) {
|
|
3559
3566
|
if (e.switchU) return this.regexp_eatSyntaxCharacter(e) ? !0 : e.eat(47) ? (e.lastIntValue = 47, !0) : !1;
|
|
3560
3567
|
var t = e.current();
|
|
3561
3568
|
return t !== 99 && (!e.switchN || t !== 107) ? (e.lastIntValue = t, e.advance(), !0) : !1;
|
|
3562
|
-
},
|
|
3569
|
+
}, K.regexp_eatDecimalEscape = function(e) {
|
|
3563
3570
|
e.lastIntValue = 0;
|
|
3564
3571
|
var t = e.current();
|
|
3565
3572
|
if (t >= 49 && t <= 57) {
|
|
@@ -3570,69 +3577,69 @@ q.regexp_eatIdentityEscape = function(e) {
|
|
|
3570
3577
|
}
|
|
3571
3578
|
return !1;
|
|
3572
3579
|
};
|
|
3573
|
-
var
|
|
3574
|
-
|
|
3580
|
+
var At = 0, J = 1, Y = 2;
|
|
3581
|
+
K.regexp_eatCharacterClassEscape = function(e) {
|
|
3575
3582
|
var t = e.current();
|
|
3576
|
-
if (
|
|
3583
|
+
if (jt(t)) return e.lastIntValue = -1, e.advance(), J;
|
|
3577
3584
|
var n = !1;
|
|
3578
3585
|
if (e.switchU && this.options.ecmaVersion >= 9 && ((n = t === 80) || t === 112)) {
|
|
3579
3586
|
e.lastIntValue = -1, e.advance();
|
|
3580
3587
|
var r;
|
|
3581
|
-
if (e.eat(123) && (r = this.regexp_eatUnicodePropertyValueExpression(e)) && e.eat(125)) return n && r ===
|
|
3588
|
+
if (e.eat(123) && (r = this.regexp_eatUnicodePropertyValueExpression(e)) && e.eat(125)) return n && r === Y && e.raise("Invalid property name"), r;
|
|
3582
3589
|
e.raise("Invalid property name");
|
|
3583
3590
|
}
|
|
3584
|
-
return
|
|
3591
|
+
return At;
|
|
3585
3592
|
};
|
|
3586
|
-
function
|
|
3593
|
+
function jt(e) {
|
|
3587
3594
|
return e === 100 || e === 68 || e === 115 || e === 83 || e === 119 || e === 87;
|
|
3588
3595
|
}
|
|
3589
|
-
|
|
3596
|
+
K.regexp_eatUnicodePropertyValueExpression = function(e) {
|
|
3590
3597
|
var t = e.pos;
|
|
3591
3598
|
if (this.regexp_eatUnicodePropertyName(e) && e.eat(61)) {
|
|
3592
3599
|
var n = e.lastStringValue;
|
|
3593
3600
|
if (this.regexp_eatUnicodePropertyValue(e)) {
|
|
3594
3601
|
var r = e.lastStringValue;
|
|
3595
|
-
return this.regexp_validateUnicodePropertyNameAndValue(e, n, r),
|
|
3602
|
+
return this.regexp_validateUnicodePropertyNameAndValue(e, n, r), J;
|
|
3596
3603
|
}
|
|
3597
3604
|
}
|
|
3598
3605
|
if (e.pos = t, this.regexp_eatLoneUnicodePropertyNameOrValue(e)) {
|
|
3599
3606
|
var i = e.lastStringValue;
|
|
3600
3607
|
return this.regexp_validateUnicodePropertyNameOrValue(e, i);
|
|
3601
3608
|
}
|
|
3602
|
-
return
|
|
3603
|
-
},
|
|
3609
|
+
return At;
|
|
3610
|
+
}, K.regexp_validateUnicodePropertyNameAndValue = function(e, t, n) {
|
|
3604
3611
|
k(e.unicodeProperties.nonBinary, t) || e.raise("Invalid property name"), e.unicodeProperties.nonBinary[t].test(n) || e.raise("Invalid property value");
|
|
3605
|
-
},
|
|
3606
|
-
if (e.unicodeProperties.binary.test(t)) return
|
|
3607
|
-
if (e.switchV && e.unicodeProperties.binaryOfStrings.test(t)) return
|
|
3612
|
+
}, K.regexp_validateUnicodePropertyNameOrValue = function(e, t) {
|
|
3613
|
+
if (e.unicodeProperties.binary.test(t)) return J;
|
|
3614
|
+
if (e.switchV && e.unicodeProperties.binaryOfStrings.test(t)) return Y;
|
|
3608
3615
|
e.raise("Invalid property name");
|
|
3609
|
-
},
|
|
3616
|
+
}, K.regexp_eatUnicodePropertyName = function(e) {
|
|
3610
3617
|
var t = 0;
|
|
3611
|
-
for (e.lastStringValue = "";
|
|
3618
|
+
for (e.lastStringValue = ""; Mt(t = e.current());) e.lastStringValue += j(t), e.advance();
|
|
3612
3619
|
return e.lastStringValue !== "";
|
|
3613
3620
|
};
|
|
3614
|
-
function
|
|
3615
|
-
return
|
|
3621
|
+
function Mt(e) {
|
|
3622
|
+
return Ot(e) || e === 95;
|
|
3616
3623
|
}
|
|
3617
|
-
|
|
3624
|
+
K.regexp_eatUnicodePropertyValue = function(e) {
|
|
3618
3625
|
var t = 0;
|
|
3619
|
-
for (e.lastStringValue = "";
|
|
3626
|
+
for (e.lastStringValue = ""; Nt(t = e.current());) e.lastStringValue += j(t), e.advance();
|
|
3620
3627
|
return e.lastStringValue !== "";
|
|
3621
3628
|
};
|
|
3622
|
-
function
|
|
3623
|
-
return
|
|
3629
|
+
function Nt(e) {
|
|
3630
|
+
return Mt(e) || Lt(e);
|
|
3624
3631
|
}
|
|
3625
|
-
|
|
3632
|
+
K.regexp_eatLoneUnicodePropertyNameOrValue = function(e) {
|
|
3626
3633
|
return this.regexp_eatUnicodePropertyValue(e);
|
|
3627
|
-
},
|
|
3634
|
+
}, K.regexp_eatCharacterClass = function(e) {
|
|
3628
3635
|
if (e.eat(91)) {
|
|
3629
3636
|
var t = e.eat(94), n = this.regexp_classContents(e);
|
|
3630
|
-
return e.eat(93) || e.raise("Unterminated character class"), t && n ===
|
|
3637
|
+
return e.eat(93) || e.raise("Unterminated character class"), t && n === Y && e.raise("Negated character class may contain strings"), !0;
|
|
3631
3638
|
}
|
|
3632
3639
|
return !1;
|
|
3633
|
-
},
|
|
3634
|
-
return e.current() === 93 ?
|
|
3635
|
-
},
|
|
3640
|
+
}, K.regexp_classContents = function(e) {
|
|
3641
|
+
return e.current() === 93 ? J : e.switchV ? this.regexp_classSetExpression(e) : (this.regexp_nonEmptyClassRanges(e), J);
|
|
3642
|
+
}, K.regexp_nonEmptyClassRanges = function(e) {
|
|
3636
3643
|
for (; this.regexp_eatClassAtom(e);) {
|
|
3637
3644
|
var t = e.lastIntValue;
|
|
3638
3645
|
if (e.eat(45) && this.regexp_eatClassAtom(e)) {
|
|
@@ -3640,19 +3647,19 @@ q.regexp_eatLoneUnicodePropertyNameOrValue = function(e) {
|
|
|
3640
3647
|
e.switchU && (t === -1 || n === -1) && e.raise("Invalid character class"), t !== -1 && n !== -1 && t > n && e.raise("Range out of order in character class");
|
|
3641
3648
|
}
|
|
3642
3649
|
}
|
|
3643
|
-
},
|
|
3650
|
+
}, K.regexp_eatClassAtom = function(e) {
|
|
3644
3651
|
var t = e.pos;
|
|
3645
3652
|
if (e.eat(92)) {
|
|
3646
3653
|
if (this.regexp_eatClassEscape(e)) return !0;
|
|
3647
3654
|
if (e.switchU) {
|
|
3648
3655
|
var n = e.current();
|
|
3649
|
-
(n === 99 ||
|
|
3656
|
+
(n === 99 || Bt(n)) && e.raise("Invalid class escape"), e.raise("Invalid escape");
|
|
3650
3657
|
}
|
|
3651
3658
|
e.pos = t;
|
|
3652
3659
|
}
|
|
3653
3660
|
var r = e.current();
|
|
3654
3661
|
return r === 93 ? !1 : (e.lastIntValue = r, e.advance(), !0);
|
|
3655
|
-
},
|
|
3662
|
+
}, K.regexp_eatClassEscape = function(e) {
|
|
3656
3663
|
var t = e.pos;
|
|
3657
3664
|
if (e.eat(98)) return e.lastIntValue = 8, !0;
|
|
3658
3665
|
if (e.switchU && e.eat(45)) return e.lastIntValue = 45, !0;
|
|
@@ -3661,13 +3668,13 @@ q.regexp_eatLoneUnicodePropertyNameOrValue = function(e) {
|
|
|
3661
3668
|
e.pos = t;
|
|
3662
3669
|
}
|
|
3663
3670
|
return this.regexp_eatCharacterClassEscape(e) || this.regexp_eatCharacterEscape(e);
|
|
3664
|
-
},
|
|
3665
|
-
var t =
|
|
3671
|
+
}, K.regexp_classSetExpression = function(e) {
|
|
3672
|
+
var t = J, n;
|
|
3666
3673
|
if (!this.regexp_eatClassSetRange(e)) if (n = this.regexp_eatClassSetOperand(e)) {
|
|
3667
|
-
n ===
|
|
3674
|
+
n === Y && (t = Y);
|
|
3668
3675
|
for (var r = e.pos; e.eatChars([38, 38]);) {
|
|
3669
3676
|
if (e.current() !== 38 && (n = this.regexp_eatClassSetOperand(e))) {
|
|
3670
|
-
n !==
|
|
3677
|
+
n !== Y && (t = J);
|
|
3671
3678
|
continue;
|
|
3672
3679
|
}
|
|
3673
3680
|
e.raise("Invalid character in character class");
|
|
@@ -3678,9 +3685,9 @@ q.regexp_eatLoneUnicodePropertyNameOrValue = function(e) {
|
|
|
3678
3685
|
} else e.raise("Invalid character in character class");
|
|
3679
3686
|
for (;;) if (!this.regexp_eatClassSetRange(e)) {
|
|
3680
3687
|
if (n = this.regexp_eatClassSetOperand(e), !n) return t;
|
|
3681
|
-
n ===
|
|
3688
|
+
n === Y && (t = Y);
|
|
3682
3689
|
}
|
|
3683
|
-
},
|
|
3690
|
+
}, K.regexp_eatClassSetRange = function(e) {
|
|
3684
3691
|
var t = e.pos;
|
|
3685
3692
|
if (this.regexp_eatClassSetCharacter(e)) {
|
|
3686
3693
|
var n = e.lastIntValue;
|
|
@@ -3691,13 +3698,13 @@ q.regexp_eatLoneUnicodePropertyNameOrValue = function(e) {
|
|
|
3691
3698
|
e.pos = t;
|
|
3692
3699
|
}
|
|
3693
3700
|
return !1;
|
|
3694
|
-
},
|
|
3695
|
-
return this.regexp_eatClassSetCharacter(e) ?
|
|
3696
|
-
},
|
|
3701
|
+
}, K.regexp_eatClassSetOperand = function(e) {
|
|
3702
|
+
return this.regexp_eatClassSetCharacter(e) ? J : this.regexp_eatClassStringDisjunction(e) || this.regexp_eatNestedClass(e);
|
|
3703
|
+
}, K.regexp_eatNestedClass = function(e) {
|
|
3697
3704
|
var t = e.pos;
|
|
3698
3705
|
if (e.eat(91)) {
|
|
3699
3706
|
var n = e.eat(94), r = this.regexp_classContents(e);
|
|
3700
|
-
if (e.eat(93)) return n && r ===
|
|
3707
|
+
if (e.eat(93)) return n && r === Y && e.raise("Negated character class may contain strings"), r;
|
|
3701
3708
|
e.pos = t;
|
|
3702
3709
|
}
|
|
3703
3710
|
if (e.eat(92)) {
|
|
@@ -3706,7 +3713,7 @@ q.regexp_eatLoneUnicodePropertyNameOrValue = function(e) {
|
|
|
3706
3713
|
e.pos = t;
|
|
3707
3714
|
}
|
|
3708
3715
|
return null;
|
|
3709
|
-
},
|
|
3716
|
+
}, K.regexp_eatClassStringDisjunction = function(e) {
|
|
3710
3717
|
var t = e.pos;
|
|
3711
3718
|
if (e.eatChars([92, 113])) {
|
|
3712
3719
|
if (e.eat(123)) {
|
|
@@ -3716,61 +3723,61 @@ q.regexp_eatLoneUnicodePropertyNameOrValue = function(e) {
|
|
|
3716
3723
|
e.pos = t;
|
|
3717
3724
|
}
|
|
3718
3725
|
return null;
|
|
3719
|
-
},
|
|
3720
|
-
for (var t = this.regexp_classString(e); e.eat(124);) this.regexp_classString(e) ===
|
|
3726
|
+
}, K.regexp_classStringDisjunctionContents = function(e) {
|
|
3727
|
+
for (var t = this.regexp_classString(e); e.eat(124);) this.regexp_classString(e) === Y && (t = Y);
|
|
3721
3728
|
return t;
|
|
3722
|
-
},
|
|
3729
|
+
}, K.regexp_classString = function(e) {
|
|
3723
3730
|
for (var t = 0; this.regexp_eatClassSetCharacter(e);) t++;
|
|
3724
|
-
return t === 1 ?
|
|
3725
|
-
},
|
|
3731
|
+
return t === 1 ? J : Y;
|
|
3732
|
+
}, K.regexp_eatClassSetCharacter = function(e) {
|
|
3726
3733
|
var t = e.pos;
|
|
3727
3734
|
if (e.eat(92)) return this.regexp_eatCharacterEscape(e) || this.regexp_eatClassSetReservedPunctuator(e) ? !0 : e.eat(98) ? (e.lastIntValue = 8, !0) : (e.pos = t, !1);
|
|
3728
3735
|
var n = e.current();
|
|
3729
|
-
return n < 0 || n === e.lookahead() &&
|
|
3736
|
+
return n < 0 || n === e.lookahead() && Pt(n) || Ft(n) ? !1 : (e.advance(), e.lastIntValue = n, !0);
|
|
3730
3737
|
};
|
|
3731
|
-
function
|
|
3738
|
+
function Pt(e) {
|
|
3732
3739
|
return e === 33 || e >= 35 && e <= 38 || e >= 42 && e <= 44 || e === 46 || e >= 58 && e <= 64 || e === 94 || e === 96 || e === 126;
|
|
3733
3740
|
}
|
|
3734
|
-
function
|
|
3741
|
+
function Ft(e) {
|
|
3735
3742
|
return e === 40 || e === 41 || e === 45 || e === 47 || e >= 91 && e <= 93 || e >= 123 && e <= 125;
|
|
3736
3743
|
}
|
|
3737
|
-
|
|
3744
|
+
K.regexp_eatClassSetReservedPunctuator = function(e) {
|
|
3738
3745
|
var t = e.current();
|
|
3739
|
-
return
|
|
3746
|
+
return It(t) ? (e.lastIntValue = t, e.advance(), !0) : !1;
|
|
3740
3747
|
};
|
|
3741
|
-
function
|
|
3748
|
+
function It(e) {
|
|
3742
3749
|
return e === 33 || e === 35 || e === 37 || e === 38 || e === 44 || e === 45 || e >= 58 && e <= 62 || e === 64 || e === 96 || e === 126;
|
|
3743
3750
|
}
|
|
3744
|
-
|
|
3751
|
+
K.regexp_eatClassControlLetter = function(e) {
|
|
3745
3752
|
var t = e.current();
|
|
3746
|
-
return
|
|
3747
|
-
},
|
|
3753
|
+
return Lt(t) || t === 95 ? (e.lastIntValue = t % 32, e.advance(), !0) : !1;
|
|
3754
|
+
}, K.regexp_eatHexEscapeSequence = function(e) {
|
|
3748
3755
|
var t = e.pos;
|
|
3749
3756
|
if (e.eat(120)) {
|
|
3750
3757
|
if (this.regexp_eatFixedHexDigits(e, 2)) return !0;
|
|
3751
3758
|
e.switchU && e.raise("Invalid escape"), e.pos = t;
|
|
3752
3759
|
}
|
|
3753
3760
|
return !1;
|
|
3754
|
-
},
|
|
3761
|
+
}, K.regexp_eatDecimalDigits = function(e) {
|
|
3755
3762
|
var t = e.pos, n = 0;
|
|
3756
|
-
for (e.lastIntValue = 0;
|
|
3763
|
+
for (e.lastIntValue = 0; Lt(n = e.current());) e.lastIntValue = 10 * e.lastIntValue + (n - 48), e.advance();
|
|
3757
3764
|
return e.pos !== t;
|
|
3758
3765
|
};
|
|
3759
|
-
function
|
|
3766
|
+
function Lt(e) {
|
|
3760
3767
|
return e >= 48 && e <= 57;
|
|
3761
3768
|
}
|
|
3762
|
-
|
|
3769
|
+
K.regexp_eatHexDigits = function(e) {
|
|
3763
3770
|
var t = e.pos, n = 0;
|
|
3764
|
-
for (e.lastIntValue = 0;
|
|
3771
|
+
for (e.lastIntValue = 0; Rt(n = e.current());) e.lastIntValue = 16 * e.lastIntValue + zt(n), e.advance();
|
|
3765
3772
|
return e.pos !== t;
|
|
3766
3773
|
};
|
|
3767
|
-
function
|
|
3774
|
+
function Rt(e) {
|
|
3768
3775
|
return e >= 48 && e <= 57 || e >= 65 && e <= 70 || e >= 97 && e <= 102;
|
|
3769
3776
|
}
|
|
3770
|
-
function
|
|
3777
|
+
function zt(e) {
|
|
3771
3778
|
return e >= 65 && e <= 70 ? 10 + (e - 65) : e >= 97 && e <= 102 ? 10 + (e - 97) : e - 48;
|
|
3772
3779
|
}
|
|
3773
|
-
|
|
3780
|
+
K.regexp_eatLegacyOctalEscapeSequence = function(e) {
|
|
3774
3781
|
if (this.regexp_eatOctalDigit(e)) {
|
|
3775
3782
|
var t = e.lastIntValue;
|
|
3776
3783
|
if (this.regexp_eatOctalDigit(e)) {
|
|
@@ -3780,31 +3787,31 @@ q.regexp_eatLegacyOctalEscapeSequence = function(e) {
|
|
|
3780
3787
|
return !0;
|
|
3781
3788
|
}
|
|
3782
3789
|
return !1;
|
|
3783
|
-
},
|
|
3790
|
+
}, K.regexp_eatOctalDigit = function(e) {
|
|
3784
3791
|
var t = e.current();
|
|
3785
|
-
return
|
|
3792
|
+
return Bt(t) ? (e.lastIntValue = t - 48, e.advance(), !0) : (e.lastIntValue = 0, !1);
|
|
3786
3793
|
};
|
|
3787
|
-
function
|
|
3794
|
+
function Bt(e) {
|
|
3788
3795
|
return e >= 48 && e <= 55;
|
|
3789
3796
|
}
|
|
3790
|
-
|
|
3797
|
+
K.regexp_eatFixedHexDigits = function(e, t) {
|
|
3791
3798
|
var n = e.pos;
|
|
3792
3799
|
e.lastIntValue = 0;
|
|
3793
3800
|
for (var r = 0; r < t; ++r) {
|
|
3794
3801
|
var i = e.current();
|
|
3795
|
-
if (!
|
|
3796
|
-
e.lastIntValue = 16 * e.lastIntValue +
|
|
3802
|
+
if (!Rt(i)) return e.pos = n, !1;
|
|
3803
|
+
e.lastIntValue = 16 * e.lastIntValue + zt(i), e.advance();
|
|
3797
3804
|
}
|
|
3798
3805
|
return !0;
|
|
3799
3806
|
};
|
|
3800
|
-
var
|
|
3801
|
-
this.type = e.type, this.value = e.value, this.start = e.start, this.end = e.end, e.options.locations && (this.loc = new
|
|
3802
|
-
},
|
|
3803
|
-
|
|
3804
|
-
!e && this.type.keyword && this.containsEsc && this.raiseRecoverable(this.start, "Escape sequence in keyword " + this.type.keyword), this.options.onToken && this.options.onToken(new
|
|
3805
|
-
},
|
|
3806
|
-
return this.next(), new
|
|
3807
|
-
}, typeof Symbol < "u" && (
|
|
3807
|
+
var Vt = function(e) {
|
|
3808
|
+
this.type = e.type, this.value = e.value, this.start = e.start, this.end = e.end, e.options.locations && (this.loc = new _e(e, e.startLoc, e.endLoc)), e.options.ranges && (this.range = [e.start, e.end]);
|
|
3809
|
+
}, X = I.prototype;
|
|
3810
|
+
X.next = function(e) {
|
|
3811
|
+
!e && this.type.keyword && this.containsEsc && this.raiseRecoverable(this.start, "Escape sequence in keyword " + this.type.keyword), this.options.onToken && this.options.onToken(new Vt(this)), this.lastTokEnd = this.end, this.lastTokStart = this.start, this.lastTokEndLoc = this.endLoc, this.lastTokStartLoc = this.startLoc, this.nextToken();
|
|
3812
|
+
}, X.getToken = function() {
|
|
3813
|
+
return this.next(), new Vt(this);
|
|
3814
|
+
}, typeof Symbol < "u" && (X[Symbol.iterator] = function() {
|
|
3808
3815
|
var e = this;
|
|
3809
3816
|
return { next: function() {
|
|
3810
3817
|
var t = e.getToken();
|
|
@@ -3813,28 +3820,28 @@ Z.next = function(e) {
|
|
|
3813
3820
|
value: t
|
|
3814
3821
|
};
|
|
3815
3822
|
} };
|
|
3816
|
-
}),
|
|
3823
|
+
}), X.nextToken = function() {
|
|
3817
3824
|
var e = this.curContext();
|
|
3818
3825
|
if ((!e || !e.preserveSpace) && this.skipSpace(), this.start = this.pos, this.options.locations && (this.startLoc = this.curPosition()), this.pos >= this.input.length) return this.finishToken(T.eof);
|
|
3819
3826
|
if (e.override) return e.override(this);
|
|
3820
3827
|
this.readToken(this.fullCharCodeAtPos());
|
|
3821
|
-
},
|
|
3828
|
+
}, X.readToken = function(e) {
|
|
3822
3829
|
return v(e, this.options.ecmaVersion >= 6) || e === 92 ? this.readWord() : this.getTokenFromCode(e);
|
|
3823
|
-
},
|
|
3830
|
+
}, X.fullCharCodeAt = function(e) {
|
|
3824
3831
|
var t = this.input.charCodeAt(e);
|
|
3825
3832
|
if (t <= 55295 || t >= 56320) return t;
|
|
3826
3833
|
var n = this.input.charCodeAt(e + 1);
|
|
3827
3834
|
return n <= 56319 || n >= 57344 ? t : (t << 10) + n - 56613888;
|
|
3828
|
-
},
|
|
3835
|
+
}, X.fullCharCodeAtPos = function() {
|
|
3829
3836
|
return this.fullCharCodeAt(this.pos);
|
|
3830
|
-
},
|
|
3837
|
+
}, X.skipBlockComment = function() {
|
|
3831
3838
|
var e = this.options.onComment && this.curPosition(), t = this.pos, n = this.input.indexOf("*/", this.pos += 2);
|
|
3832
3839
|
if (n === -1 && this.raise(this.pos - 2, "Unterminated comment"), this.pos = n + 2, this.options.locations) for (var r = void 0, i = t; (r = ce(this.input, i, this.pos)) > -1;) ++this.curLine, i = this.lineStart = r;
|
|
3833
3840
|
this.options.onComment && this.options.onComment(!0, this.input.slice(t + 2, n), t, this.pos, e, this.curPosition());
|
|
3834
|
-
},
|
|
3841
|
+
}, X.skipLineComment = function(e) {
|
|
3835
3842
|
for (var t = this.pos, n = this.options.onComment && this.curPosition(), r = this.input.charCodeAt(this.pos += e); this.pos < this.input.length && !D(r);) r = this.input.charCodeAt(++this.pos);
|
|
3836
3843
|
this.options.onComment && this.options.onComment(!1, this.input.slice(t + e, this.pos), t, this.pos, n, this.curPosition());
|
|
3837
|
-
},
|
|
3844
|
+
}, X.skipSpace = function() {
|
|
3838
3845
|
loop: for (; this.pos < this.input.length;) {
|
|
3839
3846
|
var e = this.input.charCodeAt(this.pos);
|
|
3840
3847
|
switch (e) {
|
|
@@ -3863,36 +3870,36 @@ Z.next = function(e) {
|
|
|
3863
3870
|
else break loop;
|
|
3864
3871
|
}
|
|
3865
3872
|
}
|
|
3866
|
-
},
|
|
3873
|
+
}, X.finishToken = function(e, t) {
|
|
3867
3874
|
this.end = this.pos, this.options.locations && (this.endLoc = this.curPosition());
|
|
3868
3875
|
var n = this.type;
|
|
3869
3876
|
this.type = e, this.value = t, this.updateContext(n);
|
|
3870
|
-
},
|
|
3877
|
+
}, X.readToken_dot = function() {
|
|
3871
3878
|
var e = this.input.charCodeAt(this.pos + 1);
|
|
3872
3879
|
if (e >= 48 && e <= 57) return this.readNumber(!0);
|
|
3873
3880
|
var t = this.input.charCodeAt(this.pos + 2);
|
|
3874
3881
|
return this.options.ecmaVersion >= 6 && e === 46 && t === 46 ? (this.pos += 3, this.finishToken(T.ellipsis)) : (++this.pos, this.finishToken(T.dot));
|
|
3875
|
-
},
|
|
3882
|
+
}, X.readToken_slash = function() {
|
|
3876
3883
|
var e = this.input.charCodeAt(this.pos + 1);
|
|
3877
3884
|
return this.exprAllowed ? (++this.pos, this.readRegexp()) : e === 61 ? this.finishOp(T.assign, 2) : this.finishOp(T.slash, 1);
|
|
3878
|
-
},
|
|
3885
|
+
}, X.readToken_mult_modulo_exp = function(e) {
|
|
3879
3886
|
var t = this.input.charCodeAt(this.pos + 1), n = 1, r = e === 42 ? T.star : T.modulo;
|
|
3880
3887
|
return this.options.ecmaVersion >= 7 && e === 42 && t === 42 && (++n, r = T.starstar, t = this.input.charCodeAt(this.pos + 2)), t === 61 ? this.finishOp(T.assign, n + 1) : this.finishOp(r, n);
|
|
3881
|
-
},
|
|
3888
|
+
}, X.readToken_pipe_amp = function(e) {
|
|
3882
3889
|
var t = this.input.charCodeAt(this.pos + 1);
|
|
3883
3890
|
return t === e ? this.options.ecmaVersion >= 12 && this.input.charCodeAt(this.pos + 2) === 61 ? this.finishOp(T.assign, 3) : this.finishOp(e === 124 ? T.logicalOR : T.logicalAND, 2) : t === 61 ? this.finishOp(T.assign, 2) : this.finishOp(e === 124 ? T.bitwiseOR : T.bitwiseAND, 1);
|
|
3884
|
-
},
|
|
3891
|
+
}, X.readToken_caret = function() {
|
|
3885
3892
|
return this.input.charCodeAt(this.pos + 1) === 61 ? this.finishOp(T.assign, 2) : this.finishOp(T.bitwiseXOR, 1);
|
|
3886
|
-
},
|
|
3893
|
+
}, X.readToken_plus_min = function(e) {
|
|
3887
3894
|
var t = this.input.charCodeAt(this.pos + 1);
|
|
3888
3895
|
return t === e ? t === 45 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 62 && (this.lastTokEnd === 0 || E.test(this.input.slice(this.lastTokEnd, this.pos))) ? (this.skipLineComment(3), this.skipSpace(), this.nextToken()) : this.finishOp(T.incDec, 2) : t === 61 ? this.finishOp(T.assign, 2) : this.finishOp(T.plusMin, 1);
|
|
3889
|
-
},
|
|
3896
|
+
}, X.readToken_lt_gt = function(e) {
|
|
3890
3897
|
var t = this.input.charCodeAt(this.pos + 1), n = 1;
|
|
3891
3898
|
return t === e ? (n = e === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2, this.input.charCodeAt(this.pos + n) === 61 ? this.finishOp(T.assign, n + 1) : this.finishOp(T.bitShift, n)) : t === 33 && e === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 && this.input.charCodeAt(this.pos + 3) === 45 ? (this.skipLineComment(4), this.skipSpace(), this.nextToken()) : (t === 61 && (n = 2), this.finishOp(T.relational, n));
|
|
3892
|
-
},
|
|
3899
|
+
}, X.readToken_eq_excl = function(e) {
|
|
3893
3900
|
var t = this.input.charCodeAt(this.pos + 1);
|
|
3894
3901
|
return t === 61 ? this.finishOp(T.equality, this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2) : e === 61 && t === 62 && this.options.ecmaVersion >= 6 ? (this.pos += 2, this.finishToken(T.arrow)) : this.finishOp(e === 61 ? T.eq : T.prefix, 1);
|
|
3895
|
-
},
|
|
3902
|
+
}, X.readToken_question = function() {
|
|
3896
3903
|
var e = this.options.ecmaVersion;
|
|
3897
3904
|
if (e >= 11) {
|
|
3898
3905
|
var t = this.input.charCodeAt(this.pos + 1);
|
|
@@ -3903,11 +3910,11 @@ Z.next = function(e) {
|
|
|
3903
3910
|
if (t === 63) return e >= 12 && this.input.charCodeAt(this.pos + 2) === 61 ? this.finishOp(T.assign, 3) : this.finishOp(T.coalesce, 2);
|
|
3904
3911
|
}
|
|
3905
3912
|
return this.finishOp(T.question, 1);
|
|
3906
|
-
},
|
|
3913
|
+
}, X.readToken_numberSign = function() {
|
|
3907
3914
|
var e = this.options.ecmaVersion, t = 35;
|
|
3908
3915
|
if (e >= 13 && (++this.pos, t = this.fullCharCodeAtPos(), v(t, !0) || t === 92)) return this.finishToken(T.privateId, this.readWord1());
|
|
3909
3916
|
this.raise(this.pos, "Unexpected character '" + j(t) + "'");
|
|
3910
|
-
},
|
|
3917
|
+
}, X.getTokenFromCode = function(e) {
|
|
3911
3918
|
switch (e) {
|
|
3912
3919
|
case 46: return this.readToken_dot();
|
|
3913
3920
|
case 40: return ++this.pos, this.finishToken(T.parenL);
|
|
@@ -3957,10 +3964,10 @@ Z.next = function(e) {
|
|
|
3957
3964
|
case 35: return this.readToken_numberSign();
|
|
3958
3965
|
}
|
|
3959
3966
|
this.raise(this.pos, "Unexpected character '" + j(e) + "'");
|
|
3960
|
-
},
|
|
3967
|
+
}, X.finishOp = function(e, t) {
|
|
3961
3968
|
var n = this.input.slice(this.pos, this.pos + t);
|
|
3962
3969
|
return this.pos += t, this.finishToken(e, n);
|
|
3963
|
-
},
|
|
3970
|
+
}, X.readRegexp = function() {
|
|
3964
3971
|
for (var e, t, n = this.pos;;) {
|
|
3965
3972
|
this.pos >= this.input.length && this.raise(n, "Unterminated regular expression");
|
|
3966
3973
|
var r = this.input.charAt(this.pos);
|
|
@@ -3977,7 +3984,7 @@ Z.next = function(e) {
|
|
|
3977
3984
|
++this.pos;
|
|
3978
3985
|
var a = this.pos, o = this.readWord1();
|
|
3979
3986
|
this.containsEsc && this.unexpected(a);
|
|
3980
|
-
var s = this.regexpState ||= new
|
|
3987
|
+
var s = this.regexpState ||= new q(this);
|
|
3981
3988
|
s.reset(n, i, o), this.validateRegExpFlags(s), this.validateRegExpPattern(s);
|
|
3982
3989
|
var c = null;
|
|
3983
3990
|
try {
|
|
@@ -3988,7 +3995,7 @@ Z.next = function(e) {
|
|
|
3988
3995
|
flags: o,
|
|
3989
3996
|
value: c
|
|
3990
3997
|
});
|
|
3991
|
-
},
|
|
3998
|
+
}, X.readInt = function(e, t, n) {
|
|
3992
3999
|
for (var r = this.options.ecmaVersion >= 12 && t === void 0, i = n && this.input.charCodeAt(this.pos) === 48, a = this.pos, o = 0, s = 0, c = 0, l = t ?? Infinity; c < l; ++c, ++this.pos) {
|
|
3993
4000
|
var u = this.input.charCodeAt(this.pos), d = void 0;
|
|
3994
4001
|
if (r && u === 95) {
|
|
@@ -4000,31 +4007,31 @@ Z.next = function(e) {
|
|
|
4000
4007
|
}
|
|
4001
4008
|
return r && s === 95 && this.raiseRecoverable(this.pos - 1, "Numeric separator is not allowed at the last of digits"), this.pos === a || t != null && this.pos - a !== t ? null : o;
|
|
4002
4009
|
};
|
|
4003
|
-
function
|
|
4010
|
+
function Ht(e, t) {
|
|
4004
4011
|
return t ? parseInt(e, 8) : parseFloat(e.replace(/_/g, ""));
|
|
4005
4012
|
}
|
|
4006
|
-
function
|
|
4013
|
+
function Ut(e) {
|
|
4007
4014
|
return typeof BigInt == "function" ? BigInt(e.replace(/_/g, "")) : null;
|
|
4008
4015
|
}
|
|
4009
|
-
|
|
4016
|
+
X.readRadixNumber = function(e) {
|
|
4010
4017
|
var t = this.pos;
|
|
4011
4018
|
this.pos += 2;
|
|
4012
4019
|
var n = this.readInt(e);
|
|
4013
|
-
return n ?? this.raise(this.start + 2, "Expected number in radix " + e), this.options.ecmaVersion >= 11 && this.input.charCodeAt(this.pos) === 110 ? (n =
|
|
4014
|
-
},
|
|
4020
|
+
return n ?? this.raise(this.start + 2, "Expected number in radix " + e), this.options.ecmaVersion >= 11 && this.input.charCodeAt(this.pos) === 110 ? (n = Ut(this.input.slice(t, this.pos)), ++this.pos) : v(this.fullCharCodeAtPos()) && this.raise(this.pos, "Identifier directly after number"), this.finishToken(T.num, n);
|
|
4021
|
+
}, X.readNumber = function(e) {
|
|
4015
4022
|
var t = this.pos;
|
|
4016
4023
|
!e && this.readInt(10, void 0, !0) === null && this.raise(t, "Invalid number");
|
|
4017
4024
|
var n = this.pos - t >= 2 && this.input.charCodeAt(t) === 48;
|
|
4018
4025
|
n && this.strict && this.raise(t, "Invalid number");
|
|
4019
4026
|
var r = this.input.charCodeAt(this.pos);
|
|
4020
4027
|
if (!n && !e && this.options.ecmaVersion >= 11 && r === 110) {
|
|
4021
|
-
var i =
|
|
4028
|
+
var i = Ut(this.input.slice(t, this.pos));
|
|
4022
4029
|
return ++this.pos, v(this.fullCharCodeAtPos()) && this.raise(this.pos, "Identifier directly after number"), this.finishToken(T.num, i);
|
|
4023
4030
|
}
|
|
4024
4031
|
n && /[89]/.test(this.input.slice(t, this.pos)) && (n = !1), r === 46 && !n && (++this.pos, this.readInt(10), r = this.input.charCodeAt(this.pos)), (r === 69 || r === 101) && !n && (r = this.input.charCodeAt(++this.pos), (r === 43 || r === 45) && ++this.pos, this.readInt(10) === null && this.raise(t, "Invalid number")), v(this.fullCharCodeAtPos()) && this.raise(this.pos, "Identifier directly after number");
|
|
4025
|
-
var a =
|
|
4032
|
+
var a = Ht(this.input.slice(t, this.pos), n);
|
|
4026
4033
|
return this.finishToken(T.num, a);
|
|
4027
|
-
},
|
|
4034
|
+
}, X.readCodePoint = function() {
|
|
4028
4035
|
var e = this.input.charCodeAt(this.pos), t;
|
|
4029
4036
|
if (e === 123) {
|
|
4030
4037
|
this.options.ecmaVersion < 6 && this.unexpected();
|
|
@@ -4032,7 +4039,7 @@ Z.readRadixNumber = function(e) {
|
|
|
4032
4039
|
t = this.readHexChar(this.input.indexOf("}", this.pos) - this.pos), ++this.pos, t > 1114111 && this.invalidStringToken(n, "Code point out of bounds");
|
|
4033
4040
|
} else t = this.readHexChar(4);
|
|
4034
4041
|
return t;
|
|
4035
|
-
},
|
|
4042
|
+
}, X.readString = function(e) {
|
|
4036
4043
|
for (var t = "", n = ++this.pos;;) {
|
|
4037
4044
|
this.pos >= this.input.length && this.raise(this.start, "Unterminated string constant");
|
|
4038
4045
|
var r = this.input.charCodeAt(this.pos);
|
|
@@ -4041,20 +4048,20 @@ Z.readRadixNumber = function(e) {
|
|
|
4041
4048
|
}
|
|
4042
4049
|
return t += this.input.slice(n, this.pos++), this.finishToken(T.string, t);
|
|
4043
4050
|
};
|
|
4044
|
-
var
|
|
4045
|
-
|
|
4051
|
+
var Wt = {};
|
|
4052
|
+
X.tryReadTemplateToken = function() {
|
|
4046
4053
|
this.inTemplateElement = !0;
|
|
4047
4054
|
try {
|
|
4048
4055
|
this.readTmplToken();
|
|
4049
4056
|
} catch (e) {
|
|
4050
|
-
if (e ===
|
|
4057
|
+
if (e === Wt) this.readInvalidTemplateToken();
|
|
4051
4058
|
else throw e;
|
|
4052
4059
|
}
|
|
4053
4060
|
this.inTemplateElement = !1;
|
|
4054
|
-
},
|
|
4055
|
-
if (this.inTemplateElement && this.options.ecmaVersion >= 9) throw
|
|
4061
|
+
}, X.invalidStringToken = function(e, t) {
|
|
4062
|
+
if (this.inTemplateElement && this.options.ecmaVersion >= 9) throw Wt;
|
|
4056
4063
|
this.raise(e, t);
|
|
4057
|
-
},
|
|
4064
|
+
}, X.readTmplToken = function() {
|
|
4058
4065
|
for (var e = "", t = this.pos;;) {
|
|
4059
4066
|
this.pos >= this.input.length && this.raise(this.start, "Unterminated template");
|
|
4060
4067
|
var n = this.input.charCodeAt(this.pos);
|
|
@@ -4073,7 +4080,7 @@ Z.tryReadTemplateToken = function() {
|
|
|
4073
4080
|
this.options.locations && (++this.curLine, this.lineStart = this.pos), t = this.pos;
|
|
4074
4081
|
} else ++this.pos;
|
|
4075
4082
|
}
|
|
4076
|
-
},
|
|
4083
|
+
}, X.readInvalidTemplateToken = function() {
|
|
4077
4084
|
for (; this.pos < this.input.length; this.pos++) switch (this.input[this.pos]) {
|
|
4078
4085
|
case "\\":
|
|
4079
4086
|
++this.pos;
|
|
@@ -4088,7 +4095,7 @@ Z.tryReadTemplateToken = function() {
|
|
|
4088
4095
|
break;
|
|
4089
4096
|
}
|
|
4090
4097
|
this.raise(this.start, "Unterminated template");
|
|
4091
|
-
},
|
|
4098
|
+
}, X.readEscapedChar = function(e) {
|
|
4092
4099
|
var t = this.input.charCodeAt(++this.pos);
|
|
4093
4100
|
switch (++this.pos, t) {
|
|
4094
4101
|
case 110: return "\n";
|
|
@@ -4113,10 +4120,10 @@ Z.tryReadTemplateToken = function() {
|
|
|
4113
4120
|
}
|
|
4114
4121
|
return D(t) ? (this.options.locations && (this.lineStart = this.pos, ++this.curLine), "") : String.fromCharCode(t);
|
|
4115
4122
|
}
|
|
4116
|
-
},
|
|
4123
|
+
}, X.readHexChar = function(e) {
|
|
4117
4124
|
var t = this.pos, n = this.readInt(16, e);
|
|
4118
4125
|
return n === null && this.invalidStringToken(t, "Bad character escape sequence"), n;
|
|
4119
|
-
},
|
|
4126
|
+
}, X.readWord1 = function() {
|
|
4120
4127
|
this.containsEsc = !1;
|
|
4121
4128
|
for (var e = "", t = !0, n = this.pos, r = this.options.ecmaVersion >= 6; this.pos < this.input.length;) {
|
|
4122
4129
|
var i = this.fullCharCodeAtPos();
|
|
@@ -4131,46 +4138,46 @@ Z.tryReadTemplateToken = function() {
|
|
|
4131
4138
|
t = !1;
|
|
4132
4139
|
}
|
|
4133
4140
|
return e + this.input.slice(n, this.pos);
|
|
4134
|
-
},
|
|
4141
|
+
}, X.readWord = function() {
|
|
4135
4142
|
var e = this.readWord1(), t = T.name;
|
|
4136
4143
|
return this.keywords.test(e) && (t = oe[e]), this.finishToken(t, e);
|
|
4137
|
-
},
|
|
4138
|
-
Parser:
|
|
4144
|
+
}, I.acorn = {
|
|
4145
|
+
Parser: I,
|
|
4139
4146
|
version: "8.17.0",
|
|
4140
|
-
defaultOptions:
|
|
4141
|
-
Position:
|
|
4142
|
-
SourceLocation:
|
|
4143
|
-
getLineInfo:
|
|
4144
|
-
Node:
|
|
4147
|
+
defaultOptions: ye,
|
|
4148
|
+
Position: ge,
|
|
4149
|
+
SourceLocation: _e,
|
|
4150
|
+
getLineInfo: ve,
|
|
4151
|
+
Node: $e,
|
|
4145
4152
|
TokenType: b,
|
|
4146
4153
|
tokTypes: T,
|
|
4147
4154
|
keywordTypes: oe,
|
|
4148
|
-
TokContext:
|
|
4149
|
-
tokContexts:
|
|
4155
|
+
TokContext: V,
|
|
4156
|
+
tokContexts: H,
|
|
4150
4157
|
isIdentifierChar: y,
|
|
4151
4158
|
isIdentifierStart: v,
|
|
4152
|
-
Token:
|
|
4159
|
+
Token: Vt,
|
|
4153
4160
|
isNewLine: D,
|
|
4154
4161
|
lineBreak: E,
|
|
4155
4162
|
lineBreakG: se,
|
|
4156
4163
|
nonASCIIwhitespace: le
|
|
4157
4164
|
};
|
|
4158
|
-
function
|
|
4159
|
-
return
|
|
4165
|
+
function Gt(e, t) {
|
|
4166
|
+
return I.parse(e, t);
|
|
4160
4167
|
}
|
|
4161
|
-
function
|
|
4162
|
-
return
|
|
4168
|
+
function Kt(e, t, n) {
|
|
4169
|
+
return I.parseExpressionAt(e, t, n);
|
|
4163
4170
|
}
|
|
4164
4171
|
//#endregion
|
|
4165
4172
|
//#region src/transformer.ts
|
|
4166
|
-
function
|
|
4173
|
+
function qt(e) {
|
|
4167
4174
|
if (typeof e != "object" || !e) return e;
|
|
4168
|
-
if (Array.isArray(e)) return e.map(
|
|
4175
|
+
if (Array.isArray(e)) return e.map(qt);
|
|
4169
4176
|
let t = {};
|
|
4170
|
-
for (let n of Object.keys(e)) t[n] =
|
|
4177
|
+
for (let n of Object.keys(e)) t[n] = qt(e[n]);
|
|
4171
4178
|
return t;
|
|
4172
4179
|
}
|
|
4173
|
-
var
|
|
4180
|
+
var Jt = class {
|
|
4174
4181
|
rawAst;
|
|
4175
4182
|
constructor(e) {
|
|
4176
4183
|
this.rawAst = e;
|
|
@@ -4197,7 +4204,7 @@ var Kt = class {
|
|
|
4197
4204
|
};
|
|
4198
4205
|
if (e.type === n.Interpolation) return this.transformInterpolation(e);
|
|
4199
4206
|
if (e.type === n.If) {
|
|
4200
|
-
let t = typeof e.test == "string" && e.test.trim().length > 0 ?
|
|
4207
|
+
let t = typeof e.test == "string" && e.test.trim().length > 0 ? Kt(e.test, 0, { ecmaVersion: "latest" }) : e.test, n = null;
|
|
4201
4208
|
return Array.isArray(e.alternate) ? n = this.transformChildren(e.alternate) : e.alternate !== null && (n = this.transformNode(e.alternate)), {
|
|
4202
4209
|
...e,
|
|
4203
4210
|
test: t,
|
|
@@ -4207,20 +4214,35 @@ var Kt = class {
|
|
|
4207
4214
|
}
|
|
4208
4215
|
return e.type === n.For ? {
|
|
4209
4216
|
...e,
|
|
4210
|
-
iterable: typeof e.iterable == "string" ?
|
|
4211
|
-
key: typeof e.key == "string" && e.key.trim().length > 0 ?
|
|
4217
|
+
iterable: typeof e.iterable == "string" ? Kt(e.iterable, 0, { ecmaVersion: "latest" }) : e.iterable,
|
|
4218
|
+
key: typeof e.key == "string" && e.key.trim().length > 0 ? Kt(e.key, 0, { ecmaVersion: "latest" }) : e.key ?? null,
|
|
4212
4219
|
body: this.transformChildren(e.body)
|
|
4213
4220
|
} : e.type === n.Switch ? this.transformSwitchToIfChain(e) : e;
|
|
4214
4221
|
}
|
|
4215
4222
|
transformSwitchToIfChain(e) {
|
|
4216
|
-
let t = typeof e.discriminant == "string" ?
|
|
4223
|
+
let t = typeof e.discriminant == "string" ? Kt(e.discriminant, 0, { ecmaVersion: "latest" }) : e.discriminant, r = (i) => {
|
|
4217
4224
|
let a = e.cases[i];
|
|
4218
4225
|
if (!a) return null;
|
|
4219
|
-
if (a.expression === null)
|
|
4220
|
-
|
|
4226
|
+
if (a.expression === null) {
|
|
4227
|
+
let e = this.transformChildren(a.body), t = r(i + 1), o = null;
|
|
4228
|
+
return (Array.isArray(t) || t !== null && t.type === n.If) && (o = t), i > 0 && o === null ? e : {
|
|
4229
|
+
type: n.If,
|
|
4230
|
+
test: {
|
|
4231
|
+
type: "Literal",
|
|
4232
|
+
value: !0,
|
|
4233
|
+
raw: "true",
|
|
4234
|
+
start: 0,
|
|
4235
|
+
end: 0
|
|
4236
|
+
},
|
|
4237
|
+
consequent: e,
|
|
4238
|
+
alternate: o,
|
|
4239
|
+
loc: a.loc
|
|
4240
|
+
};
|
|
4241
|
+
}
|
|
4242
|
+
let o = typeof a.expression == "string" && a.expression.trim().length > 0 ? Kt(a.expression, 0, { ecmaVersion: "latest" }) : a.expression, s = {
|
|
4221
4243
|
type: "BinaryExpression",
|
|
4222
4244
|
operator: "===",
|
|
4223
|
-
left:
|
|
4245
|
+
left: qt(t),
|
|
4224
4246
|
right: o,
|
|
4225
4247
|
start: 0,
|
|
4226
4248
|
end: 0
|
|
@@ -4233,10 +4255,22 @@ var Kt = class {
|
|
|
4233
4255
|
loc: a.loc
|
|
4234
4256
|
};
|
|
4235
4257
|
}, i = r(0);
|
|
4236
|
-
return i ? Array.isArray(i) ? i
|
|
4258
|
+
return i ? Array.isArray(i) ? i.length === 0 ? {
|
|
4237
4259
|
type: n.Comment,
|
|
4238
4260
|
content: "empty switch",
|
|
4239
4261
|
loc: e.loc
|
|
4262
|
+
} : {
|
|
4263
|
+
type: n.If,
|
|
4264
|
+
test: {
|
|
4265
|
+
type: "Literal",
|
|
4266
|
+
value: !0,
|
|
4267
|
+
raw: "true",
|
|
4268
|
+
start: 0,
|
|
4269
|
+
end: 0
|
|
4270
|
+
},
|
|
4271
|
+
consequent: i,
|
|
4272
|
+
alternate: null,
|
|
4273
|
+
loc: e.loc
|
|
4240
4274
|
} : i : {
|
|
4241
4275
|
type: n.Comment,
|
|
4242
4276
|
content: "empty switch",
|
|
@@ -4247,7 +4281,7 @@ var Kt = class {
|
|
|
4247
4281
|
if (typeof e.expression != "string") return e;
|
|
4248
4282
|
let t;
|
|
4249
4283
|
try {
|
|
4250
|
-
t =
|
|
4284
|
+
t = Kt(e.expression, 0, {
|
|
4251
4285
|
ecmaVersion: "latest",
|
|
4252
4286
|
allowAwaitOutsideFunction: !0
|
|
4253
4287
|
});
|
|
@@ -4264,7 +4298,7 @@ var Kt = class {
|
|
|
4264
4298
|
if (e.type === n.Text && typeof e.content == "string") {
|
|
4265
4299
|
let t;
|
|
4266
4300
|
try {
|
|
4267
|
-
let n =
|
|
4301
|
+
let n = Gt(e.content, {
|
|
4268
4302
|
ecmaVersion: "latest",
|
|
4269
4303
|
sourceType: "module",
|
|
4270
4304
|
allowAwaitOutsideFunction: !0,
|
|
@@ -4294,7 +4328,7 @@ var Kt = class {
|
|
|
4294
4328
|
}
|
|
4295
4329
|
return !0;
|
|
4296
4330
|
}
|
|
4297
|
-
},
|
|
4331
|
+
}, Yt = class {
|
|
4298
4332
|
ast;
|
|
4299
4333
|
bytecode = [];
|
|
4300
4334
|
constants = [];
|
|
@@ -4465,18 +4499,25 @@ var Kt = class {
|
|
|
4465
4499
|
extractVarNames(e) {
|
|
4466
4500
|
if (!(!e || typeof e != "object")) {
|
|
4467
4501
|
if (e.type === "VariableDeclaration") for (let t of e.declarations) this.extractBindingIdentifiers(t.id);
|
|
4468
|
-
else if (e.type === "FunctionDeclaration" && e.id?.type === "Identifier") this.declaredVars.add(e.id.name);
|
|
4502
|
+
else if ((e.type === "FunctionDeclaration" || e.type === "ClassDeclaration") && e.id?.type === "Identifier") this.declaredVars.add(e.id.name);
|
|
4469
4503
|
else if (e.type === "ImportDeclaration" && Array.isArray(e.specifiers)) {
|
|
4470
4504
|
let t = typeof e.source?.value == "string" ? e.source.value : "";
|
|
4471
|
-
|
|
4505
|
+
if (e.specifiers.length === 0) this.imports.push({
|
|
4506
|
+
localName: "",
|
|
4507
|
+
source: t,
|
|
4508
|
+
isDefault: !1,
|
|
4509
|
+
isSideEffect: !0
|
|
4510
|
+
});
|
|
4511
|
+
else for (let n of e.specifiers) if (n.local?.type === "Identifier") {
|
|
4472
4512
|
let e = n.local.name;
|
|
4473
4513
|
this.declaredVars.add(e);
|
|
4474
|
-
let r = n.type === "ImportDefaultSpecifier", i = n.type === "ImportSpecifier" && n.imported?.type === "Identifier" ? n.imported.name : void 0;
|
|
4514
|
+
let r = n.type === "ImportDefaultSpecifier", i = n.type === "ImportNamespaceSpecifier", a = n.type === "ImportSpecifier" && n.imported?.type === "Identifier" ? n.imported.name : void 0;
|
|
4475
4515
|
this.imports.push({
|
|
4476
4516
|
localName: e,
|
|
4477
4517
|
source: t,
|
|
4478
4518
|
isDefault: r,
|
|
4479
|
-
|
|
4519
|
+
isNamespace: i,
|
|
4520
|
+
importedName: a
|
|
4480
4521
|
});
|
|
4481
4522
|
}
|
|
4482
4523
|
}
|
|
@@ -4486,7 +4527,7 @@ var Kt = class {
|
|
|
4486
4527
|
if (!(!e || typeof e != "object")) if (e.type === "Identifier") this.declaredVars.add(e.name);
|
|
4487
4528
|
else if (e.type === "ObjectPattern" && Array.isArray(e.properties)) for (let t of e.properties) t.type === "Property" ? this.extractBindingIdentifiers(t.value) : t.type === "RestElement" && this.extractBindingIdentifiers(t.argument);
|
|
4488
4529
|
else if (e.type === "ArrayPattern" && Array.isArray(e.elements)) for (let t of e.elements) t && this.extractBindingIdentifiers(t);
|
|
4489
|
-
else e.type === "AssignmentPattern"
|
|
4530
|
+
else e.type === "AssignmentPattern" ? this.extractBindingIdentifiers(e.left) : e.type === "RestElement" && this.extractBindingIdentifiers(e.argument);
|
|
4490
4531
|
}
|
|
4491
4532
|
extractIdentifiers(e) {
|
|
4492
4533
|
let t = /* @__PURE__ */ new Set();
|
|
@@ -4554,6 +4595,27 @@ var Kt = class {
|
|
|
4554
4595
|
if (e.test) for (let n of this.extractIdentifiers(e.test)) t.add(n);
|
|
4555
4596
|
if (e.body) for (let n of this.extractIdentifiers(e.body)) t.add(n);
|
|
4556
4597
|
break;
|
|
4598
|
+
case "AwaitExpression":
|
|
4599
|
+
case "YieldExpression":
|
|
4600
|
+
case "ThrowStatement":
|
|
4601
|
+
if (e.argument) for (let n of this.extractIdentifiers(e.argument)) t.add(n);
|
|
4602
|
+
break;
|
|
4603
|
+
case "TryStatement":
|
|
4604
|
+
if (e.block) for (let n of this.extractIdentifiers(e.block)) t.add(n);
|
|
4605
|
+
if (e.handler) for (let n of this.extractIdentifiers(e.handler)) t.add(n);
|
|
4606
|
+
if (e.finalizer) for (let n of this.extractIdentifiers(e.finalizer)) t.add(n);
|
|
4607
|
+
break;
|
|
4608
|
+
case "CatchClause":
|
|
4609
|
+
if (e.body) for (let n of this.extractIdentifiers(e.body)) t.add(n);
|
|
4610
|
+
break;
|
|
4611
|
+
case "SwitchStatement":
|
|
4612
|
+
if (e.discriminant) for (let n of this.extractIdentifiers(e.discriminant)) t.add(n);
|
|
4613
|
+
if (e.cases) for (let n of e.cases) for (let e of this.extractIdentifiers(n)) t.add(e);
|
|
4614
|
+
break;
|
|
4615
|
+
case "SwitchCase":
|
|
4616
|
+
if (e.test) for (let n of this.extractIdentifiers(e.test)) t.add(n);
|
|
4617
|
+
if (e.consequent) for (let n of e.consequent) for (let e of this.extractIdentifiers(n)) t.add(e);
|
|
4618
|
+
break;
|
|
4557
4619
|
}
|
|
4558
4620
|
return t;
|
|
4559
4621
|
}
|
|
@@ -4577,7 +4639,7 @@ var Kt = class {
|
|
|
4577
4639
|
return this.nextRegisterId++;
|
|
4578
4640
|
}
|
|
4579
4641
|
addConstant(e) {
|
|
4580
|
-
e && typeof e == "object" && e.type && typeof e.type == "string"
|
|
4642
|
+
e && typeof e == "object" && e.type && typeof e.type == "string" ? e = { __drift_fn__: `(scope, declaredVars, setScopeValue, inScopeChain, resolveIterable) => (${$(e)})` } : Array.isArray(e) && e.length > 0 && typeof e[0] == "object" && e[0]?.type && (e = { __drift_fn__: `(scope, declaredVars, setScopeValue, inScopeChain, resolveIterable) => { ${$(e)}; }` });
|
|
4581
4643
|
let t = this.constants.findIndex((t) => this.isConstantEqual(t, e));
|
|
4582
4644
|
return t === -1 ? (this.constants.push(e), this.constants.length - 1) : t;
|
|
4583
4645
|
}
|
|
@@ -4587,29 +4649,40 @@ var Kt = class {
|
|
|
4587
4649
|
emit(e, ...t) {
|
|
4588
4650
|
this.bytecode.push(e, ...t);
|
|
4589
4651
|
}
|
|
4590
|
-
emitJumpIfFalsePlaceholder(e) {
|
|
4591
|
-
let t = this.bytecode.length;
|
|
4592
|
-
return this.bytecode.push(a.JUMP_IF_FALSE, e, 0, 0), t;
|
|
4593
|
-
}
|
|
4594
|
-
emitJumpPlaceholder() {
|
|
4595
|
-
let e = this.bytecode.length;
|
|
4596
|
-
return this.bytecode.push(a.JUMP, 0, 0), e;
|
|
4597
|
-
}
|
|
4598
|
-
emitJump(e) {
|
|
4599
|
-
let t = e >> 8 & 255, n = e & 255;
|
|
4600
|
-
this.bytecode.push(a.JUMP, t, n);
|
|
4601
|
-
}
|
|
4602
|
-
emitLoopIterPlaceholder(e, t, n, r, i) {
|
|
4603
|
-
let o = this.bytecode.length, s = r >> 8 & 255, c = r & 255, l = i >> 8 & 255, u = i & 255;
|
|
4604
|
-
return this.bytecode.push(a.LOOP_ITER, e, t, n, s, c, l, u, 0, 0), o;
|
|
4605
|
-
}
|
|
4606
|
-
patchJump(e, t) {
|
|
4607
|
-
let n = t >> 8 & 255, r = t & 255, i = this.bytecode[e];
|
|
4608
|
-
i === a.JUMP_IF_FALSE ? (this.bytecode[e + 2] = n, this.bytecode[e + 3] = r) : i === a.JUMP ? (this.bytecode[e + 1] = n, this.bytecode[e + 2] = r) : i === a.LOOP_ITER && (this.bytecode[e + 8] = n, this.bytecode[e + 9] = r);
|
|
4609
|
-
}
|
|
4610
4652
|
};
|
|
4611
|
-
function
|
|
4612
|
-
return !e || typeof e != "object" ? null : e.type === "Identifier" ? e.name : e.type === "MemberExpression" ?
|
|
4653
|
+
function Xt(e) {
|
|
4654
|
+
return !e || typeof e != "object" ? null : e.type === "Identifier" ? e.name : e.type === "MemberExpression" ? Xt(e.object) : null;
|
|
4655
|
+
}
|
|
4656
|
+
function Z(e) {
|
|
4657
|
+
let t = [];
|
|
4658
|
+
function n(e) {
|
|
4659
|
+
if (!(!e || typeof e != "object")) if (e.type === "Identifier") t.push(e.name);
|
|
4660
|
+
else if (e.type === "ObjectPattern" && Array.isArray(e.properties)) for (let t of e.properties) t.type === "Property" ? n(t.value) : t.type === "RestElement" && n(t.argument);
|
|
4661
|
+
else if (e.type === "ArrayPattern" && Array.isArray(e.elements)) for (let t of e.elements) t && n(t);
|
|
4662
|
+
else e.type === "AssignmentPattern" ? n(e.left) : e.type === "RestElement" && n(e.argument);
|
|
4663
|
+
}
|
|
4664
|
+
return n(e), t;
|
|
4665
|
+
}
|
|
4666
|
+
function Q(e, t) {
|
|
4667
|
+
if (!e) return "";
|
|
4668
|
+
switch (e.type) {
|
|
4669
|
+
case "Identifier": return e.name;
|
|
4670
|
+
case "AssignmentPattern": return `${Q(e.left, t)} = ${$(e.right, t)}`;
|
|
4671
|
+
case "RestElement": return `...${Q(e.argument, t)}`;
|
|
4672
|
+
case "ArrayPattern": return `[${(e.elements || []).map((e) => e ? Q(e, t) : "").join(", ")}]`;
|
|
4673
|
+
case "ObjectPattern": return `{ ${(e.properties || []).map((e) => {
|
|
4674
|
+
if (e.type === "Property") {
|
|
4675
|
+
let n = e.key?.name || (typeof e.key?.value == "string" ? JSON.stringify(e.key.value) : e.key?.value ? String(e.key.value) : $(e.key, t));
|
|
4676
|
+
if (e.value?.type === "AssignmentPattern") {
|
|
4677
|
+
let r = e.value.left?.name || Q(e.value.left, t), i = $(e.value.right, t);
|
|
4678
|
+
return n === r || e.shorthand ? `${n} = ${i}` : `${n}: ${r} = ${i}`;
|
|
4679
|
+
} else if (e.value?.type === "Identifier" && e.value.name === n) return n;
|
|
4680
|
+
else return `${n}: ${Q(e.value, t)}`;
|
|
4681
|
+
} else if (e.type === "RestElement") return `...${Q(e.argument, t)}`;
|
|
4682
|
+
return "";
|
|
4683
|
+
}).filter(Boolean).join(", ")} }`;
|
|
4684
|
+
default: return e.name || $(e, t);
|
|
4685
|
+
}
|
|
4613
4686
|
}
|
|
4614
4687
|
function $(e, t) {
|
|
4615
4688
|
if (e == null) return "undefined";
|
|
@@ -4621,12 +4694,14 @@ function $(e, t) {
|
|
|
4621
4694
|
case "BinaryExpression":
|
|
4622
4695
|
case "LogicalExpression": return `(${$(e.left, t)} ${e.operator} ${$(e.right, t)})`;
|
|
4623
4696
|
case "UnaryExpression": return `(${e.operator} ${$(e.argument, t)})`;
|
|
4697
|
+
case "AwaitExpression": return `(await ${$(e.argument, t)})`;
|
|
4698
|
+
case "YieldExpression": return e.delegate ? `(yield* ${e.argument ? $(e.argument, t) : ""})` : `(yield ${e.argument ? $(e.argument, t) : ""})`;
|
|
4624
4699
|
case "ConditionalExpression": return `(${$(e.test, t)} ? ${$(e.consequent, t)} : ${$(e.alternate, t)})`;
|
|
4625
4700
|
case "MemberExpression": return e.computed ? `(${$(e.object, t)}[${$(e.property, t)}])` : `(${$(e.object, t)}.${e.property.name})`;
|
|
4626
4701
|
case "CallExpression": {
|
|
4627
4702
|
let n = `(${$(e.callee, t)}(${e.arguments ? e.arguments.map((e) => $(e, t)).join(", ") : ""}))`;
|
|
4628
4703
|
if (e.callee?.type === "MemberExpression" && e.callee.property?.type === "Identifier") {
|
|
4629
|
-
let r =
|
|
4704
|
+
let r = Xt(e.callee.object), i = e.callee.property.name;
|
|
4630
4705
|
if (r && [
|
|
4631
4706
|
"push",
|
|
4632
4707
|
"pop",
|
|
@@ -4651,7 +4726,7 @@ function $(e, t) {
|
|
|
4651
4726
|
}
|
|
4652
4727
|
}
|
|
4653
4728
|
if (e.left?.type === "MemberExpression") {
|
|
4654
|
-
let r =
|
|
4729
|
+
let r = Xt(e.left), i = `(${$(e.left, t)} ${e.operator} ${n})`;
|
|
4655
4730
|
if (r && (!t || !t.has(r))) return `(() => { const _res = ${i}; if (typeof setScopeValue === 'function' && scope) setScopeValue(scope, ${JSON.stringify(r)}, scope[${JSON.stringify(r)}]); return _res; })()`;
|
|
4656
4731
|
}
|
|
4657
4732
|
if (e.left?.type === "ArrayPattern") {
|
|
@@ -4683,25 +4758,45 @@ function $(e, t) {
|
|
|
4683
4758
|
return e.prefix ? `(typeof setScopeValue === 'function' ? (setScopeValue(scope, ${JSON.stringify(n)}, (Number(scope[${JSON.stringify(n)}]) || 0) ${r} 1), scope[${JSON.stringify(n)}]) : ((scope || {})[${JSON.stringify(n)}] = (Number((scope || {})[${JSON.stringify(n)}]) || 0) ${r} 1))` : `(() => { const _v = Number(scope[${JSON.stringify(n)}]) || 0; if (typeof setScopeValue === 'function') setScopeValue(scope, ${JSON.stringify(n)}, _v ${r} 1); else (scope || {})[${JSON.stringify(n)}] = _v ${r} 1; return _v; })()`;
|
|
4684
4759
|
}
|
|
4685
4760
|
if (e.argument?.type === "MemberExpression") {
|
|
4686
|
-
let n =
|
|
4761
|
+
let n = Xt(e.argument), r = e.prefix ? `(${e.operator}${$(e.argument, t)})` : `(${$(e.argument, t)}${e.operator})`;
|
|
4687
4762
|
if (n && (!t || !t.has(n))) return `(() => { const _res = ${r}; if (typeof setScopeValue === 'function' && scope) setScopeValue(scope, ${JSON.stringify(n)}, scope[${JSON.stringify(n)}]); return _res; })()`;
|
|
4688
4763
|
}
|
|
4689
4764
|
return e.prefix ? `(${e.operator}${$(e.argument, t)})` : `(${$(e.argument, t)}${e.operator})`;
|
|
4690
4765
|
case "SequenceExpression": return `(${e.expressions ? e.expressions.map((e) => $(e, t)).join(", ") : ""})`;
|
|
4691
4766
|
case "ArrayExpression": return `[${e.elements ? e.elements.map((e) => e?.type === "SpreadElement" ? "..." + $(e.argument, t) : $(e, t)).join(", ") : ""}]`;
|
|
4692
4767
|
case "ObjectExpression": return `{${e.properties ? e.properties.map((e) => e.type === "SpreadElement" ? "..." + $(e.argument, t) : `${e.computed ? "[" + $(e.key, t) + "]" : e.key.name}: ${$(e.value, t)}`).join(", ") : ""}}`;
|
|
4768
|
+
case "RestElement":
|
|
4693
4769
|
case "SpreadElement": return `...${$(e.argument, t)}`;
|
|
4770
|
+
case "AssignmentPattern": return `${$(e.left, t)} = ${$(e.right, t)}`;
|
|
4694
4771
|
case "TemplateLiteral": return `\`${e.quasis ? e.quasis.map((n, r) => (n.value?.raw ?? "") + (e.expressions && e.expressions[r] ? "${" + $(e.expressions[r], t) + "}" : "")).join("") : ""}\``;
|
|
4695
4772
|
case "TaggedTemplateExpression": return `${$(e.tag, t)}${$(e.quasi, t)}`;
|
|
4696
4773
|
case "ThisExpression": return "scope";
|
|
4774
|
+
case "Super": return "super";
|
|
4697
4775
|
case "BlockStatement": {
|
|
4698
4776
|
let n = new Set(t);
|
|
4699
4777
|
return `{ ${(e.body ? e.body.map((e) => $(e, n)).filter(Boolean) : []).join("; ")}; }`;
|
|
4700
4778
|
}
|
|
4701
4779
|
case "ExpressionStatement": return $(e.expression, t);
|
|
4702
4780
|
case "ReturnStatement": return `return ${e.argument ? $(e.argument, t) : ""}`;
|
|
4781
|
+
case "ThrowStatement": return `throw ${e.argument ? $(e.argument, t) : ""}`;
|
|
4703
4782
|
case "BreakStatement": return e.label ? `break ${e.label.name}` : "break";
|
|
4704
4783
|
case "ContinueStatement": return e.label ? `continue ${e.label.name}` : "continue";
|
|
4784
|
+
case "LabeledStatement": return `${e.label.name}: ${$(e.body, t)}`;
|
|
4785
|
+
case "TryStatement": return `try ${$(e.block, t)} ${e.handler ? $(e.handler, t) : ""} ${e.finalizer ? `finally ${$(e.finalizer, t)}` : ""}`.trim();
|
|
4786
|
+
case "CatchClause": {
|
|
4787
|
+
let n = new Set(t), r = "";
|
|
4788
|
+
if (e.param) {
|
|
4789
|
+
for (let t of Z(e.param)) n.add(t);
|
|
4790
|
+
r = Q(e.param, t);
|
|
4791
|
+
}
|
|
4792
|
+
let i = $(e.body, n);
|
|
4793
|
+
return r ? `catch (${r}) ${i}` : `catch ${i}`;
|
|
4794
|
+
}
|
|
4795
|
+
case "SwitchStatement": return `switch (${$(e.discriminant, t)}) { ${e.cases ? e.cases.map((e) => $(e, t)).join(" ") : ""} }`;
|
|
4796
|
+
case "SwitchCase": {
|
|
4797
|
+
let n = e.test ? `case ${$(e.test, t)}:` : "default:", r = e.consequent ? e.consequent.map((e) => $(e, t)).filter(Boolean).join("; ") : "";
|
|
4798
|
+
return `${n} ${r ? r + ";" : ""}`;
|
|
4799
|
+
}
|
|
4705
4800
|
case "IfStatement": return `if (${$(e.test, t)}) ${e.consequent.type === "BlockStatement" ? $(e.consequent, t) : `{ ${$(e.consequent, t)}; }`}${e.alternate ? ` else ${e.alternate.type === "BlockStatement" || e.alternate.type === "IfStatement" ? $(e.alternate, t) : `{ ${$(e.alternate, t)}; }`}` : ""}`;
|
|
4706
4801
|
case "ForStatement": {
|
|
4707
4802
|
let n = new Set(t);
|
|
@@ -4740,8 +4835,35 @@ function $(e, t) {
|
|
|
4740
4835
|
let i = a.key?.name || (typeof a.key?.value == "string" ? a.key.value : $(a.key, t)), o = a.value?.name, s = null;
|
|
4741
4836
|
if (a.value?.type === "AssignmentPattern" ? (o = a.value.left?.name || $(a.value.left, t), s = $(a.value.right, t)) : o ||= $(a.value, t), o) {
|
|
4742
4837
|
n.add(o);
|
|
4743
|
-
let
|
|
4744
|
-
r.push(`(typeof setScopeValue === 'function' ? setScopeValue(scope, ${JSON.stringify(o)}, ${
|
|
4838
|
+
let a = `((${e} && (${JSON.stringify(i)} in ${e})) ? ${e}[${JSON.stringify(i)}] : ${s ?? "undefined"})`;
|
|
4839
|
+
t && t.has(o) ? r.push(`${o} = ${a}`) : r.push(`(typeof setScopeValue === 'function' ? setScopeValue(scope, ${JSON.stringify(o)}, ${a}) : ((scope || {})[${JSON.stringify(o)}] = ${a}))`);
|
|
4840
|
+
}
|
|
4841
|
+
}
|
|
4842
|
+
} else if (i.id?.type === "ArrayPattern") {
|
|
4843
|
+
let e = i.init ? $(i.init, t) : "undefined", a = i.id.elements || [];
|
|
4844
|
+
for (let i = 0; i < a.length; i++) {
|
|
4845
|
+
let o = a[i];
|
|
4846
|
+
if (o) {
|
|
4847
|
+
if (o.type === "Identifier") {
|
|
4848
|
+
let a = o.name;
|
|
4849
|
+
n.add(a);
|
|
4850
|
+
let s = `(${e} ? ${e}[${i}] : undefined)`;
|
|
4851
|
+
t && t.has(a) ? r.push(`${a} = ${s}`) : r.push(`(typeof setScopeValue === 'function' ? setScopeValue(scope, ${JSON.stringify(a)}, ${s}) : ((scope || {})[${JSON.stringify(a)}] = ${s}))`);
|
|
4852
|
+
} else if (o.type === "AssignmentPattern") {
|
|
4853
|
+
let a = o.left?.name || $(o.left, t), s = $(o.right, t);
|
|
4854
|
+
if (a) {
|
|
4855
|
+
n.add(a);
|
|
4856
|
+
let o = `((${e} && ${e}[${i}] !== undefined) ? ${e}[${i}] : ${s})`;
|
|
4857
|
+
t && t.has(a) ? r.push(`${a} = ${o}`) : r.push(`(typeof setScopeValue === 'function' ? setScopeValue(scope, ${JSON.stringify(a)}, ${o}) : ((scope || {})[${JSON.stringify(a)}] = ${o}))`);
|
|
4858
|
+
}
|
|
4859
|
+
} else if (o.type === "RestElement") {
|
|
4860
|
+
let a = o.argument?.name || $(o.argument, t);
|
|
4861
|
+
if (a) {
|
|
4862
|
+
n.add(a);
|
|
4863
|
+
let o = `((${e} && typeof ${e}.slice === 'function') ? ${e}.slice(${i}) : [])`;
|
|
4864
|
+
t && t.has(a) ? r.push(`${a} = ${o}`) : r.push(`(typeof setScopeValue === 'function' ? setScopeValue(scope, ${JSON.stringify(a)}, ${o}) : ((scope || {})[${JSON.stringify(a)}] = ${o}))`);
|
|
4865
|
+
}
|
|
4866
|
+
}
|
|
4745
4867
|
}
|
|
4746
4868
|
}
|
|
4747
4869
|
} else {
|
|
@@ -4756,33 +4878,52 @@ function $(e, t) {
|
|
|
4756
4878
|
let n = e.id?.name, r = new Set(t);
|
|
4757
4879
|
n && r.add(n);
|
|
4758
4880
|
let i = [];
|
|
4759
|
-
if (e.params) for (let n of e.params)
|
|
4760
|
-
let e
|
|
4761
|
-
|
|
4762
|
-
} else {
|
|
4763
|
-
let e = n.name || n.id?.name || n.left && n.left.name || $(n, t);
|
|
4764
|
-
e && (i.push(e), r.add(e));
|
|
4881
|
+
if (e.params) for (let n of e.params) {
|
|
4882
|
+
for (let e of Z(n)) r.add(e);
|
|
4883
|
+
i.push(Q(n, t));
|
|
4765
4884
|
}
|
|
4766
|
-
if (e.body?.type === "BlockStatement" && Array.isArray(e.body.body)) for (let t of e.body.body) if (t.type === "VariableDeclaration" && t.declarations) for (let e of t.declarations) e.id
|
|
4885
|
+
if (e.body?.type === "BlockStatement" && Array.isArray(e.body.body)) for (let t of e.body.body) if (t.type === "VariableDeclaration" && Array.isArray(t.declarations)) for (let e of t.declarations) for (let t of Z(e.id)) r.add(t);
|
|
4767
4886
|
else t.type === "FunctionDeclaration" && t.id?.name && r.add(t.id.name);
|
|
4768
|
-
let a = i.join(", "), o = e.body?.type === "BlockStatement" ? `{ ${e.body.body.map((e) => $(e, r)).filter(Boolean).join("; ")}; }` : `{ ${$(e.body, r)}; }`, s =
|
|
4887
|
+
let a = i.join(", "), o = e.body?.type === "BlockStatement" ? `{ ${e.body.body.map((e) => $(e, r)).filter(Boolean).join("; ")}; }` : `{ ${$(e.body, r)}; }`, s = `${e.async ? "async " : ""}function${e.generator ? "*" : ""} ${n || ""}(${a}) ${o}`;
|
|
4769
4888
|
return n ? `(typeof setScopeValue === 'function' ? setScopeValue(scope, ${JSON.stringify(n)}, ${s}) : ((scope || {})[${JSON.stringify(n)}] = ${s}))` : s;
|
|
4770
4889
|
}
|
|
4771
4890
|
case "ArrowFunctionExpression":
|
|
4772
4891
|
case "FunctionExpression": {
|
|
4773
|
-
let n = new Set(t)
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
e && (r.push(e), n.add(e));
|
|
4892
|
+
let n = new Set(t);
|
|
4893
|
+
e.id?.name && n.add(e.id.name);
|
|
4894
|
+
let r = [];
|
|
4895
|
+
if (e.params) for (let i of e.params) {
|
|
4896
|
+
for (let e of Z(i)) n.add(e);
|
|
4897
|
+
r.push(Q(i, t));
|
|
4780
4898
|
}
|
|
4781
|
-
if (e.body?.type === "BlockStatement" && Array.isArray(e.body.body)) for (let t of e.body.body) if (t.type === "VariableDeclaration" && t.declarations) for (let e of t.declarations) e.id
|
|
4899
|
+
if (e.body?.type === "BlockStatement" && Array.isArray(e.body.body)) for (let t of e.body.body) if (t.type === "VariableDeclaration" && Array.isArray(t.declarations)) for (let e of t.declarations) for (let t of Z(e.id)) n.add(t);
|
|
4782
4900
|
else t.type === "FunctionDeclaration" && t.id?.name && n.add(t.id.name);
|
|
4783
|
-
let i = r.join(", ");
|
|
4784
|
-
return e.body?.type === "BlockStatement" ? `((${i}) => ${`{ ${e.body.body.map((e) => $(e, n)).filter(Boolean).join("; ")}; }`})` : `((${i}) => ${$(e.body, n)})`;
|
|
4901
|
+
let i = r.join(", "), a = e.async ? "async " : "";
|
|
4902
|
+
if (e.type === "ArrowFunctionExpression") return e.body?.type === "BlockStatement" ? `(${a}(${i}) => ${`{ ${e.body.body.map((e) => $(e, n)).filter(Boolean).join("; ")}; }`})` : `(${a}(${i}) => ${$(e.body, n)})`;
|
|
4903
|
+
{
|
|
4904
|
+
let t = e.generator ? "*" : "", r = e.body?.type === "BlockStatement" ? `{ ${e.body.body.map((e) => $(e, n)).filter(Boolean).join("; ")}; }` : `{ ${$(e.body, n)}; }`;
|
|
4905
|
+
return `(${a}function${t} ${e.id?.name || ""}(${i}) ${r})`;
|
|
4906
|
+
}
|
|
4907
|
+
}
|
|
4908
|
+
case "ClassDeclaration":
|
|
4909
|
+
case "ClassExpression": {
|
|
4910
|
+
let n = e.id?.name, r = new Set(t);
|
|
4911
|
+
n && r.add(n);
|
|
4912
|
+
let i = e.superClass ? ` extends ${$(e.superClass, t)}` : "", a = $(e.body, r), o = `class ${n || ""}${i} ${a}`;
|
|
4913
|
+
return e.type === "ClassDeclaration" && n ? `(typeof setScopeValue === 'function' ? setScopeValue(scope, ${JSON.stringify(n)}, ${o}) : ((scope || {})[${JSON.stringify(n)}] = ${o}))` : `(${o})`;
|
|
4914
|
+
}
|
|
4915
|
+
case "ClassBody": return `{ ${(e.body ? e.body.map((e) => $(e, t)).filter(Boolean) : []).join("; ")} }`;
|
|
4916
|
+
case "MethodDefinition": {
|
|
4917
|
+
let n = e.static ? "static " : "", r = e.kind === "get" || e.kind === "set" ? `${e.kind} ` : "", i = e.value?.async ? "async " : "", a = e.value?.generator ? "*" : "", o = e.computed ? `[${$(e.key, t)}]` : e.key?.name || $(e.key, t), s = new Set(t), c = [];
|
|
4918
|
+
if (e.value?.params) for (let n of e.value.params) {
|
|
4919
|
+
for (let e of Z(n)) s.add(e);
|
|
4920
|
+
c.push(Q(n, t));
|
|
4921
|
+
}
|
|
4922
|
+
if (e.value?.body?.type === "BlockStatement" && Array.isArray(e.value.body.body)) for (let t of e.value.body.body) if (t.type === "VariableDeclaration" && Array.isArray(t.declarations)) for (let e of t.declarations) for (let t of Z(e.id)) s.add(t);
|
|
4923
|
+
else t.type === "FunctionDeclaration" && t.id?.name && s.add(t.id.name);
|
|
4924
|
+
return `${n}${i}${a}${r}${o}(${c.join(", ")}) ${e.value?.body ? $(e.value.body, s) : "{}"}`;
|
|
4785
4925
|
}
|
|
4926
|
+
case "PropertyDefinition": return `${e.static ? "static " : ""}${e.computed ? `[${$(e.key, t)}]` : e.key?.name || $(e.key, t)}${e.value ? ` = ${$(e.value, t)}` : ""}`;
|
|
4786
4927
|
case "NewExpression": return `new (${$(e.callee, t)})(${e.arguments ? e.arguments.map((e) => $(e, t)).join(", ") : ""})`;
|
|
4787
4928
|
case "EmptyStatement":
|
|
4788
4929
|
case "ImportDeclaration":
|
|
@@ -4796,9 +4937,9 @@ function $(e, t) {
|
|
|
4796
4937
|
}
|
|
4797
4938
|
//#endregion
|
|
4798
4939
|
//#region src/index.ts
|
|
4799
|
-
function
|
|
4800
|
-
let n = new
|
|
4940
|
+
function Zt(e, t = !1) {
|
|
4941
|
+
let n = new Jt(new f(new l(e)).parse()).transform(), r = new Yt(n).generate();
|
|
4801
4942
|
return t && (console.log("--- Transformed AST ---"), console.log(JSON.stringify(n, null, 2)), console.log("--- Compiled Module ---"), console.log(JSON.stringify(r, null, 2))), r;
|
|
4802
4943
|
}
|
|
4803
4944
|
//#endregion
|
|
4804
|
-
export { n as ASTNodeType,
|
|
4945
|
+
export { n as ASTNodeType, Yt as DriftGenerator, l as DriftLexer, r as DriftLexerError, f as DriftParser, i as DriftParserError, Jt as DriftTransformer, t as LexerStateKind, a as Opcode, e as TokenType, $ as astToJS, Zt as compile };
|