@voidzero-dev/vite-plus-core 0.1.23 → 0.1.24
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 +2 -2
- package/dist/rolldown/shared/binding-CXquf8ay.mjs +26 -26
- package/dist/rolldown/shared/bindingify-input-options-D2ORek5s.mjs +1 -1
- package/dist/tsdown/{build-5FURNVr0-CsM6vj3e.js → build-BZshaq8i-C7uS6x65.js} +142 -91
- package/dist/tsdown/{detect-DN3DXXYt-TsZBbdhI.js → detect-B97OSl92-CgjrIbmD.js} +1 -1
- package/dist/tsdown/{dist-wWM45aJq.js → dist-BHLOKn-2.js} +782 -1578
- package/dist/tsdown/index-types.d.ts +28 -12
- package/dist/tsdown/index.js +3 -3
- package/dist/tsdown/main-nVIFtu2j.js +938 -0
- package/dist/tsdown/{resolver-DkvdaW3s-Dz1U-gxd.js → resolver-DtsKFXi2-QB-x8j3e.js} +1 -1
- package/dist/tsdown/run.js +5 -5
- package/dist/tsdown/{tsc-Dp9emiKb.js → tsc-WMktM0FW.js} +3 -3
- package/dist/tsdown/{tsc-context-DXovbMXp.js → tsc-context-DKufFI_s.js} +2 -2
- package/dist/vite/node/chunks/logger.js +1 -1
- package/dist/vite/node/chunks/node.js +220 -114
- package/dist/vite/node/index.d.ts +2 -2
- package/package.json +8 -8
- package/dist/tsdown/chunk-DJK8HYOj.js +0 -34
- package/dist/tsdown/main-Cq8Is40L.js +0 -1173
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { n as globalContext, r as invalidateContextFile, t as createContext } from "./tsc-context-DXovbMXp.js";
|
|
1
|
+
import { A as __commonJSMin, M as __toESM, a as createDebug, j as __exportAll } from "./main-nVIFtu2j.js";
|
|
2
|
+
import { _ as filename_dts_to, b as replaceTemplateName, c as RE_CSS, d as RE_JS, f as RE_JSON, g as RE_VUE, h as RE_TS, l as RE_DTS, m as RE_ROLLDOWN_RUNTIME, o as at, p as RE_NODE_MODULES, s as ee, u as RE_DTS_MAP, v as filename_js_to_dts, x as resolveTemplateFn, y as filename_to_dts } from "./build-BZshaq8i-C7uS6x65.js";
|
|
3
|
+
import { n as globalContext, r as invalidateContextFile, t as createContext } from "./tsc-context-DKufFI_s.js";
|
|
5
4
|
import { createRequire } from "node:module";
|
|
6
5
|
import process from "node:process";
|
|
7
6
|
import { fork, spawn } from "node:child_process";
|
|
8
7
|
import path, { dirname, extname } from "node:path";
|
|
8
|
+
import { existsSync } from "node:fs";
|
|
9
9
|
import { mkdtemp, readFile, rm } from "node:fs/promises";
|
|
10
10
|
import { importerId, include } from "@voidzero-dev/vite-plus-core/rolldown/filter";
|
|
11
|
-
import { existsSync } from "node:fs";
|
|
12
11
|
import { tmpdir } from "node:os";
|
|
13
12
|
import { ResolverFactory, isolatedDeclarationSync } from "@voidzero-dev/vite-plus-core/rolldown/experimental";
|
|
14
13
|
//#region ../../node_modules/.pnpm/@jridgewell+sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
|
|
@@ -653,7 +652,7 @@ function addMappingInternal(skipable, map, mapping) {
|
|
|
653
652
|
return addSegmentInternal(skipable, map, generated.line - 1, generated.column, source, original.line - 1, original.column, name, content);
|
|
654
653
|
}
|
|
655
654
|
//#endregion
|
|
656
|
-
//#region ../../node_modules/.pnpm/@babel+helper-validator-identifier@8.0.0-rc.
|
|
655
|
+
//#region ../../node_modules/.pnpm/@babel+helper-validator-identifier@8.0.0-rc.6/node_modules/@babel/helper-validator-identifier/lib/index.js
|
|
657
656
|
const nonASCIIidentifierStart$1 = /* @__PURE__ */ new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽ-ೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-Ა-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ--ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]");
|
|
658
657
|
const nonASCIIidentifier$1 = /* @__PURE__ */ new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽ-ೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-Ა-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ--ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ--ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・]");
|
|
659
658
|
const astralIdentifierStartCodes$1 = [
|
|
@@ -1651,7 +1650,7 @@ function isIdentifierName(name) {
|
|
|
1651
1650
|
}
|
|
1652
1651
|
return !isFirst;
|
|
1653
1652
|
}
|
|
1654
|
-
const reservedWords$
|
|
1653
|
+
const reservedWords$1 = {
|
|
1655
1654
|
keyword: [
|
|
1656
1655
|
"break",
|
|
1657
1656
|
"case",
|
|
@@ -1702,20 +1701,20 @@ const reservedWords$2 = {
|
|
|
1702
1701
|
],
|
|
1703
1702
|
strictBind: ["eval", "arguments"]
|
|
1704
1703
|
};
|
|
1705
|
-
const keywords$
|
|
1706
|
-
const reservedWordsStrictSet$
|
|
1707
|
-
new Set(reservedWords$
|
|
1704
|
+
const keywords$2 = new Set(reservedWords$1.keyword);
|
|
1705
|
+
const reservedWordsStrictSet$1 = new Set(reservedWords$1.strict);
|
|
1706
|
+
new Set(reservedWords$1.strictBind);
|
|
1708
1707
|
function isReservedWord$1(word, inModule) {
|
|
1709
1708
|
return inModule && word === "await" || word === "enum";
|
|
1710
1709
|
}
|
|
1711
1710
|
function isStrictReservedWord$1(word, inModule) {
|
|
1712
|
-
return isReservedWord$1(word, inModule) || reservedWordsStrictSet$
|
|
1711
|
+
return isReservedWord$1(word, inModule) || reservedWordsStrictSet$1.has(word);
|
|
1713
1712
|
}
|
|
1714
1713
|
function isKeyword$1(word) {
|
|
1715
|
-
return keywords$
|
|
1714
|
+
return keywords$2.has(word);
|
|
1716
1715
|
}
|
|
1717
1716
|
//#endregion
|
|
1718
|
-
//#region ../../node_modules/.pnpm/@babel+helper-string-parser@8.0.0-rc.
|
|
1717
|
+
//#region ../../node_modules/.pnpm/@babel+helper-string-parser@8.0.0-rc.6/node_modules/@babel/helper-string-parser/lib/index.js
|
|
1719
1718
|
var _isDigit$1 = function isDigit(code) {
|
|
1720
1719
|
return code >= 48 && code <= 57;
|
|
1721
1720
|
};
|
|
@@ -1935,7 +1934,7 @@ function readCodePoint$1(input, pos, lineStart, curLine, throwOnInvalid, errors)
|
|
|
1935
1934
|
};
|
|
1936
1935
|
}
|
|
1937
1936
|
//#endregion
|
|
1938
|
-
//#region ../../node_modules/.pnpm/@babel+types@8.0.0-rc.
|
|
1937
|
+
//#region ../../node_modules/.pnpm/@babel+types@8.0.0-rc.6/node_modules/@babel/types/lib/index.js
|
|
1939
1938
|
var lib_exports = /* @__PURE__ */ __exportAll({
|
|
1940
1939
|
ACCESSOR_TYPES: () => ACCESSOR_TYPES,
|
|
1941
1940
|
ALIAS_KEYS: () => ALIAS_KEYS,
|
|
@@ -2829,7 +2828,7 @@ var lib_exports = /* @__PURE__ */ __exportAll({
|
|
|
2829
2828
|
isLet: () => isLet,
|
|
2830
2829
|
isLiteral: () => isLiteral$1,
|
|
2831
2830
|
isLogicalExpression: () => isLogicalExpression,
|
|
2832
|
-
isLoop: () => isLoop$
|
|
2831
|
+
isLoop: () => isLoop$1,
|
|
2833
2832
|
isMemberExpression: () => isMemberExpression$2,
|
|
2834
2833
|
isMetaProperty: () => isMetaProperty,
|
|
2835
2834
|
isMethod: () => isMethod,
|
|
@@ -4788,7 +4787,7 @@ function isConditional(node, opts) {
|
|
|
4788
4787
|
}
|
|
4789
4788
|
return opts == null || shallowEqual(node, opts);
|
|
4790
4789
|
}
|
|
4791
|
-
function isLoop$
|
|
4790
|
+
function isLoop$1(node, opts) {
|
|
4792
4791
|
if (!node) return false;
|
|
4793
4792
|
switch (node.type) {
|
|
4794
4793
|
case "DoWhileStatement":
|
|
@@ -13650,7 +13649,7 @@ const react = {
|
|
|
13650
13649
|
buildChildren
|
|
13651
13650
|
};
|
|
13652
13651
|
//#endregion
|
|
13653
|
-
//#region ../../node_modules/.pnpm/@babel+generator@8.0.0-rc.
|
|
13652
|
+
//#region ../../node_modules/.pnpm/@babel+generator@8.0.0-rc.6/node_modules/@babel/generator/lib/index.js
|
|
13654
13653
|
var import_jsesc = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
13655
13654
|
const object = {};
|
|
13656
13655
|
const hasOwnProperty = object.hasOwnProperty;
|
|
@@ -13881,7 +13880,7 @@ var SourceMap = class {
|
|
|
13881
13880
|
getRawMappings() {
|
|
13882
13881
|
return this._rawMappings ||= allMappings(this._map);
|
|
13883
13882
|
}
|
|
13884
|
-
mark(generated, line, column, identifierName, identifierNamePos, filename) {
|
|
13883
|
+
mark(generated, generatedIdentifierName, line, column, identifierName, identifierNamePos, filename) {
|
|
13885
13884
|
this._rawMappings = void 0;
|
|
13886
13885
|
let originalMapping;
|
|
13887
13886
|
if (line != null) if (this._inputMap) {
|
|
@@ -13889,7 +13888,8 @@ var SourceMap = class {
|
|
|
13889
13888
|
line,
|
|
13890
13889
|
column
|
|
13891
13890
|
});
|
|
13892
|
-
if (
|
|
13891
|
+
if (originalMapping.name && (identifierNamePos || identifierName != null && originalMapping.column === column)) identifierName = originalMapping.name;
|
|
13892
|
+
else if (identifierNamePos) {
|
|
13893
13893
|
const originalIdentifierMapping = originalPositionFor(this._inputMap, identifierNamePos);
|
|
13894
13894
|
if (originalIdentifierMapping.name) identifierName = originalIdentifierMapping.name;
|
|
13895
13895
|
}
|
|
@@ -13899,6 +13899,7 @@ var SourceMap = class {
|
|
|
13899
13899
|
line,
|
|
13900
13900
|
column
|
|
13901
13901
|
};
|
|
13902
|
+
if (identifierName != null && identifierName === generatedIdentifierName) identifierName = null;
|
|
13902
13903
|
maybeAddMapping(this._map, {
|
|
13903
13904
|
name: identifierName,
|
|
13904
13905
|
generated,
|
|
@@ -13971,9 +13972,9 @@ var Buffer$1 = class {
|
|
|
13971
13972
|
};
|
|
13972
13973
|
return result;
|
|
13973
13974
|
}
|
|
13974
|
-
append(str, maybeNewline) {
|
|
13975
|
+
append(str, maybeNewline, ignoreMapping = false) {
|
|
13975
13976
|
this._flush();
|
|
13976
|
-
this._append(str, maybeNewline);
|
|
13977
|
+
this._append(str, maybeNewline, ignoreMapping);
|
|
13977
13978
|
}
|
|
13978
13979
|
appendChar(char) {
|
|
13979
13980
|
this._flush();
|
|
@@ -14002,12 +14003,12 @@ var Buffer$1 = class {
|
|
|
14002
14003
|
if (this._map) {
|
|
14003
14004
|
const sourcePos = this._sourcePosition;
|
|
14004
14005
|
if (useSourcePos && sourcePos) {
|
|
14005
|
-
this._map.mark(position, sourcePos.line, sourcePos.column, isSpace ? void 0 : sourcePos.identifierName, isSpace ? void 0 : sourcePos.identifierNamePos, sourcePos.filename);
|
|
14006
|
+
this._map.mark(position, null, sourcePos.line, sourcePos.column, isSpace ? void 0 : sourcePos.identifierName, isSpace ? void 0 : sourcePos.identifierNamePos, sourcePos.filename);
|
|
14006
14007
|
if (!isSpace && this._canMarkIdName) {
|
|
14007
14008
|
sourcePos.identifierName = void 0;
|
|
14008
14009
|
sourcePos.identifierNamePos = void 0;
|
|
14009
14010
|
}
|
|
14010
|
-
} else this._map.mark(position);
|
|
14011
|
+
} else this._map.mark(position, null);
|
|
14011
14012
|
}
|
|
14012
14013
|
position.column += repeat;
|
|
14013
14014
|
} else {
|
|
@@ -14015,7 +14016,7 @@ var Buffer$1 = class {
|
|
|
14015
14016
|
position.column = 0;
|
|
14016
14017
|
}
|
|
14017
14018
|
}
|
|
14018
|
-
_append(str, maybeNewline) {
|
|
14019
|
+
_append(str, maybeNewline, ignoreMapping) {
|
|
14019
14020
|
const len = str.length;
|
|
14020
14021
|
const position = this._position;
|
|
14021
14022
|
const sourcePos = this._sourcePosition;
|
|
@@ -14026,7 +14027,7 @@ var Buffer$1 = class {
|
|
|
14026
14027
|
this._str = str;
|
|
14027
14028
|
this._appendCount = 0;
|
|
14028
14029
|
} else this._str += str;
|
|
14029
|
-
const hasMap = this._map !== null;
|
|
14030
|
+
const hasMap = !ignoreMapping && this._map !== null;
|
|
14030
14031
|
if (!maybeNewline && !hasMap) {
|
|
14031
14032
|
position.column += len;
|
|
14032
14033
|
return;
|
|
@@ -14039,14 +14040,14 @@ var Buffer$1 = class {
|
|
|
14039
14040
|
}
|
|
14040
14041
|
let i = str.indexOf("\n");
|
|
14041
14042
|
let last = 0;
|
|
14042
|
-
if (hasMap && i !== 0) this._map.mark(position, line, column, identifierName, identifierNamePos, filename);
|
|
14043
|
+
if (hasMap && i !== 0) this._map.mark(position, str, line, column, identifierName, identifierNamePos, filename);
|
|
14043
14044
|
while (i !== -1) {
|
|
14044
14045
|
position.line++;
|
|
14045
14046
|
position.column = 0;
|
|
14046
14047
|
last = i + 1;
|
|
14047
14048
|
if (last < len && line !== void 0) {
|
|
14048
14049
|
line++;
|
|
14049
|
-
if (hasMap) this._map.mark(position, line, 0, void 0, void 0, filename);
|
|
14050
|
+
if (hasMap) this._map.mark(position, str, line, 0, void 0, void 0, filename);
|
|
14050
14051
|
}
|
|
14051
14052
|
i = str.indexOf("\n", last);
|
|
14052
14053
|
}
|
|
@@ -14097,13 +14098,16 @@ var Buffer$1 = class {
|
|
|
14097
14098
|
_normalizePosition(prop, loc, columnOffset) {
|
|
14098
14099
|
this._flush();
|
|
14099
14100
|
const pos = loc[prop];
|
|
14100
|
-
const target = this._sourcePosition;
|
|
14101
14101
|
if (pos) {
|
|
14102
|
-
|
|
14103
|
-
|
|
14104
|
-
target.filename = loc.filename;
|
|
14102
|
+
this.setSourcePosition(pos.line, Math.max(pos.column + columnOffset, 0));
|
|
14103
|
+
this._sourcePosition.filename = loc.filename;
|
|
14105
14104
|
}
|
|
14106
14105
|
}
|
|
14106
|
+
setSourcePosition(line, column) {
|
|
14107
|
+
const target = this._sourcePosition;
|
|
14108
|
+
target.line = line;
|
|
14109
|
+
target.column = column;
|
|
14110
|
+
}
|
|
14107
14111
|
getCurrentColumn() {
|
|
14108
14112
|
return this._position.column + (this._queuedChar ? 1 : 0);
|
|
14109
14113
|
}
|
|
@@ -14966,6 +14970,9 @@ function _shouldPrintArrowParamsParens(node) {
|
|
|
14966
14970
|
if (this.format.retainLines) return true;
|
|
14967
14971
|
return false;
|
|
14968
14972
|
}
|
|
14973
|
+
function isRenamedIdentifier(id) {
|
|
14974
|
+
return !!id.loc?.identifierName && id.loc.identifierName !== id.name;
|
|
14975
|
+
}
|
|
14969
14976
|
function _getFuncIdName(idNode, parent) {
|
|
14970
14977
|
let id = idNode;
|
|
14971
14978
|
if (!id && parent) {
|
|
@@ -14976,18 +14983,22 @@ function _getFuncIdName(idNode, parent) {
|
|
|
14976
14983
|
if (!parent.computed || parent.key.type === "StringLiteral") id = parent.key;
|
|
14977
14984
|
} else if (parentType === "ClassPrivateProperty" || parentType === "ClassAccessorProperty") id = parent.key;
|
|
14978
14985
|
}
|
|
14979
|
-
if (!id) return;
|
|
14986
|
+
if (!id?.loc) return;
|
|
14980
14987
|
let nameInfo;
|
|
14981
|
-
if (id.type === "Identifier")
|
|
14982
|
-
|
|
14983
|
-
|
|
14984
|
-
|
|
14985
|
-
|
|
14986
|
-
|
|
14987
|
-
|
|
14988
|
-
|
|
14989
|
-
|
|
14990
|
-
|
|
14988
|
+
if (id.type === "Identifier") {
|
|
14989
|
+
if (!isRenamedIdentifier(id)) return;
|
|
14990
|
+
nameInfo = {
|
|
14991
|
+
pos: id.loc.start,
|
|
14992
|
+
name: id.loc.identifierName
|
|
14993
|
+
};
|
|
14994
|
+
} else if (id.type === "PrivateName") {
|
|
14995
|
+
if (!isRenamedIdentifier(id.id)) return;
|
|
14996
|
+
nameInfo = {
|
|
14997
|
+
pos: id.loc.start,
|
|
14998
|
+
name: "#" + id.id.loc.identifierName
|
|
14999
|
+
};
|
|
15000
|
+
} else if (id.type === "StringLiteral") nameInfo = {
|
|
15001
|
+
pos: id.loc.start,
|
|
14991
15002
|
name: id.value
|
|
14992
15003
|
};
|
|
14993
15004
|
return nameInfo;
|
|
@@ -15789,7 +15800,7 @@ function _getRawIdentifier(node) {
|
|
|
15789
15800
|
return lastRawIdentResult = node.name;
|
|
15790
15801
|
}
|
|
15791
15802
|
function Identifier(node) {
|
|
15792
|
-
if (this._buf._map
|
|
15803
|
+
if (this._buf._map && node.loc?.identifierName && node.loc.identifierName !== node.name) this.sourceIdentifierName(node.loc.identifierName);
|
|
15793
15804
|
this.word(this.tokenMap ? lastRawIdentResult : node.name);
|
|
15794
15805
|
}
|
|
15795
15806
|
function ArgumentPlaceholder() {
|
|
@@ -17476,7 +17487,8 @@ var Printer = class {
|
|
|
17476
17487
|
const spacesCount = count > 0 ? column : column - this._buf.getCurrentColumn();
|
|
17477
17488
|
if (spacesCount > 0) {
|
|
17478
17489
|
const spaces = this._originalCode ? this._originalCode.slice(index - spacesCount, index).replace(/[^\t\v\f\uFEFF\p{Space_Separator}]/gu, " ") : " ".repeat(spacesCount);
|
|
17479
|
-
this.
|
|
17490
|
+
this._buf.append(spaces, false, true);
|
|
17491
|
+
this._buf.setSourcePosition(line, column);
|
|
17480
17492
|
this.setLastChar(32);
|
|
17481
17493
|
}
|
|
17482
17494
|
}
|
|
@@ -17854,8 +17866,8 @@ function generate(ast, opts = {}, code) {
|
|
|
17854
17866
|
return new Printer(normalizeOptions(code, opts, ast), opts.sourceMaps ? new SourceMap(opts, code) : null, ast.tokens, typeof code === "string" ? code : null).generate(ast);
|
|
17855
17867
|
}
|
|
17856
17868
|
//#endregion
|
|
17857
|
-
//#region ../../node_modules/.pnpm/@babel+parser@8.0.0-rc.
|
|
17858
|
-
var Position
|
|
17869
|
+
//#region ../../node_modules/.pnpm/@babel+parser@8.0.0-rc.6/node_modules/@babel/parser/lib/index.js
|
|
17870
|
+
var Position = class {
|
|
17859
17871
|
constructor(line, col, index) {
|
|
17860
17872
|
this.line = void 0;
|
|
17861
17873
|
this.column = void 0;
|
|
@@ -17865,7 +17877,7 @@ var Position$1 = class {
|
|
|
17865
17877
|
if (index !== void 0) this.index = index;
|
|
17866
17878
|
}
|
|
17867
17879
|
};
|
|
17868
|
-
var SourceLocation
|
|
17880
|
+
var SourceLocation = class {
|
|
17869
17881
|
start;
|
|
17870
17882
|
end;
|
|
17871
17883
|
filename;
|
|
@@ -17877,20 +17889,20 @@ var SourceLocation$1 = class {
|
|
|
17877
17889
|
};
|
|
17878
17890
|
function createPositionWithColumnOffset(position, columnOffset) {
|
|
17879
17891
|
const { line, column, index } = position;
|
|
17880
|
-
return new Position
|
|
17892
|
+
return new Position(line, column + columnOffset, index + columnOffset);
|
|
17881
17893
|
}
|
|
17882
|
-
const code
|
|
17883
|
-
const ModuleErrors
|
|
17894
|
+
const code = "BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED";
|
|
17895
|
+
const ModuleErrors = {
|
|
17884
17896
|
ImportMetaOutsideModule: {
|
|
17885
17897
|
message: `import.meta may appear only with 'sourceType: "module"'`,
|
|
17886
|
-
code
|
|
17898
|
+
code
|
|
17887
17899
|
},
|
|
17888
17900
|
ImportOutsideModule: {
|
|
17889
17901
|
message: `'import' and 'export' may appear only with 'sourceType: "module"'`,
|
|
17890
|
-
code
|
|
17902
|
+
code
|
|
17891
17903
|
}
|
|
17892
17904
|
};
|
|
17893
|
-
const NodeDescriptions
|
|
17905
|
+
const NodeDescriptions = {
|
|
17894
17906
|
ArrayPattern: "array destructuring pattern",
|
|
17895
17907
|
AssignmentExpression: "assignment expression",
|
|
17896
17908
|
AssignmentPattern: "assignment expression",
|
|
@@ -17915,8 +17927,8 @@ const NodeDescriptions$1 = {
|
|
|
17915
17927
|
VariableDeclarator: "variable declaration",
|
|
17916
17928
|
YieldExpression: "yield expression"
|
|
17917
17929
|
};
|
|
17918
|
-
const toNodeDescription
|
|
17919
|
-
const StandardErrors
|
|
17930
|
+
const toNodeDescription = (node) => node.type === "UpdateExpression" ? NodeDescriptions.UpdateExpression[`${node.prefix}`] : NodeDescriptions[node.type];
|
|
17931
|
+
const StandardErrors = {
|
|
17920
17932
|
AccessorIsGenerator: ({ kind }) => `A ${kind}ter cannot be a generator.`,
|
|
17921
17933
|
ArgumentsInClass: "'arguments' is only allowed in functions and class methods.",
|
|
17922
17934
|
AsyncFunctionInSingleStatementContext: "Async functions can only be declared at the top level or inside a block.",
|
|
@@ -17934,7 +17946,6 @@ const StandardErrors$1 = {
|
|
|
17934
17946
|
ConstructorIsAsync: "Constructor can't be an async function.",
|
|
17935
17947
|
ConstructorIsGenerator: "Constructor can't be a generator.",
|
|
17936
17948
|
DeclarationMissingInitializer: ({ kind }) => `Missing initializer in ${kind} declaration.`,
|
|
17937
|
-
DecoratorAbstractMethod: "Decorators can't be used with an abstract method.",
|
|
17938
17949
|
DecoratorArgumentsOutsideParentheses: "Decorator arguments must be moved inside parentheses: use '@(decorator(args))' instead of '@(decorator)(args)'.",
|
|
17939
17950
|
DecoratorsBeforeAfterExport: "Decorators can be placed *either* before or after the 'export' keyword, but not in both locations at the same time.",
|
|
17940
17951
|
DecoratorConstructor: "Decorators can't be used with a constructor. Did you mean '@dec class { ... }'?",
|
|
@@ -17974,9 +17985,9 @@ const StandardErrors$1 = {
|
|
|
17974
17985
|
InvalidEscapeSequenceTemplate: "Invalid escape sequence in template.",
|
|
17975
17986
|
InvalidEscapedReservedWord: ({ reservedWord }) => `Escape sequence in keyword ${reservedWord}.`,
|
|
17976
17987
|
InvalidIdentifier: ({ identifierName }) => `Invalid identifier ${identifierName}.`,
|
|
17977
|
-
InvalidLhs: ({ ancestor }) => `Invalid left-hand side in ${toNodeDescription
|
|
17978
|
-
InvalidLhsBinding: ({ ancestor }) => `Binding invalid left-hand side in ${toNodeDescription
|
|
17979
|
-
InvalidLhsOptionalChaining: ({ ancestor }) => `Invalid optional chaining in the left-hand side of ${toNodeDescription
|
|
17988
|
+
InvalidLhs: ({ ancestor }) => `Invalid left-hand side in ${toNodeDescription(ancestor)}.`,
|
|
17989
|
+
InvalidLhsBinding: ({ ancestor }) => `Binding invalid left-hand side in ${toNodeDescription(ancestor)}.`,
|
|
17990
|
+
InvalidLhsOptionalChaining: ({ ancestor }) => `Invalid optional chaining in the left-hand side of ${toNodeDescription(ancestor)}.`,
|
|
17980
17991
|
InvalidNumber: "Invalid number.",
|
|
17981
17992
|
InvalidOrMissingExponent: "Floating-point numbers require a valid exponent after the 'e'.",
|
|
17982
17993
|
InvalidOrUnexpectedToken: ({ unexpected }) => `Unexpected character '${unexpected}'.`,
|
|
@@ -18058,7 +18069,7 @@ const StandardErrors$1 = {
|
|
|
18058
18069
|
YieldNotInGeneratorFunction: "'yield' is only allowed within generator functions.",
|
|
18059
18070
|
ZeroDigitNumericSeparator: "Numeric separator can not be used after leading 0."
|
|
18060
18071
|
};
|
|
18061
|
-
const StrictModeErrors
|
|
18072
|
+
const StrictModeErrors = {
|
|
18062
18073
|
StrictDelete: "Deleting local variable in strict mode.",
|
|
18063
18074
|
StrictEvalArguments: ({ referenceName }) => `Assigning to '${referenceName}' in strict mode.`,
|
|
18064
18075
|
StrictEvalArgumentsBinding: ({ bindingName }) => `Binding '${bindingName}' in strict mode.`,
|
|
@@ -18067,7 +18078,7 @@ const StrictModeErrors$1 = {
|
|
|
18067
18078
|
StrictOctalLiteral: "Legacy octal literals are not allowed in strict mode.",
|
|
18068
18079
|
StrictWith: "'with' in strict mode."
|
|
18069
18080
|
};
|
|
18070
|
-
const ParseExpressionErrors
|
|
18081
|
+
const ParseExpressionErrors = {
|
|
18071
18082
|
ParseExpressionEmptyInput: "Unexpected parseExpression() input: The input is empty or contains only comments.",
|
|
18072
18083
|
ParseExpressionExpectsEOF: ({ unexpected }) => `Unexpected parseExpression() input: The input should contain exactly one expression, but the first expression is followed by the unexpected character \`${String.fromCodePoint(unexpected)}\`.`
|
|
18073
18084
|
};
|
|
@@ -18077,26 +18088,26 @@ const UnparenthesizedPipeBodyDescriptions = new Set([
|
|
|
18077
18088
|
"ConditionalExpression",
|
|
18078
18089
|
"YieldExpression"
|
|
18079
18090
|
]);
|
|
18080
|
-
const PipelineOperatorErrors
|
|
18091
|
+
const PipelineOperatorErrors = {
|
|
18081
18092
|
PipeTopicRequiresHackPipes: "Topic references are only supported when using the `\"proposal\": \"hack\"` version of the pipeline proposal.",
|
|
18082
18093
|
PipeTopicUnbound: "Topic reference is unbound; it must be inside a pipe body.",
|
|
18083
18094
|
PipeTopicUnconfiguredToken: ({ token }) => `Invalid topic token ${token}. In order to use ${token} as a topic reference, the pipelineOperator plugin must be configured with { "proposal": "hack", "topicToken": "${token}" }.`,
|
|
18084
18095
|
PipeTopicUnused: "Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once.",
|
|
18085
|
-
PipeUnparenthesizedBody: ({ type }) => `Hack-style pipe body cannot be an unparenthesized ${toNodeDescription
|
|
18096
|
+
PipeUnparenthesizedBody: ({ type }) => `Hack-style pipe body cannot be an unparenthesized ${toNodeDescription({ type })}; please wrap it in parentheses.`,
|
|
18086
18097
|
PipelineUnparenthesized: "Cannot mix binary operator with solo-await F#-style pipeline. Please wrap the pipeline in parentheses."
|
|
18087
18098
|
};
|
|
18088
|
-
const FunctionBindErrors
|
|
18099
|
+
const FunctionBindErrors = {
|
|
18089
18100
|
UnsupportedBind: "Binding should be performed on object property.",
|
|
18090
18101
|
UnsupportedBindRHS: "The right-hand side of binding can not be super or import."
|
|
18091
18102
|
};
|
|
18092
|
-
function defineHidden
|
|
18103
|
+
function defineHidden(obj, key, value) {
|
|
18093
18104
|
Object.defineProperty(obj, key, {
|
|
18094
18105
|
enumerable: false,
|
|
18095
18106
|
configurable: true,
|
|
18096
18107
|
value
|
|
18097
18108
|
});
|
|
18098
18109
|
}
|
|
18099
|
-
function toParseErrorConstructor
|
|
18110
|
+
function toParseErrorConstructor({ toMessage, code, reasonCode, syntaxPlugin }) {
|
|
18100
18111
|
const hasMissingPlugin = reasonCode === "MissingPlugin" || reasonCode === "MissingOneOfPlugins";
|
|
18101
18112
|
return function constructor(loc, pos, details) {
|
|
18102
18113
|
const error = /* @__PURE__ */ new SyntaxError();
|
|
@@ -18106,14 +18117,14 @@ function toParseErrorConstructor$1({ toMessage, code, reasonCode, syntaxPlugin }
|
|
|
18106
18117
|
error.pos = pos;
|
|
18107
18118
|
error.syntaxPlugin = syntaxPlugin;
|
|
18108
18119
|
if (hasMissingPlugin) error.missingPlugin = details.missingPlugin;
|
|
18109
|
-
defineHidden
|
|
18120
|
+
defineHidden(error, "clone", function clone(overrides = {}) {
|
|
18110
18121
|
const { line, column, index = pos } = overrides.loc ?? loc;
|
|
18111
|
-
return constructor(new Position
|
|
18122
|
+
return constructor(new Position(line, column), index, {
|
|
18112
18123
|
...details,
|
|
18113
18124
|
...overrides.details
|
|
18114
18125
|
});
|
|
18115
18126
|
});
|
|
18116
|
-
defineHidden
|
|
18127
|
+
defineHidden(error, "details", details);
|
|
18117
18128
|
Object.defineProperty(error, "message", {
|
|
18118
18129
|
configurable: true,
|
|
18119
18130
|
get() {
|
|
@@ -18131,13 +18142,13 @@ function toParseErrorConstructor$1({ toMessage, code, reasonCode, syntaxPlugin }
|
|
|
18131
18142
|
return error;
|
|
18132
18143
|
};
|
|
18133
18144
|
}
|
|
18134
|
-
function ParseErrorEnum
|
|
18135
|
-
if (Array.isArray(argument)) return (parseErrorTemplates) => ParseErrorEnum
|
|
18145
|
+
function ParseErrorEnum(argument, syntaxPlugin) {
|
|
18146
|
+
if (Array.isArray(argument)) return (parseErrorTemplates) => ParseErrorEnum(parseErrorTemplates, argument[0]);
|
|
18136
18147
|
const ParseErrorConstructors = {};
|
|
18137
18148
|
for (const reasonCode of Object.keys(argument)) {
|
|
18138
18149
|
const template = argument[reasonCode];
|
|
18139
18150
|
const { message, ...rest } = typeof template === "string" ? { message: () => template } : typeof template === "function" ? { message: template } : template;
|
|
18140
|
-
ParseErrorConstructors[reasonCode] = toParseErrorConstructor
|
|
18151
|
+
ParseErrorConstructors[reasonCode] = toParseErrorConstructor({
|
|
18141
18152
|
code: "BABEL_PARSER_SYNTAX_ERROR",
|
|
18142
18153
|
reasonCode,
|
|
18143
18154
|
toMessage: typeof message === "string" ? () => message : message,
|
|
@@ -18147,13 +18158,13 @@ function ParseErrorEnum$1(argument, syntaxPlugin) {
|
|
|
18147
18158
|
}
|
|
18148
18159
|
return ParseErrorConstructors;
|
|
18149
18160
|
}
|
|
18150
|
-
const Errors
|
|
18151
|
-
...ParseErrorEnum
|
|
18152
|
-
...ParseErrorEnum
|
|
18153
|
-
...ParseErrorEnum
|
|
18154
|
-
...ParseErrorEnum
|
|
18155
|
-
...ParseErrorEnum
|
|
18156
|
-
...ParseErrorEnum
|
|
18161
|
+
const Errors = {
|
|
18162
|
+
...ParseErrorEnum(ModuleErrors),
|
|
18163
|
+
...ParseErrorEnum(StandardErrors),
|
|
18164
|
+
...ParseErrorEnum(StrictModeErrors),
|
|
18165
|
+
...ParseErrorEnum(ParseExpressionErrors),
|
|
18166
|
+
...ParseErrorEnum`pipelineOperator`(PipelineOperatorErrors),
|
|
18167
|
+
...ParseErrorEnum`functionBind`(FunctionBindErrors)
|
|
18157
18168
|
};
|
|
18158
18169
|
function createDefaultOptions() {
|
|
18159
18170
|
return {
|
|
@@ -18199,13 +18210,13 @@ function getOptions(opts) {
|
|
|
18199
18210
|
}
|
|
18200
18211
|
function toESTreeLocation(node) {
|
|
18201
18212
|
const { start, end } = node.loc;
|
|
18202
|
-
node.loc.start = new Position
|
|
18203
|
-
node.loc.end = new Position
|
|
18213
|
+
node.loc.start = new Position(start.line, start.column);
|
|
18214
|
+
node.loc.end = new Position(end.line, end.column);
|
|
18204
18215
|
return node;
|
|
18205
18216
|
}
|
|
18206
18217
|
const estree = (superClass) => class ESTreeParserMixin extends superClass {
|
|
18207
18218
|
createPosition(loc) {
|
|
18208
|
-
return new Position
|
|
18219
|
+
return new Position(loc.line, loc.column);
|
|
18209
18220
|
}
|
|
18210
18221
|
parse() {
|
|
18211
18222
|
const file = super.parse();
|
|
@@ -18404,8 +18415,8 @@ const estree = (superClass) => class ESTreeParserMixin extends superClass {
|
|
|
18404
18415
|
} else super.toAssignable(node, isLHS);
|
|
18405
18416
|
}
|
|
18406
18417
|
toAssignableObjectExpressionProp(prop, isLast, isLHS) {
|
|
18407
|
-
if (prop.type === "Property" && (prop.kind === "get" || prop.kind === "set")) this.raise(Errors
|
|
18408
|
-
else if (prop.type === "Property" && prop.method) this.raise(Errors
|
|
18418
|
+
if (prop.type === "Property" && (prop.kind === "get" || prop.kind === "set")) this.raise(Errors.PatternHasAccessor, prop.key);
|
|
18419
|
+
else if (prop.type === "Property" && prop.method) this.raise(Errors.PatternHasMethod, prop.key);
|
|
18409
18420
|
else super.toAssignableObjectExpressionProp(prop, isLast, isLHS);
|
|
18410
18421
|
}
|
|
18411
18422
|
finishCallExpression(unfinished, optional) {
|
|
@@ -18500,13 +18511,13 @@ const estree = (superClass) => class ESTreeParserMixin extends superClass {
|
|
|
18500
18511
|
toESTreeLocation(node);
|
|
18501
18512
|
}
|
|
18502
18513
|
};
|
|
18503
|
-
const beforeExpr
|
|
18504
|
-
const startsExpr
|
|
18505
|
-
const isLoop
|
|
18506
|
-
const isAssign
|
|
18507
|
-
const prefix
|
|
18508
|
-
const postfix
|
|
18509
|
-
var ExportedTokenType
|
|
18514
|
+
const beforeExpr = true;
|
|
18515
|
+
const startsExpr = true;
|
|
18516
|
+
const isLoop = true;
|
|
18517
|
+
const isAssign = true;
|
|
18518
|
+
const prefix = true;
|
|
18519
|
+
const postfix = true;
|
|
18520
|
+
var ExportedTokenType = class {
|
|
18510
18521
|
label;
|
|
18511
18522
|
keyword;
|
|
18512
18523
|
beforeExpr;
|
|
@@ -18530,300 +18541,300 @@ var ExportedTokenType$1 = class {
|
|
|
18530
18541
|
this.binop = conf.binop != null ? conf.binop : null;
|
|
18531
18542
|
}
|
|
18532
18543
|
};
|
|
18533
|
-
const keywords$1
|
|
18534
|
-
function createKeyword
|
|
18544
|
+
const keywords$1 = /* @__PURE__ */ new Map();
|
|
18545
|
+
function createKeyword(name, options = {}) {
|
|
18535
18546
|
options.keyword = name;
|
|
18536
|
-
const token = createToken
|
|
18537
|
-
keywords$1
|
|
18547
|
+
const token = createToken(name, options);
|
|
18548
|
+
keywords$1.set(name, token);
|
|
18538
18549
|
return token;
|
|
18539
18550
|
}
|
|
18540
|
-
function createBinop
|
|
18541
|
-
return createToken
|
|
18542
|
-
beforeExpr
|
|
18551
|
+
function createBinop(name, binop) {
|
|
18552
|
+
return createToken(name, {
|
|
18553
|
+
beforeExpr,
|
|
18543
18554
|
binop
|
|
18544
18555
|
});
|
|
18545
18556
|
}
|
|
18546
|
-
let tokenTypeCounter
|
|
18547
|
-
const tokenTypes
|
|
18548
|
-
const tokenLabels
|
|
18549
|
-
const tokenBinops
|
|
18550
|
-
const tokenBeforeExprs
|
|
18551
|
-
const tokenStartsExprs
|
|
18552
|
-
const tokenPrefixes
|
|
18553
|
-
function createToken
|
|
18554
|
-
++tokenTypeCounter
|
|
18555
|
-
tokenLabels
|
|
18556
|
-
tokenBinops
|
|
18557
|
-
tokenBeforeExprs
|
|
18558
|
-
tokenStartsExprs
|
|
18559
|
-
tokenPrefixes
|
|
18560
|
-
tokenTypes
|
|
18561
|
-
return tokenTypeCounter
|
|
18562
|
-
}
|
|
18563
|
-
function createKeywordLike
|
|
18564
|
-
++tokenTypeCounter
|
|
18565
|
-
keywords$1
|
|
18566
|
-
tokenLabels
|
|
18567
|
-
tokenBinops
|
|
18568
|
-
tokenBeforeExprs
|
|
18569
|
-
tokenStartsExprs
|
|
18570
|
-
tokenPrefixes
|
|
18571
|
-
tokenTypes
|
|
18572
|
-
return tokenTypeCounter
|
|
18573
|
-
}
|
|
18574
|
-
const tt
|
|
18575
|
-
bracketL: createToken
|
|
18576
|
-
beforeExpr
|
|
18577
|
-
startsExpr
|
|
18557
|
+
let tokenTypeCounter = -1;
|
|
18558
|
+
const tokenTypes = [];
|
|
18559
|
+
const tokenLabels = [];
|
|
18560
|
+
const tokenBinops = [];
|
|
18561
|
+
const tokenBeforeExprs = [];
|
|
18562
|
+
const tokenStartsExprs = [];
|
|
18563
|
+
const tokenPrefixes = [];
|
|
18564
|
+
function createToken(name, options = {}) {
|
|
18565
|
+
++tokenTypeCounter;
|
|
18566
|
+
tokenLabels.push(name);
|
|
18567
|
+
tokenBinops.push(options.binop ?? -1);
|
|
18568
|
+
tokenBeforeExprs.push(options.beforeExpr ?? false);
|
|
18569
|
+
tokenStartsExprs.push(options.startsExpr ?? false);
|
|
18570
|
+
tokenPrefixes.push(options.prefix ?? false);
|
|
18571
|
+
tokenTypes.push(new ExportedTokenType(name, options));
|
|
18572
|
+
return tokenTypeCounter;
|
|
18573
|
+
}
|
|
18574
|
+
function createKeywordLike(name, options = {}) {
|
|
18575
|
+
++tokenTypeCounter;
|
|
18576
|
+
keywords$1.set(name, tokenTypeCounter);
|
|
18577
|
+
tokenLabels.push(name);
|
|
18578
|
+
tokenBinops.push(options.binop ?? -1);
|
|
18579
|
+
tokenBeforeExprs.push(options.beforeExpr ?? false);
|
|
18580
|
+
tokenStartsExprs.push(options.startsExpr ?? false);
|
|
18581
|
+
tokenPrefixes.push(options.prefix ?? false);
|
|
18582
|
+
tokenTypes.push(new ExportedTokenType("name", options));
|
|
18583
|
+
return tokenTypeCounter;
|
|
18584
|
+
}
|
|
18585
|
+
const tt = {
|
|
18586
|
+
bracketL: createToken("[", {
|
|
18587
|
+
beforeExpr,
|
|
18588
|
+
startsExpr
|
|
18578
18589
|
}),
|
|
18579
|
-
bracketR: createToken
|
|
18580
|
-
braceL: createToken
|
|
18581
|
-
beforeExpr
|
|
18582
|
-
startsExpr
|
|
18590
|
+
bracketR: createToken("]"),
|
|
18591
|
+
braceL: createToken("{", {
|
|
18592
|
+
beforeExpr,
|
|
18593
|
+
startsExpr
|
|
18583
18594
|
}),
|
|
18584
|
-
braceBarL: createToken
|
|
18585
|
-
beforeExpr
|
|
18586
|
-
startsExpr
|
|
18595
|
+
braceBarL: createToken("{|", {
|
|
18596
|
+
beforeExpr,
|
|
18597
|
+
startsExpr
|
|
18587
18598
|
}),
|
|
18588
|
-
braceR: createToken
|
|
18589
|
-
braceBarR: createToken
|
|
18590
|
-
parenL: createToken
|
|
18591
|
-
beforeExpr
|
|
18592
|
-
startsExpr
|
|
18599
|
+
braceR: createToken("}"),
|
|
18600
|
+
braceBarR: createToken("|}"),
|
|
18601
|
+
parenL: createToken("(", {
|
|
18602
|
+
beforeExpr,
|
|
18603
|
+
startsExpr
|
|
18593
18604
|
}),
|
|
18594
|
-
parenR: createToken
|
|
18595
|
-
comma: createToken
|
|
18596
|
-
semi: createToken
|
|
18597
|
-
colon: createToken
|
|
18598
|
-
doubleColon: createToken
|
|
18599
|
-
dot: createToken
|
|
18600
|
-
question: createToken
|
|
18601
|
-
questionDot: createToken
|
|
18602
|
-
arrow: createToken
|
|
18603
|
-
template: createToken
|
|
18604
|
-
ellipsis: createToken
|
|
18605
|
-
backQuote: createToken
|
|
18606
|
-
dollarBraceL: createToken
|
|
18607
|
-
beforeExpr
|
|
18608
|
-
startsExpr
|
|
18605
|
+
parenR: createToken(")"),
|
|
18606
|
+
comma: createToken(",", { beforeExpr }),
|
|
18607
|
+
semi: createToken(";", { beforeExpr }),
|
|
18608
|
+
colon: createToken(":", { beforeExpr }),
|
|
18609
|
+
doubleColon: createToken("::", { beforeExpr }),
|
|
18610
|
+
dot: createToken("."),
|
|
18611
|
+
question: createToken("?", { beforeExpr }),
|
|
18612
|
+
questionDot: createToken("?."),
|
|
18613
|
+
arrow: createToken("=>", { beforeExpr }),
|
|
18614
|
+
template: createToken("template"),
|
|
18615
|
+
ellipsis: createToken("...", { beforeExpr }),
|
|
18616
|
+
backQuote: createToken("`", { startsExpr }),
|
|
18617
|
+
dollarBraceL: createToken("${", {
|
|
18618
|
+
beforeExpr,
|
|
18619
|
+
startsExpr
|
|
18609
18620
|
}),
|
|
18610
|
-
templateTail: createToken
|
|
18611
|
-
templateNonTail: createToken
|
|
18612
|
-
beforeExpr
|
|
18613
|
-
startsExpr
|
|
18621
|
+
templateTail: createToken("...`", { startsExpr }),
|
|
18622
|
+
templateNonTail: createToken("...${", {
|
|
18623
|
+
beforeExpr,
|
|
18624
|
+
startsExpr
|
|
18614
18625
|
}),
|
|
18615
|
-
at: createToken
|
|
18616
|
-
hash: createToken
|
|
18617
|
-
interpreterDirective: createToken
|
|
18618
|
-
eq: createToken
|
|
18619
|
-
beforeExpr
|
|
18620
|
-
isAssign
|
|
18626
|
+
at: createToken("@"),
|
|
18627
|
+
hash: createToken("#", { startsExpr }),
|
|
18628
|
+
interpreterDirective: createToken("#!..."),
|
|
18629
|
+
eq: createToken("=", {
|
|
18630
|
+
beforeExpr,
|
|
18631
|
+
isAssign
|
|
18621
18632
|
}),
|
|
18622
|
-
assign: createToken
|
|
18623
|
-
beforeExpr
|
|
18624
|
-
isAssign
|
|
18633
|
+
assign: createToken("_=", {
|
|
18634
|
+
beforeExpr,
|
|
18635
|
+
isAssign
|
|
18625
18636
|
}),
|
|
18626
|
-
slashAssign: createToken
|
|
18627
|
-
beforeExpr
|
|
18628
|
-
isAssign
|
|
18637
|
+
slashAssign: createToken("_=", {
|
|
18638
|
+
beforeExpr,
|
|
18639
|
+
isAssign
|
|
18629
18640
|
}),
|
|
18630
|
-
xorAssign: createToken
|
|
18631
|
-
beforeExpr
|
|
18632
|
-
isAssign
|
|
18641
|
+
xorAssign: createToken("_=", {
|
|
18642
|
+
beforeExpr,
|
|
18643
|
+
isAssign
|
|
18633
18644
|
}),
|
|
18634
|
-
moduloAssign: createToken
|
|
18635
|
-
beforeExpr
|
|
18636
|
-
isAssign
|
|
18645
|
+
moduloAssign: createToken("_=", {
|
|
18646
|
+
beforeExpr,
|
|
18647
|
+
isAssign
|
|
18637
18648
|
}),
|
|
18638
|
-
incDec: createToken
|
|
18639
|
-
prefix
|
|
18640
|
-
postfix
|
|
18641
|
-
startsExpr
|
|
18649
|
+
incDec: createToken("++/--", {
|
|
18650
|
+
prefix,
|
|
18651
|
+
postfix,
|
|
18652
|
+
startsExpr
|
|
18642
18653
|
}),
|
|
18643
|
-
bang: createToken
|
|
18644
|
-
beforeExpr
|
|
18645
|
-
prefix
|
|
18646
|
-
startsExpr
|
|
18654
|
+
bang: createToken("!", {
|
|
18655
|
+
beforeExpr,
|
|
18656
|
+
prefix,
|
|
18657
|
+
startsExpr
|
|
18647
18658
|
}),
|
|
18648
|
-
tilde: createToken
|
|
18649
|
-
beforeExpr
|
|
18650
|
-
prefix
|
|
18651
|
-
startsExpr
|
|
18659
|
+
tilde: createToken("~", {
|
|
18660
|
+
beforeExpr,
|
|
18661
|
+
prefix,
|
|
18662
|
+
startsExpr
|
|
18652
18663
|
}),
|
|
18653
|
-
doubleCaret: createToken
|
|
18654
|
-
doubleAt: createToken
|
|
18655
|
-
pipeline: createBinop
|
|
18656
|
-
nullishCoalescing: createBinop
|
|
18657
|
-
logicalOR: createBinop
|
|
18658
|
-
logicalAND: createBinop
|
|
18659
|
-
bitwiseOR: createBinop
|
|
18660
|
-
bitwiseXOR: createBinop
|
|
18661
|
-
bitwiseAND: createBinop
|
|
18662
|
-
equality: createBinop
|
|
18663
|
-
lt: createBinop
|
|
18664
|
-
gt: createBinop
|
|
18665
|
-
relational: createBinop
|
|
18666
|
-
bitShift: createBinop
|
|
18667
|
-
bitShiftL: createBinop
|
|
18668
|
-
bitShiftR: createBinop
|
|
18669
|
-
plusMin: createToken
|
|
18670
|
-
beforeExpr
|
|
18664
|
+
doubleCaret: createToken("^^", { startsExpr }),
|
|
18665
|
+
doubleAt: createToken("@@", { startsExpr }),
|
|
18666
|
+
pipeline: createBinop("|>", 0),
|
|
18667
|
+
nullishCoalescing: createBinop("??", 1),
|
|
18668
|
+
logicalOR: createBinop("||", 1),
|
|
18669
|
+
logicalAND: createBinop("&&", 2),
|
|
18670
|
+
bitwiseOR: createBinop("|", 3),
|
|
18671
|
+
bitwiseXOR: createBinop("^", 4),
|
|
18672
|
+
bitwiseAND: createBinop("&", 5),
|
|
18673
|
+
equality: createBinop("==/!=/===/!==", 6),
|
|
18674
|
+
lt: createBinop("</>/<=/>=", 7),
|
|
18675
|
+
gt: createBinop("</>/<=/>=", 7),
|
|
18676
|
+
relational: createBinop("</>/<=/>=", 7),
|
|
18677
|
+
bitShift: createBinop("<</>>/>>>", 8),
|
|
18678
|
+
bitShiftL: createBinop("<</>>/>>>", 8),
|
|
18679
|
+
bitShiftR: createBinop("<</>>/>>>", 8),
|
|
18680
|
+
plusMin: createToken("+/-", {
|
|
18681
|
+
beforeExpr,
|
|
18671
18682
|
binop: 9,
|
|
18672
|
-
prefix
|
|
18673
|
-
startsExpr
|
|
18683
|
+
prefix,
|
|
18684
|
+
startsExpr
|
|
18674
18685
|
}),
|
|
18675
|
-
modulo: createToken
|
|
18686
|
+
modulo: createToken("%", {
|
|
18676
18687
|
binop: 10,
|
|
18677
|
-
startsExpr
|
|
18688
|
+
startsExpr
|
|
18678
18689
|
}),
|
|
18679
|
-
star: createToken
|
|
18680
|
-
slash: createBinop
|
|
18681
|
-
exponent: createToken
|
|
18682
|
-
beforeExpr
|
|
18690
|
+
star: createToken("*", { binop: 10 }),
|
|
18691
|
+
slash: createBinop("/", 10),
|
|
18692
|
+
exponent: createToken("**", {
|
|
18693
|
+
beforeExpr,
|
|
18683
18694
|
binop: 11,
|
|
18684
18695
|
rightAssociative: true
|
|
18685
18696
|
}),
|
|
18686
|
-
_in: createKeyword
|
|
18687
|
-
beforeExpr
|
|
18697
|
+
_in: createKeyword("in", {
|
|
18698
|
+
beforeExpr,
|
|
18688
18699
|
binop: 7
|
|
18689
18700
|
}),
|
|
18690
|
-
_instanceof: createKeyword
|
|
18691
|
-
beforeExpr
|
|
18701
|
+
_instanceof: createKeyword("instanceof", {
|
|
18702
|
+
beforeExpr,
|
|
18692
18703
|
binop: 7
|
|
18693
18704
|
}),
|
|
18694
|
-
_break: createKeyword
|
|
18695
|
-
_case: createKeyword
|
|
18696
|
-
_catch: createKeyword
|
|
18697
|
-
_continue: createKeyword
|
|
18698
|
-
_debugger: createKeyword
|
|
18699
|
-
_default: createKeyword
|
|
18700
|
-
_else: createKeyword
|
|
18701
|
-
_finally: createKeyword
|
|
18702
|
-
_function: createKeyword
|
|
18703
|
-
_if: createKeyword
|
|
18704
|
-
_return: createKeyword
|
|
18705
|
-
_switch: createKeyword
|
|
18706
|
-
_throw: createKeyword
|
|
18707
|
-
beforeExpr
|
|
18708
|
-
prefix
|
|
18709
|
-
startsExpr
|
|
18705
|
+
_break: createKeyword("break"),
|
|
18706
|
+
_case: createKeyword("case", { beforeExpr }),
|
|
18707
|
+
_catch: createKeyword("catch"),
|
|
18708
|
+
_continue: createKeyword("continue"),
|
|
18709
|
+
_debugger: createKeyword("debugger"),
|
|
18710
|
+
_default: createKeyword("default", { beforeExpr }),
|
|
18711
|
+
_else: createKeyword("else", { beforeExpr }),
|
|
18712
|
+
_finally: createKeyword("finally"),
|
|
18713
|
+
_function: createKeyword("function", { startsExpr }),
|
|
18714
|
+
_if: createKeyword("if"),
|
|
18715
|
+
_return: createKeyword("return", { beforeExpr }),
|
|
18716
|
+
_switch: createKeyword("switch"),
|
|
18717
|
+
_throw: createKeyword("throw", {
|
|
18718
|
+
beforeExpr,
|
|
18719
|
+
prefix,
|
|
18720
|
+
startsExpr
|
|
18710
18721
|
}),
|
|
18711
|
-
_try: createKeyword
|
|
18712
|
-
_var: createKeyword
|
|
18713
|
-
_const: createKeyword
|
|
18714
|
-
_with: createKeyword
|
|
18715
|
-
_new: createKeyword
|
|
18716
|
-
beforeExpr
|
|
18717
|
-
startsExpr
|
|
18722
|
+
_try: createKeyword("try"),
|
|
18723
|
+
_var: createKeyword("var"),
|
|
18724
|
+
_const: createKeyword("const"),
|
|
18725
|
+
_with: createKeyword("with"),
|
|
18726
|
+
_new: createKeyword("new", {
|
|
18727
|
+
beforeExpr,
|
|
18728
|
+
startsExpr
|
|
18718
18729
|
}),
|
|
18719
|
-
_this: createKeyword
|
|
18720
|
-
_super: createKeyword
|
|
18721
|
-
_class: createKeyword
|
|
18722
|
-
_extends: createKeyword
|
|
18723
|
-
_export: createKeyword
|
|
18724
|
-
_import: createKeyword
|
|
18725
|
-
_null: createKeyword
|
|
18726
|
-
_true: createKeyword
|
|
18727
|
-
_false: createKeyword
|
|
18728
|
-
_typeof: createKeyword
|
|
18729
|
-
beforeExpr
|
|
18730
|
-
prefix
|
|
18731
|
-
startsExpr
|
|
18730
|
+
_this: createKeyword("this", { startsExpr }),
|
|
18731
|
+
_super: createKeyword("super", { startsExpr }),
|
|
18732
|
+
_class: createKeyword("class", { startsExpr }),
|
|
18733
|
+
_extends: createKeyword("extends", { beforeExpr }),
|
|
18734
|
+
_export: createKeyword("export"),
|
|
18735
|
+
_import: createKeyword("import", { startsExpr }),
|
|
18736
|
+
_null: createKeyword("null", { startsExpr }),
|
|
18737
|
+
_true: createKeyword("true", { startsExpr }),
|
|
18738
|
+
_false: createKeyword("false", { startsExpr }),
|
|
18739
|
+
_typeof: createKeyword("typeof", {
|
|
18740
|
+
beforeExpr,
|
|
18741
|
+
prefix,
|
|
18742
|
+
startsExpr
|
|
18732
18743
|
}),
|
|
18733
|
-
_void: createKeyword
|
|
18734
|
-
beforeExpr
|
|
18735
|
-
prefix
|
|
18736
|
-
startsExpr
|
|
18744
|
+
_void: createKeyword("void", {
|
|
18745
|
+
beforeExpr,
|
|
18746
|
+
prefix,
|
|
18747
|
+
startsExpr
|
|
18737
18748
|
}),
|
|
18738
|
-
_delete: createKeyword
|
|
18739
|
-
beforeExpr
|
|
18740
|
-
prefix
|
|
18741
|
-
startsExpr
|
|
18749
|
+
_delete: createKeyword("delete", {
|
|
18750
|
+
beforeExpr,
|
|
18751
|
+
prefix,
|
|
18752
|
+
startsExpr
|
|
18742
18753
|
}),
|
|
18743
|
-
_do: createKeyword
|
|
18744
|
-
isLoop
|
|
18745
|
-
beforeExpr
|
|
18754
|
+
_do: createKeyword("do", {
|
|
18755
|
+
isLoop,
|
|
18756
|
+
beforeExpr
|
|
18746
18757
|
}),
|
|
18747
|
-
_for: createKeyword
|
|
18748
|
-
_while: createKeyword
|
|
18749
|
-
_as: createKeywordLike
|
|
18750
|
-
_assert: createKeywordLike
|
|
18751
|
-
_async: createKeywordLike
|
|
18752
|
-
_await: createKeywordLike
|
|
18753
|
-
_defer: createKeywordLike
|
|
18754
|
-
_from: createKeywordLike
|
|
18755
|
-
_get: createKeywordLike
|
|
18756
|
-
_let: createKeywordLike
|
|
18757
|
-
_meta: createKeywordLike
|
|
18758
|
-
_of: createKeywordLike
|
|
18759
|
-
_sent: createKeywordLike
|
|
18760
|
-
_set: createKeywordLike
|
|
18761
|
-
_source: createKeywordLike
|
|
18762
|
-
_static: createKeywordLike
|
|
18763
|
-
_using: createKeywordLike
|
|
18764
|
-
_yield: createKeywordLike
|
|
18765
|
-
_asserts: createKeywordLike
|
|
18766
|
-
_checks: createKeywordLike
|
|
18767
|
-
_exports: createKeywordLike
|
|
18768
|
-
_global: createKeywordLike
|
|
18769
|
-
_implements: createKeywordLike
|
|
18770
|
-
_intrinsic: createKeywordLike
|
|
18771
|
-
_infer: createKeywordLike
|
|
18772
|
-
_is: createKeywordLike
|
|
18773
|
-
_mixins: createKeywordLike
|
|
18774
|
-
_proto: createKeywordLike
|
|
18775
|
-
_require: createKeywordLike
|
|
18776
|
-
_satisfies: createKeywordLike
|
|
18777
|
-
_keyof: createKeywordLike
|
|
18778
|
-
_readonly: createKeywordLike
|
|
18779
|
-
_unique: createKeywordLike
|
|
18780
|
-
_abstract: createKeywordLike
|
|
18781
|
-
_declare: createKeywordLike
|
|
18782
|
-
_enum: createKeywordLike
|
|
18783
|
-
_module: createKeywordLike
|
|
18784
|
-
_namespace: createKeywordLike
|
|
18785
|
-
_interface: createKeywordLike
|
|
18786
|
-
_type: createKeywordLike
|
|
18787
|
-
_opaque: createKeywordLike
|
|
18788
|
-
name: createToken
|
|
18789
|
-
placeholder: createToken
|
|
18790
|
-
string: createToken
|
|
18791
|
-
num: createToken
|
|
18792
|
-
bigint: createToken
|
|
18793
|
-
regexp: createToken
|
|
18794
|
-
privateName: createToken
|
|
18795
|
-
eof: createToken
|
|
18796
|
-
jsxName: createToken
|
|
18797
|
-
jsxText: createToken
|
|
18798
|
-
jsxTagStart: createToken
|
|
18799
|
-
jsxTagEnd: createToken
|
|
18800
|
-
};
|
|
18801
|
-
function tokenIsIdentifier(token) {
|
|
18802
|
-
return token >= 89 && token <= 129;
|
|
18803
|
-
}
|
|
18804
|
-
function tokenKeywordOrIdentifierIsKeyword(token) {
|
|
18805
|
-
return token <= 88;
|
|
18806
|
-
}
|
|
18807
|
-
function tokenIsKeywordOrIdentifier(token) {
|
|
18808
|
-
return token >= 54 && token <= 129;
|
|
18809
|
-
}
|
|
18810
|
-
function tokenIsLiteralPropertyName(token) {
|
|
18811
|
-
return token >= 54 && token <= 132;
|
|
18812
|
-
}
|
|
18813
|
-
function tokenComesBeforeExpression(token) {
|
|
18814
|
-
return tokenBeforeExprs
|
|
18815
|
-
}
|
|
18816
|
-
function tokenCanStartExpression(token) {
|
|
18817
|
-
return tokenStartsExprs
|
|
18818
|
-
}
|
|
18819
|
-
function tokenIsAssignment(token) {
|
|
18820
|
-
return token >= 25 && token <= 29;
|
|
18821
|
-
}
|
|
18822
|
-
function tokenIsFlowInterfaceOrTypeOrOpaque(token) {
|
|
18823
|
-
return token >= 125 && token <= 127;
|
|
18824
|
-
}
|
|
18825
|
-
function tokenIsLoop(token) {
|
|
18826
|
-
return token >= 86 && token <= 88;
|
|
18758
|
+
_for: createKeyword("for", { isLoop }),
|
|
18759
|
+
_while: createKeyword("while", { isLoop }),
|
|
18760
|
+
_as: createKeywordLike("as", { startsExpr }),
|
|
18761
|
+
_assert: createKeywordLike("assert", { startsExpr }),
|
|
18762
|
+
_async: createKeywordLike("async", { startsExpr }),
|
|
18763
|
+
_await: createKeywordLike("await", { startsExpr }),
|
|
18764
|
+
_defer: createKeywordLike("defer", { startsExpr }),
|
|
18765
|
+
_from: createKeywordLike("from", { startsExpr }),
|
|
18766
|
+
_get: createKeywordLike("get", { startsExpr }),
|
|
18767
|
+
_let: createKeywordLike("let", { startsExpr }),
|
|
18768
|
+
_meta: createKeywordLike("meta", { startsExpr }),
|
|
18769
|
+
_of: createKeywordLike("of", { startsExpr }),
|
|
18770
|
+
_sent: createKeywordLike("sent", { startsExpr }),
|
|
18771
|
+
_set: createKeywordLike("set", { startsExpr }),
|
|
18772
|
+
_source: createKeywordLike("source", { startsExpr }),
|
|
18773
|
+
_static: createKeywordLike("static", { startsExpr }),
|
|
18774
|
+
_using: createKeywordLike("using", { startsExpr }),
|
|
18775
|
+
_yield: createKeywordLike("yield", { startsExpr }),
|
|
18776
|
+
_asserts: createKeywordLike("asserts", { startsExpr }),
|
|
18777
|
+
_checks: createKeywordLike("checks", { startsExpr }),
|
|
18778
|
+
_exports: createKeywordLike("exports", { startsExpr }),
|
|
18779
|
+
_global: createKeywordLike("global", { startsExpr }),
|
|
18780
|
+
_implements: createKeywordLike("implements", { startsExpr }),
|
|
18781
|
+
_intrinsic: createKeywordLike("intrinsic", { startsExpr }),
|
|
18782
|
+
_infer: createKeywordLike("infer", { startsExpr }),
|
|
18783
|
+
_is: createKeywordLike("is", { startsExpr }),
|
|
18784
|
+
_mixins: createKeywordLike("mixins", { startsExpr }),
|
|
18785
|
+
_proto: createKeywordLike("proto", { startsExpr }),
|
|
18786
|
+
_require: createKeywordLike("require", { startsExpr }),
|
|
18787
|
+
_satisfies: createKeywordLike("satisfies", { startsExpr }),
|
|
18788
|
+
_keyof: createKeywordLike("keyof", { startsExpr }),
|
|
18789
|
+
_readonly: createKeywordLike("readonly", { startsExpr }),
|
|
18790
|
+
_unique: createKeywordLike("unique", { startsExpr }),
|
|
18791
|
+
_abstract: createKeywordLike("abstract", { startsExpr }),
|
|
18792
|
+
_declare: createKeywordLike("declare", { startsExpr }),
|
|
18793
|
+
_enum: createKeywordLike("enum", { startsExpr }),
|
|
18794
|
+
_module: createKeywordLike("module", { startsExpr }),
|
|
18795
|
+
_namespace: createKeywordLike("namespace", { startsExpr }),
|
|
18796
|
+
_interface: createKeywordLike("interface", { startsExpr }),
|
|
18797
|
+
_type: createKeywordLike("type", { startsExpr }),
|
|
18798
|
+
_opaque: createKeywordLike("opaque", { startsExpr }),
|
|
18799
|
+
name: createToken("name", { startsExpr }),
|
|
18800
|
+
placeholder: createToken("%%", { startsExpr }),
|
|
18801
|
+
string: createToken("string", { startsExpr }),
|
|
18802
|
+
num: createToken("num", { startsExpr }),
|
|
18803
|
+
bigint: createToken("bigint", { startsExpr }),
|
|
18804
|
+
regexp: createToken("regexp", { startsExpr }),
|
|
18805
|
+
privateName: createToken("#name", { startsExpr }),
|
|
18806
|
+
eof: createToken("eof"),
|
|
18807
|
+
jsxName: createToken("jsxName"),
|
|
18808
|
+
jsxText: createToken("jsxText", { beforeExpr }),
|
|
18809
|
+
jsxTagStart: createToken("jsxTagStart", { startsExpr }),
|
|
18810
|
+
jsxTagEnd: createToken("jsxTagEnd")
|
|
18811
|
+
};
|
|
18812
|
+
function tokenIsIdentifier(token) {
|
|
18813
|
+
return token >= 89 && token <= 129;
|
|
18814
|
+
}
|
|
18815
|
+
function tokenKeywordOrIdentifierIsKeyword(token) {
|
|
18816
|
+
return token <= 88;
|
|
18817
|
+
}
|
|
18818
|
+
function tokenIsKeywordOrIdentifier(token) {
|
|
18819
|
+
return token >= 54 && token <= 129;
|
|
18820
|
+
}
|
|
18821
|
+
function tokenIsLiteralPropertyName(token) {
|
|
18822
|
+
return token >= 54 && token <= 132;
|
|
18823
|
+
}
|
|
18824
|
+
function tokenComesBeforeExpression(token) {
|
|
18825
|
+
return tokenBeforeExprs[token];
|
|
18826
|
+
}
|
|
18827
|
+
function tokenCanStartExpression(token) {
|
|
18828
|
+
return tokenStartsExprs[token];
|
|
18829
|
+
}
|
|
18830
|
+
function tokenIsAssignment(token) {
|
|
18831
|
+
return token >= 25 && token <= 29;
|
|
18832
|
+
}
|
|
18833
|
+
function tokenIsFlowInterfaceOrTypeOrOpaque(token) {
|
|
18834
|
+
return token >= 125 && token <= 127;
|
|
18835
|
+
}
|
|
18836
|
+
function tokenIsLoop(token) {
|
|
18837
|
+
return token >= 86 && token <= 88;
|
|
18827
18838
|
}
|
|
18828
18839
|
function tokenIsKeyword(token) {
|
|
18829
18840
|
return token >= 54 && token <= 88;
|
|
@@ -18835,7 +18846,7 @@ function tokenIsPostfix(token) {
|
|
|
18835
18846
|
return token === 30;
|
|
18836
18847
|
}
|
|
18837
18848
|
function tokenIsPrefix(token) {
|
|
18838
|
-
return tokenPrefixes
|
|
18849
|
+
return tokenPrefixes[token];
|
|
18839
18850
|
}
|
|
18840
18851
|
function tokenIsTSTypeOperator(token) {
|
|
18841
18852
|
return token >= 117 && token <= 119;
|
|
@@ -18844,10 +18855,10 @@ function tokenIsTSDeclarationStart(token) {
|
|
|
18844
18855
|
return token >= 120 && token <= 126;
|
|
18845
18856
|
}
|
|
18846
18857
|
function tokenLabelName(token) {
|
|
18847
|
-
return tokenLabels
|
|
18858
|
+
return tokenLabels[token];
|
|
18848
18859
|
}
|
|
18849
18860
|
function tokenOperatorPrecedence(token) {
|
|
18850
|
-
return tokenBinops
|
|
18861
|
+
return tokenBinops[token];
|
|
18851
18862
|
}
|
|
18852
18863
|
function tokenIsRightAssociative(token) {
|
|
18853
18864
|
return token === 53;
|
|
@@ -18855,10 +18866,10 @@ function tokenIsRightAssociative(token) {
|
|
|
18855
18866
|
function tokenIsTemplate(token) {
|
|
18856
18867
|
return token >= 20 && token <= 21;
|
|
18857
18868
|
}
|
|
18858
|
-
function getExportedToken
|
|
18859
|
-
return tokenTypes
|
|
18869
|
+
function getExportedToken(token) {
|
|
18870
|
+
return tokenTypes[token];
|
|
18860
18871
|
}
|
|
18861
|
-
var TokContext
|
|
18872
|
+
var TokContext = class {
|
|
18862
18873
|
constructor(token, preserveSpace) {
|
|
18863
18874
|
this.token = token;
|
|
18864
18875
|
this.preserveSpace = !!preserveSpace;
|
|
@@ -18866,11 +18877,11 @@ var TokContext$1 = class {
|
|
|
18866
18877
|
token;
|
|
18867
18878
|
preserveSpace;
|
|
18868
18879
|
};
|
|
18869
|
-
const types
|
|
18870
|
-
brace: new TokContext
|
|
18871
|
-
j_oTag: new TokContext
|
|
18872
|
-
j_cTag: new TokContext
|
|
18873
|
-
j_expr: new TokContext
|
|
18880
|
+
const types = {
|
|
18881
|
+
brace: new TokContext("{"),
|
|
18882
|
+
j_oTag: new TokContext("<tag"),
|
|
18883
|
+
j_cTag: new TokContext("</tag"),
|
|
18884
|
+
j_expr: new TokContext("<tag>...</tag>", true)
|
|
18874
18885
|
};
|
|
18875
18886
|
const nonASCIIidentifierStart = /* @__PURE__ */ new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽ-ೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-Ა-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ--ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]");
|
|
18876
18887
|
const nonASCIIidentifier = /* @__PURE__ */ new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽ-ೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-Ა-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ--ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ--ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・]");
|
|
@@ -19854,7 +19865,7 @@ function isIdentifierChar(code) {
|
|
|
19854
19865
|
if (code <= 65535) return code >= 170 && nonASCIIidentifier.test(String.fromCharCode(code));
|
|
19855
19866
|
return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);
|
|
19856
19867
|
}
|
|
19857
|
-
const reservedWords
|
|
19868
|
+
const reservedWords = {
|
|
19858
19869
|
keyword: [
|
|
19859
19870
|
"break",
|
|
19860
19871
|
"case",
|
|
@@ -19905,23 +19916,23 @@ const reservedWords$1 = {
|
|
|
19905
19916
|
],
|
|
19906
19917
|
strictBind: ["eval", "arguments"]
|
|
19907
19918
|
};
|
|
19908
|
-
const keywords
|
|
19909
|
-
const reservedWordsStrictSet
|
|
19910
|
-
const reservedWordsStrictBindSet
|
|
19919
|
+
const keywords = new Set(reservedWords.keyword);
|
|
19920
|
+
const reservedWordsStrictSet = new Set(reservedWords.strict);
|
|
19921
|
+
const reservedWordsStrictBindSet = new Set(reservedWords.strictBind);
|
|
19911
19922
|
function isReservedWord(word, inModule) {
|
|
19912
19923
|
return inModule && word === "await" || word === "enum";
|
|
19913
19924
|
}
|
|
19914
19925
|
function isStrictReservedWord(word, inModule) {
|
|
19915
|
-
return isReservedWord(word, inModule) || reservedWordsStrictSet
|
|
19926
|
+
return isReservedWord(word, inModule) || reservedWordsStrictSet.has(word);
|
|
19916
19927
|
}
|
|
19917
19928
|
function isStrictBindOnlyReservedWord(word) {
|
|
19918
|
-
return reservedWordsStrictBindSet
|
|
19929
|
+
return reservedWordsStrictBindSet.has(word);
|
|
19919
19930
|
}
|
|
19920
19931
|
function isStrictBindReservedWord(word, inModule) {
|
|
19921
19932
|
return isStrictReservedWord(word, inModule) || isStrictBindOnlyReservedWord(word);
|
|
19922
19933
|
}
|
|
19923
19934
|
function isKeyword(word) {
|
|
19924
|
-
return keywords
|
|
19935
|
+
return keywords.has(word);
|
|
19925
19936
|
}
|
|
19926
19937
|
function isIteratorStart(current, next, next2) {
|
|
19927
19938
|
return current === 64 && next === 64 && isIdentifierStart(next2);
|
|
@@ -20071,7 +20082,7 @@ var ScopeHandler = class {
|
|
|
20071
20082
|
if (this.parser.inModule && scope.flags & 1) this.undefinedExports.delete(name);
|
|
20072
20083
|
}
|
|
20073
20084
|
checkRedeclarationInScope(scope, name, bindingType, loc) {
|
|
20074
|
-
if (this.isRedeclaredInScope(scope, name, bindingType)) this.parser.raise(Errors
|
|
20085
|
+
if (this.isRedeclaredInScope(scope, name, bindingType)) this.parser.raise(Errors.VarRedeclaration, loc, { identifierName: name });
|
|
20075
20086
|
}
|
|
20076
20087
|
isRedeclaredInScope(scope, name, bindingType) {
|
|
20077
20088
|
if (!(bindingType & 1)) return false;
|
|
@@ -20147,7 +20158,7 @@ const reservedTypes = new Set([
|
|
|
20147
20158
|
"typeof",
|
|
20148
20159
|
"void"
|
|
20149
20160
|
]);
|
|
20150
|
-
const FlowErrors
|
|
20161
|
+
const FlowErrors = ParseErrorEnum`flow`({
|
|
20151
20162
|
AmbiguousConditionalArrow: "Ambiguous expression: wrap the arrow functions in parentheses to disambiguate.",
|
|
20152
20163
|
AmbiguousDeclareModuleKind: "Found both `declare module.exports` and `declare export` in the same module. Modules can only have 1 since they are either an ES module or they are a CommonJS module.",
|
|
20153
20164
|
AssignReservedType: ({ reservedType }) => `Cannot overwrite reserved type ${reservedType}.`,
|
|
@@ -20252,7 +20263,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
20252
20263
|
const moduloLoc = this.state.startLoc;
|
|
20253
20264
|
this.next();
|
|
20254
20265
|
this.expectContextual(106);
|
|
20255
|
-
if (this.state.lastTokStartLoc.index > moduloLoc.index + 1) this.raise(FlowErrors
|
|
20266
|
+
if (this.state.lastTokStartLoc.index > moduloLoc.index + 1) this.raise(FlowErrors.UnexpectedSpaceBetweenModuloChecks, moduloLoc);
|
|
20256
20267
|
if (this.eat(6)) {
|
|
20257
20268
|
node.value = super.parseExpression();
|
|
20258
20269
|
this.expect(7);
|
|
@@ -20307,7 +20318,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
20307
20318
|
else if (this.match(70)) return this.flowParseDeclareVariable(node);
|
|
20308
20319
|
else if (this.eatContextual(123)) if (this.match(12)) return this.flowParseDeclareModuleExports(node);
|
|
20309
20320
|
else {
|
|
20310
|
-
if (insideModule) this.raise(FlowErrors
|
|
20321
|
+
if (insideModule) this.raise(FlowErrors.NestedDeclareModule, this.state.lastTokStartLoc);
|
|
20311
20322
|
return this.flowParseDeclareModule(node);
|
|
20312
20323
|
}
|
|
20313
20324
|
else if (this.isContextual(126)) return this.flowParseDeclareTypeAlias(node);
|
|
@@ -20334,10 +20345,10 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
20334
20345
|
const bodyNode = this.startNode();
|
|
20335
20346
|
if (this.match(79)) {
|
|
20336
20347
|
this.next();
|
|
20337
|
-
if (!this.isContextual(126) && !this.match(83)) this.raise(FlowErrors
|
|
20348
|
+
if (!this.isContextual(126) && !this.match(83)) this.raise(FlowErrors.InvalidNonTypeImportInDeclareModule, this.state.lastTokStartLoc);
|
|
20338
20349
|
body.push(super.parseImport(bodyNode));
|
|
20339
20350
|
} else {
|
|
20340
|
-
this.expectContextual(121, FlowErrors
|
|
20351
|
+
this.expectContextual(121, FlowErrors.UnsupportedStatementInDeclareModule);
|
|
20341
20352
|
body.push(this.flowParseDeclare(bodyNode, true));
|
|
20342
20353
|
}
|
|
20343
20354
|
}
|
|
@@ -20348,11 +20359,11 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
20348
20359
|
let hasModuleExport = false;
|
|
20349
20360
|
body.forEach((bodyElement) => {
|
|
20350
20361
|
if (isEsModuleType(bodyElement)) {
|
|
20351
|
-
if (kind === "CommonJS") this.raise(FlowErrors
|
|
20362
|
+
if (kind === "CommonJS") this.raise(FlowErrors.AmbiguousDeclareModuleKind, bodyElement);
|
|
20352
20363
|
kind = "ES";
|
|
20353
20364
|
} else if (bodyElement.type === "DeclareModuleExports") {
|
|
20354
|
-
if (hasModuleExport) this.raise(FlowErrors
|
|
20355
|
-
if (kind === "ES") this.raise(FlowErrors
|
|
20365
|
+
if (hasModuleExport) this.raise(FlowErrors.DuplicateDeclareModuleExports, bodyElement);
|
|
20366
|
+
if (kind === "ES") this.raise(FlowErrors.AmbiguousDeclareModuleKind, bodyElement);
|
|
20356
20367
|
kind = "CommonJS";
|
|
20357
20368
|
hasModuleExport = true;
|
|
20358
20369
|
}
|
|
@@ -20373,7 +20384,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
20373
20384
|
} else {
|
|
20374
20385
|
if (this.match(71) || this.isLet() || (this.isContextual(126) || this.isContextual(125)) && !insideModule) {
|
|
20375
20386
|
const label = this.state.value;
|
|
20376
|
-
throw this.raise(FlowErrors
|
|
20387
|
+
throw this.raise(FlowErrors.UnsupportedDeclareExportKind, this.state.startLoc, {
|
|
20377
20388
|
unsupportedExportKind: label,
|
|
20378
20389
|
suggestion: exportSuggestions[label]
|
|
20379
20390
|
});
|
|
@@ -20456,11 +20467,11 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
20456
20467
|
return this.finishNode(node, "InterfaceDeclaration");
|
|
20457
20468
|
}
|
|
20458
20469
|
checkNotUnderscore(word) {
|
|
20459
|
-
if (word === "_") this.raise(FlowErrors
|
|
20470
|
+
if (word === "_") this.raise(FlowErrors.UnexpectedReservedUnderscore, this.state.startLoc);
|
|
20460
20471
|
}
|
|
20461
20472
|
checkReservedType(word, startLoc, declaration) {
|
|
20462
20473
|
if (!reservedTypes.has(word)) return;
|
|
20463
|
-
this.raise(declaration ? FlowErrors
|
|
20474
|
+
this.raise(declaration ? FlowErrors.AssignReservedType : FlowErrors.UnexpectedReservedType, startLoc, { reservedType: word });
|
|
20464
20475
|
}
|
|
20465
20476
|
flowParseRestrictedIdentifierName(liberal, declaration) {
|
|
20466
20477
|
this.checkReservedType(this.state.value, this.state.startLoc, declaration);
|
|
@@ -20511,7 +20522,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
20511
20522
|
if (this.match(25)) {
|
|
20512
20523
|
this.eat(25);
|
|
20513
20524
|
node.default = this.flowParseType();
|
|
20514
|
-
} else if (requireDefault) this.raise(FlowErrors
|
|
20525
|
+
} else if (requireDefault) this.raise(FlowErrors.MissingTypeParamDefault, nodeStartLoc);
|
|
20515
20526
|
return this.finishNode(node, "TypeParameter");
|
|
20516
20527
|
}
|
|
20517
20528
|
flowParseTypeParameterDeclaration() {
|
|
@@ -20533,7 +20544,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
20533
20544
|
return this.finishNode(node, "TypeParameterDeclaration");
|
|
20534
20545
|
}
|
|
20535
20546
|
flowInTopLevelContext(cb) {
|
|
20536
|
-
if (this.curContext() !== types
|
|
20547
|
+
if (this.curContext() !== types.brace) {
|
|
20537
20548
|
const oldContext = this.state.context;
|
|
20538
20549
|
this.state.context = [oldContext[0]];
|
|
20539
20550
|
try {
|
|
@@ -20563,7 +20574,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
20563
20574
|
this.state.noAnonFunctionType = oldNoAnonFunctionType;
|
|
20564
20575
|
});
|
|
20565
20576
|
this.state.inType = oldInType;
|
|
20566
|
-
if (!this.state.inType && this.curContext() === types
|
|
20577
|
+
if (!this.state.inType && this.curContext() === types.brace) this.reScan_lt_gt();
|
|
20567
20578
|
this.expect(44);
|
|
20568
20579
|
return this.finishNode(node, "TypeParameterInstantiation");
|
|
20569
20580
|
}
|
|
@@ -20725,7 +20736,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
20725
20736
|
} else nodeStart.properties.push(propOrInexact);
|
|
20726
20737
|
}
|
|
20727
20738
|
this.flowObjectTypeSemicolon();
|
|
20728
|
-
if (inexactStartLoc && !this.match(4) && !this.match(5)) this.raise(FlowErrors
|
|
20739
|
+
if (inexactStartLoc && !this.match(4) && !this.match(5)) this.raise(FlowErrors.UnexpectedExplicitInexactInObject, inexactStartLoc);
|
|
20729
20740
|
}
|
|
20730
20741
|
this.expect(endDelim);
|
|
20731
20742
|
if (allowSpread) nodeStart.inexact = inexact;
|
|
@@ -20736,14 +20747,14 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
20736
20747
|
flowParseObjectTypeProperty(node, isStatic, protoStartLoc, variance, kind, allowSpread, allowInexact) {
|
|
20737
20748
|
if (this.eat(17)) {
|
|
20738
20749
|
if (this.match(8) || this.match(9) || this.match(4) || this.match(5)) {
|
|
20739
|
-
if (!allowSpread) this.raise(FlowErrors
|
|
20740
|
-
else if (!allowInexact) this.raise(FlowErrors
|
|
20741
|
-
if (variance) this.raise(FlowErrors
|
|
20750
|
+
if (!allowSpread) this.raise(FlowErrors.InexactInsideNonObject, this.state.lastTokStartLoc);
|
|
20751
|
+
else if (!allowInexact) this.raise(FlowErrors.InexactInsideExact, this.state.lastTokStartLoc);
|
|
20752
|
+
if (variance) this.raise(FlowErrors.InexactVariance, variance);
|
|
20742
20753
|
return null;
|
|
20743
20754
|
}
|
|
20744
|
-
if (!allowSpread) this.raise(FlowErrors
|
|
20755
|
+
if (!allowSpread) this.raise(FlowErrors.UnexpectedSpreadType, this.state.lastTokStartLoc);
|
|
20745
20756
|
if (protoStartLoc != null) this.unexpected(protoStartLoc);
|
|
20746
|
-
if (variance) this.raise(FlowErrors
|
|
20757
|
+
if (variance) this.raise(FlowErrors.SpreadVariance, variance);
|
|
20747
20758
|
node.argument = this.flowParseType();
|
|
20748
20759
|
return this.finishNode(node, "ObjectTypeSpreadProperty");
|
|
20749
20760
|
} else {
|
|
@@ -20758,7 +20769,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
20758
20769
|
if (variance) this.unexpected(variance.start);
|
|
20759
20770
|
node.value = this.flowParseObjectTypeMethodish(this.startNodeAtNode(node));
|
|
20760
20771
|
if (kind === "get" || kind === "set") this.flowCheckGetterSetterParams(node);
|
|
20761
|
-
else if (!isStatic && !allowSpread && node.key.name === "constructor" && node.value.this) this.raise(FlowErrors
|
|
20772
|
+
else if (!isStatic && !allowSpread && node.key.name === "constructor" && node.value.this) this.raise(FlowErrors.ThisParamBannedInConstructor, node.value.this);
|
|
20762
20773
|
} else {
|
|
20763
20774
|
if (kind !== "init") this.unexpected();
|
|
20764
20775
|
node.method = false;
|
|
@@ -20774,9 +20785,9 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
20774
20785
|
const paramCount = property.kind === "get" ? 0 : 1;
|
|
20775
20786
|
const value = property.value;
|
|
20776
20787
|
const length = value.params.length + (value.rest ? 1 : 0);
|
|
20777
|
-
if (value.this) this.raise(property.kind === "get" ? FlowErrors
|
|
20778
|
-
if (length !== paramCount) this.raise(property.kind === "get" ? Errors
|
|
20779
|
-
if (property.kind === "set" && value.rest) this.raise(Errors
|
|
20788
|
+
if (value.this) this.raise(property.kind === "get" ? FlowErrors.GetterMayNotHaveThisParam : FlowErrors.SetterMayNotHaveThisParam, value.this);
|
|
20789
|
+
if (length !== paramCount) this.raise(property.kind === "get" ? Errors.BadGetterArity : Errors.BadSetterArity, property);
|
|
20790
|
+
if (property.kind === "set" && value.rest) this.raise(Errors.BadSetterRestParameter, property);
|
|
20780
20791
|
}
|
|
20781
20792
|
flowObjectTypeSemicolon() {
|
|
20782
20793
|
if (!this.eat(9) && !this.eat(8) && !this.match(4) && !this.match(5)) this.unexpected();
|
|
@@ -20825,11 +20836,11 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
20825
20836
|
const lh = this.lookahead();
|
|
20826
20837
|
const isThis = this.state.type === 74;
|
|
20827
20838
|
if (lh.type === 10 || lh.type === 13) {
|
|
20828
|
-
if (isThis && !first) this.raise(FlowErrors
|
|
20839
|
+
if (isThis && !first) this.raise(FlowErrors.ThisParamMustBeFirst, node);
|
|
20829
20840
|
name = this.parseIdentifier(isThis);
|
|
20830
20841
|
if (this.eat(13)) {
|
|
20831
20842
|
optional = true;
|
|
20832
|
-
if (isThis) this.raise(FlowErrors
|
|
20843
|
+
if (isThis) this.raise(FlowErrors.ThisParamMayNotBeOptional, node);
|
|
20833
20844
|
}
|
|
20834
20845
|
typeAnnotation = this.flowParseTypeInitialiser();
|
|
20835
20846
|
} else typeAnnotation = this.flowParseType();
|
|
@@ -20957,7 +20968,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
20957
20968
|
this.next();
|
|
20958
20969
|
if (this.match(131)) return this.parseLiteralAtNode(-this.state.value, "NumberLiteralTypeAnnotation", node);
|
|
20959
20970
|
if (this.match(132)) return this.parseLiteralAtNode(-this.state.value, "BigIntLiteralTypeAnnotation", node);
|
|
20960
|
-
throw this.raise(FlowErrors
|
|
20971
|
+
throw this.raise(FlowErrors.UnexpectedSubtractionOperand, this.state.startLoc);
|
|
20961
20972
|
}
|
|
20962
20973
|
throw this.unexpected();
|
|
20963
20974
|
case 131: return this.parseLiteral(this.state.value, "NumberLiteralTypeAnnotation");
|
|
@@ -21176,7 +21187,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
21176
21187
|
({consequent, failed} = this.tryParseConditionalConsequent());
|
|
21177
21188
|
[valid] = this.getArrowLikeExpressions(consequent);
|
|
21178
21189
|
}
|
|
21179
|
-
if (failed && valid.length > 1) this.raise(FlowErrors
|
|
21190
|
+
if (failed && valid.length > 1) this.raise(FlowErrors.AmbiguousConditionalArrow, state.startLoc);
|
|
21180
21191
|
if (failed && valid.length === 1) {
|
|
21181
21192
|
this.state = state;
|
|
21182
21193
|
noArrowAt.push(valid[0].start);
|
|
@@ -21314,8 +21325,8 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
21314
21325
|
}
|
|
21315
21326
|
super.parseClassMember(classBody, member, state);
|
|
21316
21327
|
if (member.declare) {
|
|
21317
|
-
if (member.type !== "ClassProperty" && member.type !== "ClassPrivateProperty" && member.type !== "PropertyDefinition") this.raise(FlowErrors
|
|
21318
|
-
else if (member.value) this.raise(FlowErrors
|
|
21328
|
+
if (member.type !== "ClassProperty" && member.type !== "ClassPrivateProperty" && member.type !== "PropertyDefinition") this.raise(FlowErrors.DeclareClassElement, startLoc);
|
|
21329
|
+
else if (member.value) this.raise(FlowErrors.DeclareClassFieldInitializer, member.value);
|
|
21319
21330
|
}
|
|
21320
21331
|
}
|
|
21321
21332
|
isIterator(word) {
|
|
@@ -21324,7 +21335,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
21324
21335
|
readIterator() {
|
|
21325
21336
|
const word = super.readWord1();
|
|
21326
21337
|
const fullWord = "@@" + word;
|
|
21327
|
-
if (!this.isIterator(word) || !this.state.inType) this.raise(Errors
|
|
21338
|
+
if (!this.isIterator(word) || !this.state.inType) this.raise(Errors.InvalidIdentifier, this.state.curPosition(), { identifierName: fullWord });
|
|
21328
21339
|
this.finishToken(128, fullWord);
|
|
21329
21340
|
}
|
|
21330
21341
|
getTokenFromCode(code) {
|
|
@@ -21354,7 +21365,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
21354
21365
|
toReferencedList(exprList, isParenthesizedExpr) {
|
|
21355
21366
|
for (let i = 0; i < exprList.length; i++) {
|
|
21356
21367
|
const expr = exprList[i];
|
|
21357
|
-
if (expr?.type === "TypeCastExpression" && !expr.extra?.parenthesized && (exprList.length > 1 || !isParenthesizedExpr)) this.raise(FlowErrors
|
|
21368
|
+
if (expr?.type === "TypeCastExpression" && !expr.extra?.parenthesized && (exprList.length > 1 || !isParenthesizedExpr)) this.raise(FlowErrors.TypeCastInPattern, expr.typeAnnotation);
|
|
21358
21369
|
}
|
|
21359
21370
|
return exprList;
|
|
21360
21371
|
}
|
|
@@ -21390,10 +21401,10 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
21390
21401
|
super.pushClassMethod(classBody, method, isGenerator, isAsync, isConstructor, allowsDirectSuper);
|
|
21391
21402
|
if (method.params && isConstructor) {
|
|
21392
21403
|
const params = method.params;
|
|
21393
|
-
if (params.length > 0 && this.isThisParam(params[0])) this.raise(FlowErrors
|
|
21404
|
+
if (params.length > 0 && this.isThisParam(params[0])) this.raise(FlowErrors.ThisParamBannedInConstructor, method);
|
|
21394
21405
|
} else if (method.type === "MethodDefinition" && isConstructor && method.value.params) {
|
|
21395
21406
|
const params = method.value.params;
|
|
21396
|
-
if (params.length > 0 && this.isThisParam(params[0])) this.raise(FlowErrors
|
|
21407
|
+
if (params.length > 0 && this.isThisParam(params[0])) this.raise(FlowErrors.ThisParamBannedInConstructor, method);
|
|
21397
21408
|
}
|
|
21398
21409
|
}
|
|
21399
21410
|
pushClassPrivateMethod(classBody, method, isGenerator, isAsync) {
|
|
@@ -21424,8 +21435,8 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
21424
21435
|
const params = this.getObjectOrClassMethodParams(method);
|
|
21425
21436
|
if (params.length > 0) {
|
|
21426
21437
|
const param = params[0];
|
|
21427
|
-
if (this.isThisParam(param) && method.kind === "get") this.raise(FlowErrors
|
|
21428
|
-
else if (this.isThisParam(param)) this.raise(FlowErrors
|
|
21438
|
+
if (this.isThisParam(param) && method.kind === "get") this.raise(FlowErrors.GetterMayNotHaveThisParam, param);
|
|
21439
|
+
else if (this.isThisParam(param)) this.raise(FlowErrors.SetterMayNotHaveThisParam, param);
|
|
21429
21440
|
}
|
|
21430
21441
|
}
|
|
21431
21442
|
parsePropertyNamePrefixOperator(node) {
|
|
@@ -21445,19 +21456,19 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
21445
21456
|
}
|
|
21446
21457
|
parseFunctionParamType(param) {
|
|
21447
21458
|
if (this.eat(13)) {
|
|
21448
|
-
if (param.type !== "Identifier") this.raise(FlowErrors
|
|
21449
|
-
if (this.isThisParam(param)) this.raise(FlowErrors
|
|
21459
|
+
if (param.type !== "Identifier") this.raise(FlowErrors.PatternIsOptional, param);
|
|
21460
|
+
if (this.isThisParam(param)) this.raise(FlowErrors.ThisParamMayNotBeOptional, param);
|
|
21450
21461
|
param.optional = true;
|
|
21451
21462
|
}
|
|
21452
21463
|
if (this.match(10)) param.typeAnnotation = this.flowParseTypeAnnotation();
|
|
21453
|
-
else if (this.isThisParam(param)) this.raise(FlowErrors
|
|
21454
|
-
if (this.match(25) && this.isThisParam(param)) this.raise(FlowErrors
|
|
21464
|
+
else if (this.isThisParam(param)) this.raise(FlowErrors.ThisParamAnnotationRequired, param);
|
|
21465
|
+
if (this.match(25) && this.isThisParam(param)) this.raise(FlowErrors.ThisParamNoDefault, param);
|
|
21455
21466
|
this.resetEndLocation(param);
|
|
21456
21467
|
return param;
|
|
21457
21468
|
}
|
|
21458
21469
|
parseMaybeDefault(startLoc, left) {
|
|
21459
21470
|
const node = super.parseMaybeDefault(startLoc, left);
|
|
21460
|
-
if (node.type === "AssignmentPattern" && node.typeAnnotation && node.right.start < node.typeAnnotation.start) this.raise(FlowErrors
|
|
21471
|
+
if (node.type === "AssignmentPattern" && node.typeAnnotation && node.right.start < node.typeAnnotation.start) this.raise(FlowErrors.TypeBeforeInitializer, node.typeAnnotation);
|
|
21461
21472
|
return node;
|
|
21462
21473
|
}
|
|
21463
21474
|
parseImportSpecifierLocal(node, specifier, type) {
|
|
@@ -21507,7 +21518,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
21507
21518
|
specifier.imported = this.parseIdentifier(true);
|
|
21508
21519
|
specifier.importKind = specifierTypeKind;
|
|
21509
21520
|
} else {
|
|
21510
|
-
if (importedIsString) throw this.raise(Errors
|
|
21521
|
+
if (importedIsString) throw this.raise(Errors.ImportBindingIsString, specifier, { importName: firstIdent.value });
|
|
21511
21522
|
specifier.imported = firstIdent;
|
|
21512
21523
|
specifier.importKind = null;
|
|
21513
21524
|
}
|
|
@@ -21518,7 +21529,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
21518
21529
|
}
|
|
21519
21530
|
}
|
|
21520
21531
|
const specifierIsTypeImport = hasTypeImportKind(specifier);
|
|
21521
|
-
if (isInTypeOnlyImport && specifierIsTypeImport) this.raise(FlowErrors
|
|
21532
|
+
if (isInTypeOnlyImport && specifierIsTypeImport) this.raise(FlowErrors.ImportTypeShorthandOnlyInPureImport, specifier);
|
|
21522
21533
|
if (isInTypeOnlyImport || specifierIsTypeImport) this.checkReservedType(specifier.local.name, specifier.local.start, true);
|
|
21523
21534
|
if (isBinding && !isInTypeOnlyImport && !specifierIsTypeImport) this.checkReservedWord(specifier.local.name, specifier.start, true, true);
|
|
21524
21535
|
return this.finishImportSpecifier(specifier, "ImportSpecifier");
|
|
@@ -21562,7 +21573,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
21562
21573
|
if (!jsx.error) return jsx.node;
|
|
21563
21574
|
const { context } = this.state;
|
|
21564
21575
|
const currentContext = context[context.length - 1];
|
|
21565
|
-
if (currentContext === types
|
|
21576
|
+
if (currentContext === types.j_oTag || currentContext === types.j_expr) context.pop();
|
|
21566
21577
|
}
|
|
21567
21578
|
if (jsx?.error || this.match(43)) {
|
|
21568
21579
|
state = state || this.state.clone();
|
|
@@ -21584,7 +21595,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
21584
21595
|
let arrowExpression = null;
|
|
21585
21596
|
if (arrow.node && this.maybeUnwrapTypeCastExpression(arrow.node).type === "ArrowFunctionExpression") {
|
|
21586
21597
|
if (!arrow.error && !arrow.aborted) {
|
|
21587
|
-
if (arrow.node.async) this.raise(FlowErrors
|
|
21598
|
+
if (arrow.node.async) this.raise(FlowErrors.UnexpectedTypeParameterBeforeAsyncArrowFunction, typeParameters);
|
|
21588
21599
|
return arrow.node;
|
|
21589
21600
|
}
|
|
21590
21601
|
arrowExpression = arrow.node;
|
|
@@ -21599,7 +21610,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
21599
21610
|
}
|
|
21600
21611
|
if (jsx?.thrown) throw jsx.error;
|
|
21601
21612
|
if (arrow.thrown) throw arrow.error;
|
|
21602
|
-
throw this.raise(FlowErrors
|
|
21613
|
+
throw this.raise(FlowErrors.UnexpectedTokenAfterTypeParameter, typeParameters);
|
|
21603
21614
|
}
|
|
21604
21615
|
return super.parseMaybeAssign(refExpressionErrors, afterLeftParse);
|
|
21605
21616
|
}
|
|
@@ -21630,7 +21641,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
21630
21641
|
}
|
|
21631
21642
|
checkParams(node, allowDuplicates, isArrowFunction, strictModeChanged = true) {
|
|
21632
21643
|
if (isArrowFunction && this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(node.start))) return;
|
|
21633
|
-
for (let i = 0; i < node.params.length; i++) if (this.isThisParam(node.params[i]) && i > 0) this.raise(FlowErrors
|
|
21644
|
+
for (let i = 0; i < node.params.length; i++) if (this.isThisParam(node.params[i]) && i > 0) this.raise(FlowErrors.ThisParamMustBeFirst, node.params[i]);
|
|
21634
21645
|
super.checkParams(node, allowDuplicates, isArrowFunction, strictModeChanged);
|
|
21635
21646
|
}
|
|
21636
21647
|
parseParenAndDistinguishExpression(canStartArrow) {
|
|
@@ -21725,12 +21736,12 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
21725
21736
|
}
|
|
21726
21737
|
parseTopLevel(file, program) {
|
|
21727
21738
|
const fileNode = super.parseTopLevel(file, program);
|
|
21728
|
-
if (this.state.hasFlowComment) this.raise(FlowErrors
|
|
21739
|
+
if (this.state.hasFlowComment) this.raise(FlowErrors.UnterminatedFlowComment, this.state.curPosition());
|
|
21729
21740
|
return fileNode;
|
|
21730
21741
|
}
|
|
21731
21742
|
skipBlockComment() {
|
|
21732
21743
|
if (this.hasPlugin("flowComments") && this.skipFlowComment()) {
|
|
21733
|
-
if (this.state.hasFlowComment) throw this.raise(FlowErrors
|
|
21744
|
+
if (this.state.hasFlowComment) throw this.raise(FlowErrors.NestedFlowComment, this.state.startLoc);
|
|
21734
21745
|
this.hasFlowCommentCompletion();
|
|
21735
21746
|
const commentSkip = this.skipFlowComment();
|
|
21736
21747
|
if (commentSkip) {
|
|
@@ -21753,19 +21764,19 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
21753
21764
|
return false;
|
|
21754
21765
|
}
|
|
21755
21766
|
hasFlowCommentCompletion() {
|
|
21756
|
-
if (this.input.indexOf("*/", this.state.pos) === -1) throw this.raise(Errors
|
|
21767
|
+
if (this.input.indexOf("*/", this.state.pos) === -1) throw this.raise(Errors.UnterminatedComment, this.state.curPosition());
|
|
21757
21768
|
}
|
|
21758
21769
|
flowEnumErrorBooleanMemberNotInitialized(loc, names) {
|
|
21759
|
-
this.raise(FlowErrors
|
|
21770
|
+
this.raise(FlowErrors.EnumBooleanMemberNotInitialized, loc, names);
|
|
21760
21771
|
}
|
|
21761
21772
|
flowEnumErrorInvalidMemberInitializer(loc, enumContext) {
|
|
21762
|
-
return this.raise(!enumContext.explicitType ? FlowErrors
|
|
21773
|
+
return this.raise(!enumContext.explicitType ? FlowErrors.EnumInvalidMemberInitializerUnknownType : enumContext.explicitType === "symbol" ? FlowErrors.EnumInvalidMemberInitializerSymbolType : FlowErrors.EnumInvalidMemberInitializerPrimaryType, loc, enumContext);
|
|
21763
21774
|
}
|
|
21764
21775
|
flowEnumErrorNumberMemberNotInitialized(loc, details) {
|
|
21765
|
-
this.raise(FlowErrors
|
|
21776
|
+
this.raise(FlowErrors.EnumNumberMemberNotInitialized, loc, details);
|
|
21766
21777
|
}
|
|
21767
21778
|
flowEnumErrorStringMemberInconsistentlyInitialized(node, details) {
|
|
21768
|
-
this.raise(FlowErrors
|
|
21779
|
+
this.raise(FlowErrors.EnumStringMemberInconsistentlyInitialized, node, details);
|
|
21769
21780
|
}
|
|
21770
21781
|
flowEnumMemberInit() {
|
|
21771
21782
|
const startLoc = this.state.startLoc;
|
|
@@ -21837,12 +21848,12 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
21837
21848
|
const { id, init } = this.flowEnumMemberRaw();
|
|
21838
21849
|
const memberName = id.name;
|
|
21839
21850
|
if (memberName === "") continue;
|
|
21840
|
-
if (/^[a-z]/.test(memberName)) this.raise(FlowErrors
|
|
21851
|
+
if (/^[a-z]/.test(memberName)) this.raise(FlowErrors.EnumInvalidMemberName, id, {
|
|
21841
21852
|
memberName,
|
|
21842
21853
|
suggestion: memberName[0].toUpperCase() + memberName.slice(1),
|
|
21843
21854
|
enumName
|
|
21844
21855
|
});
|
|
21845
|
-
if (seenNames.has(memberName)) this.raise(FlowErrors
|
|
21856
|
+
if (seenNames.has(memberName)) this.raise(FlowErrors.EnumDuplicateMemberName, id, {
|
|
21846
21857
|
memberName,
|
|
21847
21858
|
enumName
|
|
21848
21859
|
});
|
|
@@ -21900,10 +21911,10 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
21900
21911
|
}
|
|
21901
21912
|
flowEnumParseExplicitType({ enumName }) {
|
|
21902
21913
|
if (!this.eatContextual(98)) return null;
|
|
21903
|
-
if (!tokenIsIdentifier(this.state.type)) throw this.raise(FlowErrors
|
|
21914
|
+
if (!tokenIsIdentifier(this.state.type)) throw this.raise(FlowErrors.EnumInvalidExplicitTypeUnknownSupplied, this.state.startLoc, { enumName });
|
|
21904
21915
|
const { value } = this.state;
|
|
21905
21916
|
this.next();
|
|
21906
|
-
if (value !== "boolean" && value !== "number" && value !== "string" && value !== "symbol") this.raise(FlowErrors
|
|
21917
|
+
if (value !== "boolean" && value !== "number" && value !== "string" && value !== "symbol") this.raise(FlowErrors.EnumInvalidExplicitType, this.state.startLoc, {
|
|
21907
21918
|
enumName,
|
|
21908
21919
|
invalidEnumType: value
|
|
21909
21920
|
});
|
|
@@ -21972,7 +21983,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
21972
21983
|
this.expect(4);
|
|
21973
21984
|
return this.finishNode(node, "EnumNumberBody");
|
|
21974
21985
|
} else {
|
|
21975
|
-
this.raise(FlowErrors
|
|
21986
|
+
this.raise(FlowErrors.EnumInconsistentMemberValues, nameLoc, { enumName });
|
|
21976
21987
|
return empty();
|
|
21977
21988
|
}
|
|
21978
21989
|
}
|
|
@@ -22277,7 +22288,7 @@ const entities = {
|
|
|
22277
22288
|
hearts: "♥",
|
|
22278
22289
|
diams: "♦"
|
|
22279
22290
|
};
|
|
22280
|
-
const lineBreakG
|
|
22291
|
+
const lineBreakG = new RegExp(/\r\n|[\r\n\u2028\u2029]/.source, "g");
|
|
22281
22292
|
function isNewLine(code) {
|
|
22282
22293
|
switch (code) {
|
|
22283
22294
|
case 10:
|
|
@@ -22319,7 +22330,7 @@ function isWhitespace(code) {
|
|
|
22319
22330
|
default: return false;
|
|
22320
22331
|
}
|
|
22321
22332
|
}
|
|
22322
|
-
const JsxErrors
|
|
22333
|
+
const JsxErrors = ParseErrorEnum`jsx`({
|
|
22323
22334
|
AttributeIsEmpty: "JSX attributes must only be assigned a non-empty expression.",
|
|
22324
22335
|
MissingClosingTagElement: ({ openingTagName }) => `Expected corresponding JSX closing tag for <${openingTagName}>.`,
|
|
22325
22336
|
MissingClosingTagFragment: "Expected corresponding JSX closing tag for <>.",
|
|
@@ -22343,7 +22354,7 @@ const jsx = (superClass) => class JSXParserMixin extends superClass {
|
|
|
22343
22354
|
let out = "";
|
|
22344
22355
|
let chunkStart = this.state.pos;
|
|
22345
22356
|
for (;;) {
|
|
22346
|
-
if (this.state.pos >= this.length) throw this.raise(JsxErrors
|
|
22357
|
+
if (this.state.pos >= this.length) throw this.raise(JsxErrors.UnterminatedJsxContent, this.state.startLoc);
|
|
22347
22358
|
const ch = this.input.charCodeAt(this.state.pos);
|
|
22348
22359
|
switch (ch) {
|
|
22349
22360
|
case 60:
|
|
@@ -22364,7 +22375,7 @@ const jsx = (superClass) => class JSXParserMixin extends superClass {
|
|
|
22364
22375
|
chunkStart = this.state.pos;
|
|
22365
22376
|
break;
|
|
22366
22377
|
case 62:
|
|
22367
|
-
case 125: this.raise(JsxErrors
|
|
22378
|
+
case 125: this.raise(JsxErrors.UnexpectedToken, this.state.curPosition(), {
|
|
22368
22379
|
unexpected: this.input[this.state.pos],
|
|
22369
22380
|
HTMLEntity: ch === 125 ? "}" : ">"
|
|
22370
22381
|
});
|
|
@@ -22392,7 +22403,7 @@ const jsx = (superClass) => class JSXParserMixin extends superClass {
|
|
|
22392
22403
|
let out = "";
|
|
22393
22404
|
let chunkStart = ++this.state.pos;
|
|
22394
22405
|
for (;;) {
|
|
22395
|
-
if (this.state.pos >= this.length) throw this.raise(Errors
|
|
22406
|
+
if (this.state.pos >= this.length) throw this.raise(Errors.UnterminatedString, this.state.startLoc);
|
|
22396
22407
|
const ch = this.input.charCodeAt(this.state.pos);
|
|
22397
22408
|
if (ch === quote) break;
|
|
22398
22409
|
if (ch === 38) {
|
|
@@ -22477,14 +22488,14 @@ const jsx = (superClass) => class JSXParserMixin extends superClass {
|
|
|
22477
22488
|
switch (this.state.type) {
|
|
22478
22489
|
case 2:
|
|
22479
22490
|
node = this.startNode();
|
|
22480
|
-
this.setContext(types
|
|
22491
|
+
this.setContext(types.brace);
|
|
22481
22492
|
this.next();
|
|
22482
|
-
node = this.jsxParseExpressionContainer(node, types
|
|
22483
|
-
if (node.expression.type === "JSXEmptyExpression") this.raise(JsxErrors
|
|
22493
|
+
node = this.jsxParseExpressionContainer(node, types.j_oTag);
|
|
22494
|
+
if (node.expression.type === "JSXEmptyExpression") this.raise(JsxErrors.AttributeIsEmpty, node);
|
|
22484
22495
|
return node;
|
|
22485
22496
|
case 138:
|
|
22486
22497
|
case 130: return this.parseExprAtom();
|
|
22487
|
-
default: throw this.raise(JsxErrors
|
|
22498
|
+
default: throw this.raise(JsxErrors.UnsupportedJsxValue, this.state.startLoc);
|
|
22488
22499
|
}
|
|
22489
22500
|
}
|
|
22490
22501
|
jsxParseEmptyExpression() {
|
|
@@ -22494,7 +22505,7 @@ const jsx = (superClass) => class JSXParserMixin extends superClass {
|
|
|
22494
22505
|
jsxParseSpreadChild(node) {
|
|
22495
22506
|
this.next();
|
|
22496
22507
|
node.expression = this.parseExpression();
|
|
22497
|
-
this.setContext(types
|
|
22508
|
+
this.setContext(types.j_expr);
|
|
22498
22509
|
this.state.canStartJSXElement = true;
|
|
22499
22510
|
this.expect(4);
|
|
22500
22511
|
return this.finishNode(node, "JSXSpreadChild");
|
|
@@ -22503,7 +22514,7 @@ const jsx = (superClass) => class JSXParserMixin extends superClass {
|
|
|
22503
22514
|
if (this.match(4)) node.expression = this.jsxParseEmptyExpression();
|
|
22504
22515
|
else {
|
|
22505
22516
|
const expression = this.parseExpression();
|
|
22506
|
-
if (expression.type === "SequenceExpression" && !expression.extra?.parenthesized) this.raise(JsxErrors
|
|
22517
|
+
if (expression.type === "SequenceExpression" && !expression.extra?.parenthesized) this.raise(JsxErrors.UnexpectedSequenceExpression, expression.expressions[1]);
|
|
22507
22518
|
node.expression = expression;
|
|
22508
22519
|
}
|
|
22509
22520
|
this.setContext(previousContext);
|
|
@@ -22514,11 +22525,11 @@ const jsx = (superClass) => class JSXParserMixin extends superClass {
|
|
|
22514
22525
|
jsxParseAttribute() {
|
|
22515
22526
|
if (this.match(2)) {
|
|
22516
22527
|
const node = this.startNode();
|
|
22517
|
-
this.setContext(types
|
|
22528
|
+
this.setContext(types.brace);
|
|
22518
22529
|
this.next();
|
|
22519
22530
|
this.expect(17);
|
|
22520
22531
|
node.argument = this.parseMaybeAssignAllowIn();
|
|
22521
|
-
this.setContext(types
|
|
22532
|
+
this.setContext(types.j_oTag);
|
|
22522
22533
|
this.state.canStartJSXElement = true;
|
|
22523
22534
|
this.expect(4);
|
|
22524
22535
|
return this.finishNode(node, "JSXSpreadAttribute");
|
|
@@ -22577,18 +22588,18 @@ const jsx = (superClass) => class JSXParserMixin extends superClass {
|
|
|
22577
22588
|
break;
|
|
22578
22589
|
case 2: {
|
|
22579
22590
|
const node = this.startNode();
|
|
22580
|
-
this.setContext(types
|
|
22591
|
+
this.setContext(types.brace);
|
|
22581
22592
|
this.next();
|
|
22582
22593
|
if (this.match(17)) children.push(this.jsxParseSpreadChild(node));
|
|
22583
|
-
else children.push(this.jsxParseExpressionContainer(node, types
|
|
22594
|
+
else children.push(this.jsxParseExpressionContainer(node, types.j_expr));
|
|
22584
22595
|
break;
|
|
22585
22596
|
}
|
|
22586
22597
|
default: this.unexpected();
|
|
22587
22598
|
}
|
|
22588
|
-
if (isFragment(openingElement) && !isFragment(closingElement) && closingElement !== null) this.raise(JsxErrors
|
|
22589
|
-
else if (!isFragment(openingElement) && isFragment(closingElement)) this.raise(JsxErrors
|
|
22599
|
+
if (isFragment(openingElement) && !isFragment(closingElement) && closingElement !== null) this.raise(JsxErrors.MissingClosingTagFragment, closingElement);
|
|
22600
|
+
else if (!isFragment(openingElement) && isFragment(closingElement)) this.raise(JsxErrors.MissingClosingTagElement, closingElement, { openingTagName: getQualifiedJSXName(openingElement.name) });
|
|
22590
22601
|
else if (!isFragment(openingElement) && !isFragment(closingElement)) {
|
|
22591
|
-
if (getQualifiedJSXName(closingElement.name) !== getQualifiedJSXName(openingElement.name)) this.raise(JsxErrors
|
|
22602
|
+
if (getQualifiedJSXName(closingElement.name) !== getQualifiedJSXName(openingElement.name)) this.raise(JsxErrors.MissingClosingTagElement, closingElement, { openingTagName: getQualifiedJSXName(openingElement.name) });
|
|
22592
22603
|
}
|
|
22593
22604
|
}
|
|
22594
22605
|
if (isFragment(openingElement)) {
|
|
@@ -22599,7 +22610,7 @@ const jsx = (superClass) => class JSXParserMixin extends superClass {
|
|
|
22599
22610
|
node.closingElement = closingElement;
|
|
22600
22611
|
}
|
|
22601
22612
|
node.children = children;
|
|
22602
|
-
if (this.match(43)) throw this.raise(JsxErrors
|
|
22613
|
+
if (this.match(43)) throw this.raise(JsxErrors.UnwrappedAdjacentJSXElements, this.state.startLoc);
|
|
22603
22614
|
return isFragment(openingElement) ? this.finishNode(node, "JSXFragment") : this.finishNode(node, "JSXElement");
|
|
22604
22615
|
}
|
|
22605
22616
|
jsxParseElement() {
|
|
@@ -22623,11 +22634,11 @@ const jsx = (superClass) => class JSXParserMixin extends superClass {
|
|
|
22623
22634
|
}
|
|
22624
22635
|
getTokenFromCode(code) {
|
|
22625
22636
|
const context = this.curContext();
|
|
22626
|
-
if (context === types
|
|
22637
|
+
if (context === types.j_expr) {
|
|
22627
22638
|
this.jsxReadToken();
|
|
22628
22639
|
return;
|
|
22629
22640
|
}
|
|
22630
|
-
if (context === types
|
|
22641
|
+
if (context === types.j_oTag || context === types.j_cTag) {
|
|
22631
22642
|
if (isIdentifierStart(code)) {
|
|
22632
22643
|
this.jsxReadWord();
|
|
22633
22644
|
return;
|
|
@@ -22637,7 +22648,7 @@ const jsx = (superClass) => class JSXParserMixin extends superClass {
|
|
|
22637
22648
|
this.finishToken(139);
|
|
22638
22649
|
return;
|
|
22639
22650
|
}
|
|
22640
|
-
if ((code === 34 || code === 39) && context === types
|
|
22651
|
+
if ((code === 34 || code === 39) && context === types.j_oTag) {
|
|
22641
22652
|
this.jsxReadString(code);
|
|
22642
22653
|
return;
|
|
22643
22654
|
}
|
|
@@ -22652,16 +22663,16 @@ const jsx = (superClass) => class JSXParserMixin extends superClass {
|
|
|
22652
22663
|
updateContext(prevType) {
|
|
22653
22664
|
const { context, type } = this.state;
|
|
22654
22665
|
if (type === 52 && prevType === 138) {
|
|
22655
|
-
context.splice(-2, 2, types
|
|
22666
|
+
context.splice(-2, 2, types.j_cTag);
|
|
22656
22667
|
this.state.canStartJSXElement = false;
|
|
22657
|
-
} else if (type === 138) context.push(types
|
|
22668
|
+
} else if (type === 138) context.push(types.j_oTag);
|
|
22658
22669
|
else if (type === 139) {
|
|
22659
22670
|
const out = context[context.length - 1];
|
|
22660
|
-
if (out === types
|
|
22671
|
+
if (out === types.j_oTag && prevType === 52 || out === types.j_cTag) {
|
|
22661
22672
|
context.pop();
|
|
22662
|
-
this.state.canStartJSXElement = context[context.length - 1] === types
|
|
22673
|
+
this.state.canStartJSXElement = context[context.length - 1] === types.j_expr;
|
|
22663
22674
|
} else {
|
|
22664
|
-
this.setContext(types
|
|
22675
|
+
this.setContext(types.j_expr);
|
|
22665
22676
|
this.state.canStartJSXElement = true;
|
|
22666
22677
|
}
|
|
22667
22678
|
} else this.state.canStartJSXElement = tokenComesBeforeExpression(type);
|
|
@@ -22699,7 +22710,7 @@ var TypeScriptScopeHandler = class extends ScopeHandler {
|
|
|
22699
22710
|
}
|
|
22700
22711
|
declareName(name, bindingType, loc) {
|
|
22701
22712
|
if (bindingType & 4096) {
|
|
22702
|
-
if (this.hasImport(name, true)) this.parser.raise(Errors
|
|
22713
|
+
if (this.hasImport(name, true)) this.parser.raise(Errors.VarRedeclaration, loc, { identifierName: name });
|
|
22703
22714
|
this.importsStack[this.importsStack.length - 1].add(name);
|
|
22704
22715
|
return;
|
|
22705
22716
|
}
|
|
@@ -22913,7 +22924,7 @@ var State = class State {
|
|
|
22913
22924
|
this.startIndex = startIndex;
|
|
22914
22925
|
this.curLine = startLine;
|
|
22915
22926
|
this.lineStart = -startColumn;
|
|
22916
|
-
this.startLoc = this.endLoc = new Position
|
|
22927
|
+
this.startLoc = this.endLoc = new Position(startLine, startColumn, startIndex);
|
|
22917
22928
|
}
|
|
22918
22929
|
errors = [];
|
|
22919
22930
|
noArrowAt = [];
|
|
@@ -22998,7 +23009,7 @@ var State = class State {
|
|
|
22998
23009
|
end = 0;
|
|
22999
23010
|
lastTokEndLoc = null;
|
|
23000
23011
|
lastTokStartLoc = null;
|
|
23001
|
-
context = [types
|
|
23012
|
+
context = [types.brace];
|
|
23002
23013
|
get canStartJSXElement() {
|
|
23003
23014
|
return (this.flags & 2048) > 0;
|
|
23004
23015
|
}
|
|
@@ -23024,7 +23035,7 @@ var State = class State {
|
|
|
23024
23035
|
strictErrors = /* @__PURE__ */ new Map();
|
|
23025
23036
|
tokensLength = 0;
|
|
23026
23037
|
curPosition() {
|
|
23027
|
-
return new Position
|
|
23038
|
+
return new Position(this.curLine, this.pos - this.lineStart, this.pos + this.startIndex);
|
|
23028
23039
|
}
|
|
23029
23040
|
clone() {
|
|
23030
23041
|
const state = new State();
|
|
@@ -23273,7 +23284,7 @@ function readCodePoint(input, pos, lineStart, curLine, throwOnInvalid, errors) {
|
|
|
23273
23284
|
};
|
|
23274
23285
|
}
|
|
23275
23286
|
function buildPosition(pos, lineStart, curLine) {
|
|
23276
|
-
return new Position
|
|
23287
|
+
return new Position(curLine, pos - lineStart, pos);
|
|
23277
23288
|
}
|
|
23278
23289
|
const VALID_REGEX_FLAGS = new Set([
|
|
23279
23290
|
103,
|
|
@@ -23292,7 +23303,7 @@ var Token = class {
|
|
|
23292
23303
|
this.value = state.value;
|
|
23293
23304
|
this.start = startIndex + state.start;
|
|
23294
23305
|
this.end = startIndex + state.end;
|
|
23295
|
-
this.loc = new SourceLocation
|
|
23306
|
+
this.loc = new SourceLocation(state.startLoc, state.endLoc);
|
|
23296
23307
|
}
|
|
23297
23308
|
};
|
|
23298
23309
|
let locDataCache;
|
|
@@ -23322,7 +23333,7 @@ var Tokenizer = class extends CommentsParser {
|
|
|
23322
23333
|
}
|
|
23323
23334
|
getLoc(locIndex) {
|
|
23324
23335
|
const dataIndex = this.offsetToSourcePos(locIndex);
|
|
23325
|
-
return new Position
|
|
23336
|
+
return new Position(this.locData[dataIndex * 2], this.locData[dataIndex * 2 + 1], locIndex);
|
|
23326
23337
|
}
|
|
23327
23338
|
pushToken(token) {
|
|
23328
23339
|
this.tokens.length = this.state.tokensLength;
|
|
@@ -23427,12 +23438,12 @@ var Tokenizer = class extends CommentsParser {
|
|
|
23427
23438
|
if (!this.isLookahead) startLoc = this.state.curPosition();
|
|
23428
23439
|
const start = this.state.pos;
|
|
23429
23440
|
const end = this.input.indexOf(commentEnd, start + 2);
|
|
23430
|
-
if (end === -1) throw this.raise(Errors
|
|
23441
|
+
if (end === -1) throw this.raise(Errors.UnterminatedComment, this.state.curPosition());
|
|
23431
23442
|
this.state.pos = end + commentEnd.length;
|
|
23432
|
-
lineBreakG
|
|
23433
|
-
while (lineBreakG
|
|
23443
|
+
lineBreakG.lastIndex = start + 2;
|
|
23444
|
+
while (lineBreakG.test(this.input) && lineBreakG.lastIndex <= end) {
|
|
23434
23445
|
++this.state.curLine;
|
|
23435
|
-
this.state.lineStart = lineBreakG
|
|
23446
|
+
this.state.lineStart = lineBreakG.lastIndex;
|
|
23436
23447
|
}
|
|
23437
23448
|
if (this.isLookahead) return;
|
|
23438
23449
|
const comment = {
|
|
@@ -23440,7 +23451,7 @@ var Tokenizer = class extends CommentsParser {
|
|
|
23440
23451
|
value: this.input.slice(start + 2, end),
|
|
23441
23452
|
start: this.sourceToOffsetPos(start),
|
|
23442
23453
|
end: this.sourceToOffsetPos(end + commentEnd.length),
|
|
23443
|
-
loc: new SourceLocation
|
|
23454
|
+
loc: new SourceLocation(startLoc, this.state.curPosition())
|
|
23444
23455
|
};
|
|
23445
23456
|
if (this.optionFlags & 512) this.pushToken(comment);
|
|
23446
23457
|
return comment;
|
|
@@ -23458,7 +23469,7 @@ var Tokenizer = class extends CommentsParser {
|
|
|
23458
23469
|
value: this.input.slice(start + startSkip, end),
|
|
23459
23470
|
start: this.sourceToOffsetPos(start),
|
|
23460
23471
|
end: this.sourceToOffsetPos(end),
|
|
23461
|
-
loc: new SourceLocation
|
|
23472
|
+
loc: new SourceLocation(startLoc, this.state.curPosition())
|
|
23462
23473
|
};
|
|
23463
23474
|
if (this.optionFlags & 512) this.pushToken(comment);
|
|
23464
23475
|
return comment;
|
|
@@ -23554,7 +23565,7 @@ var Tokenizer = class extends CommentsParser {
|
|
|
23554
23565
|
if (this.state.pos === 0 && this.readToken_interpreter()) return;
|
|
23555
23566
|
const nextPos = this.state.pos + 1;
|
|
23556
23567
|
const next = this.codePointAtPos(nextPos);
|
|
23557
|
-
if (next >= 48 && next <= 57) throw this.raise(Errors
|
|
23568
|
+
if (next >= 48 && next <= 57) throw this.raise(Errors.UnexpectedDigitAfterHash, this.state.curPosition());
|
|
23558
23569
|
if (isIdentifierStart(next)) {
|
|
23559
23570
|
++this.state.pos;
|
|
23560
23571
|
this.finishToken(134, this.readWord1(next));
|
|
@@ -23839,7 +23850,7 @@ var Tokenizer = class extends CommentsParser {
|
|
|
23839
23850
|
return;
|
|
23840
23851
|
}
|
|
23841
23852
|
}
|
|
23842
|
-
throw this.raise(Errors
|
|
23853
|
+
throw this.raise(Errors.InvalidOrUnexpectedToken, this.state.curPosition(), { unexpected: String.fromCodePoint(code) });
|
|
23843
23854
|
}
|
|
23844
23855
|
finishOp(type, size) {
|
|
23845
23856
|
const str = this.input.slice(this.state.pos, this.state.pos + size);
|
|
@@ -23852,9 +23863,9 @@ var Tokenizer = class extends CommentsParser {
|
|
|
23852
23863
|
let escaped, inClass;
|
|
23853
23864
|
let { pos } = this.state;
|
|
23854
23865
|
for (;; ++pos) {
|
|
23855
|
-
if (pos >= this.length) throw this.raise(Errors
|
|
23866
|
+
if (pos >= this.length) throw this.raise(Errors.UnterminatedRegExp, createPositionWithColumnOffset(startLoc, 1));
|
|
23856
23867
|
const ch = this.input.charCodeAt(pos);
|
|
23857
|
-
if (isNewLine(ch)) throw this.raise(Errors
|
|
23868
|
+
if (isNewLine(ch)) throw this.raise(Errors.UnterminatedRegExp, createPositionWithColumnOffset(startLoc, 1));
|
|
23858
23869
|
if (escaped) escaped = false;
|
|
23859
23870
|
else {
|
|
23860
23871
|
if (ch === 91) inClass = true;
|
|
@@ -23872,12 +23883,12 @@ var Tokenizer = class extends CommentsParser {
|
|
|
23872
23883
|
const char = String.fromCharCode(cp);
|
|
23873
23884
|
if (VALID_REGEX_FLAGS.has(cp)) {
|
|
23874
23885
|
if (cp === 118) {
|
|
23875
|
-
if (mods.includes("u")) this.raise(Errors
|
|
23886
|
+
if (mods.includes("u")) this.raise(Errors.IncompatibleRegExpUVFlags, nextPos());
|
|
23876
23887
|
} else if (cp === 117) {
|
|
23877
|
-
if (mods.includes("v")) this.raise(Errors
|
|
23888
|
+
if (mods.includes("v")) this.raise(Errors.IncompatibleRegExpUVFlags, nextPos());
|
|
23878
23889
|
}
|
|
23879
|
-
if (mods.includes(char)) this.raise(Errors
|
|
23880
|
-
} else if (isIdentifierChar(cp) || cp === 92) this.raise(Errors
|
|
23890
|
+
if (mods.includes(char)) this.raise(Errors.DuplicateRegExpFlags, nextPos());
|
|
23891
|
+
} else if (isIdentifierChar(cp) || cp === 92) this.raise(Errors.MalformedRegExpFlags, nextPos());
|
|
23881
23892
|
else break;
|
|
23882
23893
|
++pos;
|
|
23883
23894
|
mods += char;
|
|
@@ -23899,12 +23910,12 @@ var Tokenizer = class extends CommentsParser {
|
|
|
23899
23910
|
let isBigInt = false;
|
|
23900
23911
|
this.state.pos += 2;
|
|
23901
23912
|
const val = this.readInt(radix);
|
|
23902
|
-
if (val == null) this.raise(Errors
|
|
23913
|
+
if (val == null) this.raise(Errors.InvalidDigit, createPositionWithColumnOffset(startLoc, 2), { radix });
|
|
23903
23914
|
if (this.input.charCodeAt(this.state.pos) === 110) {
|
|
23904
23915
|
++this.state.pos;
|
|
23905
23916
|
isBigInt = true;
|
|
23906
23917
|
}
|
|
23907
|
-
if (isIdentifierStart(this.codePointAtPos(this.state.pos))) throw this.raise(Errors
|
|
23918
|
+
if (isIdentifierStart(this.codePointAtPos(this.state.pos))) throw this.raise(Errors.NumberIdentifier, this.state.curPosition());
|
|
23908
23919
|
if (isBigInt) {
|
|
23909
23920
|
const str = this.input.slice(start, this.state.pos).replace(/[_n]/g, "");
|
|
23910
23921
|
this.finishToken(132, str);
|
|
@@ -23918,14 +23929,14 @@ var Tokenizer = class extends CommentsParser {
|
|
|
23918
23929
|
let isFloat = false;
|
|
23919
23930
|
let isBigInt = false;
|
|
23920
23931
|
let isOctal = false;
|
|
23921
|
-
if (!startsWithDot && this.readInt(10) === null) this.raise(Errors
|
|
23932
|
+
if (!startsWithDot && this.readInt(10) === null) this.raise(Errors.InvalidNumber, this.state.curPosition());
|
|
23922
23933
|
const hasLeadingZero = this.state.pos - start >= 2 && this.input.charCodeAt(start) === 48;
|
|
23923
23934
|
if (hasLeadingZero) {
|
|
23924
23935
|
const integer = this.input.slice(start, this.state.pos);
|
|
23925
|
-
this.recordStrictModeErrors(Errors
|
|
23936
|
+
this.recordStrictModeErrors(Errors.StrictOctalLiteral, startLoc);
|
|
23926
23937
|
if (!this.state.strict) {
|
|
23927
23938
|
const underscorePos = integer.indexOf("_");
|
|
23928
|
-
if (underscorePos > 0) this.raise(Errors
|
|
23939
|
+
if (underscorePos > 0) this.raise(Errors.ZeroDigitNumericSeparator, createPositionWithColumnOffset(startLoc, underscorePos));
|
|
23929
23940
|
}
|
|
23930
23941
|
isOctal = hasLeadingZero && !/[89]/.test(integer);
|
|
23931
23942
|
}
|
|
@@ -23939,17 +23950,17 @@ var Tokenizer = class extends CommentsParser {
|
|
|
23939
23950
|
if ((next === 69 || next === 101) && !isOctal) {
|
|
23940
23951
|
next = this.input.charCodeAt(++this.state.pos);
|
|
23941
23952
|
if (next === 43 || next === 45) ++this.state.pos;
|
|
23942
|
-
if (this.readInt(10) === null) this.raise(Errors
|
|
23953
|
+
if (this.readInt(10) === null) this.raise(Errors.InvalidOrMissingExponent, startLoc);
|
|
23943
23954
|
isFloat = true;
|
|
23944
23955
|
next = this.input.charCodeAt(this.state.pos);
|
|
23945
23956
|
}
|
|
23946
23957
|
const str = this.input.slice(start, this.state.pos).replaceAll("_", "");
|
|
23947
23958
|
if (next === 110) {
|
|
23948
|
-
if (isFloat || hasLeadingZero) this.raise(Errors
|
|
23959
|
+
if (isFloat || hasLeadingZero) this.raise(Errors.InvalidBigIntLiteral, startLoc);
|
|
23949
23960
|
++this.state.pos;
|
|
23950
23961
|
isBigInt = true;
|
|
23951
23962
|
}
|
|
23952
|
-
if (isIdentifierStart(this.codePointAtPos(this.state.pos))) throw this.raise(Errors
|
|
23963
|
+
if (isIdentifierStart(this.codePointAtPos(this.state.pos))) throw this.raise(Errors.NumberIdentifier, this.state.curPosition());
|
|
23953
23964
|
if (isBigInt) {
|
|
23954
23965
|
this.finishToken(132, str);
|
|
23955
23966
|
return;
|
|
@@ -23980,7 +23991,7 @@ var Tokenizer = class extends CommentsParser {
|
|
|
23980
23991
|
this.state.pos = pos + 1;
|
|
23981
23992
|
this.state.lineStart = lineStart;
|
|
23982
23993
|
this.state.curLine = curLine;
|
|
23983
|
-
if (firstInvalidLoc) this.state.firstInvalidTemplateEscapePos = new Position
|
|
23994
|
+
if (firstInvalidLoc) this.state.firstInvalidTemplateEscapePos = new Position(firstInvalidLoc.curLine, firstInvalidLoc.pos - firstInvalidLoc.lineStart, this.sourceToOffsetPos(firstInvalidLoc.pos));
|
|
23984
23995
|
if (this.input.codePointAt(pos) === 96) this.finishToken(20, firstInvalidLoc ? null : opening + str + "`");
|
|
23985
23996
|
else {
|
|
23986
23997
|
this.state.pos++;
|
|
@@ -24007,14 +24018,14 @@ var Tokenizer = class extends CommentsParser {
|
|
|
24007
24018
|
const escStart = this.state.curPosition();
|
|
24008
24019
|
const identifierCheck = this.state.pos === start ? isIdentifierStart : isIdentifierChar;
|
|
24009
24020
|
if (this.input.charCodeAt(++this.state.pos) !== 117) {
|
|
24010
|
-
this.raise(Errors
|
|
24021
|
+
this.raise(Errors.MissingUnicodeEscape, this.state.curPosition());
|
|
24011
24022
|
chunkStart = this.state.pos - 1;
|
|
24012
24023
|
continue;
|
|
24013
24024
|
}
|
|
24014
24025
|
++this.state.pos;
|
|
24015
24026
|
const esc = this.readCodePoint(true);
|
|
24016
24027
|
if (esc !== null) {
|
|
24017
|
-
if (!identifierCheck(esc)) this.raise(Errors
|
|
24028
|
+
if (!identifierCheck(esc)) this.raise(Errors.EscapedCharNotAnIdentifier, escStart);
|
|
24018
24029
|
word += String.fromCodePoint(esc);
|
|
24019
24030
|
}
|
|
24020
24031
|
chunkStart = this.state.pos;
|
|
@@ -24024,24 +24035,24 @@ var Tokenizer = class extends CommentsParser {
|
|
|
24024
24035
|
}
|
|
24025
24036
|
readWord(firstCode) {
|
|
24026
24037
|
const word = this.readWord1(firstCode);
|
|
24027
|
-
const type = keywords$1
|
|
24038
|
+
const type = keywords$1.get(word);
|
|
24028
24039
|
if (type !== void 0) this.finishToken(type, tokenLabelName(type));
|
|
24029
24040
|
else this.finishToken(128, word);
|
|
24030
24041
|
}
|
|
24031
24042
|
checkKeywordEscapes() {
|
|
24032
24043
|
const { type } = this.state;
|
|
24033
|
-
if (tokenIsKeyword(type) && this.state.containsEsc) this.raise(Errors
|
|
24044
|
+
if (tokenIsKeyword(type) && this.state.containsEsc) this.raise(Errors.InvalidEscapedReservedWord, this.state.startLoc, { reservedWord: tokenLabelName(type) });
|
|
24034
24045
|
}
|
|
24035
24046
|
raise(toParseError, at, details = {}) {
|
|
24036
|
-
const loc = at instanceof Position
|
|
24037
|
-
const error = toParseError(loc, at instanceof Position
|
|
24047
|
+
const loc = at instanceof Position ? at : typeof at === "number" ? this.getLoc(at) : this.optionFlags & 256 ? at.loc.start : this.getLoc(at.start);
|
|
24048
|
+
const error = toParseError(loc, at instanceof Position ? loc.index : typeof at === "number" ? at : at.start, details);
|
|
24038
24049
|
if (!(this.optionFlags & 4096)) throw error;
|
|
24039
24050
|
if (!this.isLookahead) this.state.errors.push(error);
|
|
24040
24051
|
return error;
|
|
24041
24052
|
}
|
|
24042
24053
|
raiseOverwrite(toParseError, at, details = {}) {
|
|
24043
|
-
const loc = at instanceof Position
|
|
24044
|
-
const pos = at instanceof Position
|
|
24054
|
+
const loc = at instanceof Position ? at : this.optionFlags & 256 ? at.loc.start : this.getLoc(at.start);
|
|
24055
|
+
const pos = at instanceof Position ? loc.index : at.start;
|
|
24045
24056
|
const errors = this.state.errors;
|
|
24046
24057
|
for (let i = errors.length - 1; i >= 0; i--) {
|
|
24047
24058
|
const error = errors[i];
|
|
@@ -24052,14 +24063,14 @@ var Tokenizer = class extends CommentsParser {
|
|
|
24052
24063
|
}
|
|
24053
24064
|
updateContext(prevType) {}
|
|
24054
24065
|
unexpected(loc, type) {
|
|
24055
|
-
throw this.raise(Errors
|
|
24066
|
+
throw this.raise(Errors.UnexpectedToken, loc != null ? loc : this.state.startLoc, { expected: type ? tokenLabelName(type) : null });
|
|
24056
24067
|
}
|
|
24057
24068
|
expectPlugin(pluginName, loc) {
|
|
24058
24069
|
if (this.hasPlugin(pluginName)) return true;
|
|
24059
|
-
throw this.raise(Errors
|
|
24070
|
+
throw this.raise(Errors.MissingPlugin, loc != null ? loc : this.state.startLoc, { missingPlugin: [pluginName] });
|
|
24060
24071
|
}
|
|
24061
24072
|
expectOnePlugin(pluginNames) {
|
|
24062
|
-
if (!pluginNames.some((name) => this.hasPlugin(name))) throw this.raise(Errors
|
|
24073
|
+
if (!pluginNames.some((name) => this.hasPlugin(name))) throw this.raise(Errors.MissingOneOfPlugins, this.state.startLoc, { missingPlugin: pluginNames });
|
|
24063
24074
|
}
|
|
24064
24075
|
errorBuilder(error) {
|
|
24065
24076
|
return (pos, lineStart, curLine) => {
|
|
@@ -24069,31 +24080,31 @@ var Tokenizer = class extends CommentsParser {
|
|
|
24069
24080
|
errorHandlers_readInt = {
|
|
24070
24081
|
invalidDigit: (pos, lineStart, curLine, radix) => {
|
|
24071
24082
|
if (!(this.optionFlags & 4096)) return false;
|
|
24072
|
-
this.raise(Errors
|
|
24083
|
+
this.raise(Errors.InvalidDigit, buildPosition(pos, lineStart, curLine), { radix });
|
|
24073
24084
|
return true;
|
|
24074
24085
|
},
|
|
24075
|
-
numericSeparatorInEscapeSequence: this.errorBuilder(Errors
|
|
24076
|
-
unexpectedNumericSeparator: this.errorBuilder(Errors
|
|
24086
|
+
numericSeparatorInEscapeSequence: this.errorBuilder(Errors.NumericSeparatorInEscapeSequence),
|
|
24087
|
+
unexpectedNumericSeparator: this.errorBuilder(Errors.UnexpectedNumericSeparator)
|
|
24077
24088
|
};
|
|
24078
24089
|
errorHandlers_readCodePoint = {
|
|
24079
24090
|
...this.errorHandlers_readInt,
|
|
24080
|
-
invalidEscapeSequence: this.errorBuilder(Errors
|
|
24081
|
-
invalidCodePoint: this.errorBuilder(Errors
|
|
24091
|
+
invalidEscapeSequence: this.errorBuilder(Errors.InvalidEscapeSequence),
|
|
24092
|
+
invalidCodePoint: this.errorBuilder(Errors.InvalidCodePoint)
|
|
24082
24093
|
};
|
|
24083
24094
|
errorHandlers_readStringContents_string = {
|
|
24084
24095
|
...this.errorHandlers_readCodePoint,
|
|
24085
24096
|
strictNumericEscape: (pos, lineStart, curLine) => {
|
|
24086
|
-
this.recordStrictModeErrors(Errors
|
|
24097
|
+
this.recordStrictModeErrors(Errors.StrictNumericEscape, buildPosition(pos, lineStart, curLine));
|
|
24087
24098
|
},
|
|
24088
24099
|
unterminated: (pos, lineStart, curLine) => {
|
|
24089
|
-
throw this.raise(Errors
|
|
24100
|
+
throw this.raise(Errors.UnterminatedString, buildPosition(pos - 1, lineStart, curLine));
|
|
24090
24101
|
}
|
|
24091
24102
|
};
|
|
24092
24103
|
errorHandlers_readStringContents_template = {
|
|
24093
24104
|
...this.errorHandlers_readCodePoint,
|
|
24094
|
-
strictNumericEscape: this.errorBuilder(Errors
|
|
24105
|
+
strictNumericEscape: this.errorBuilder(Errors.StrictNumericEscape),
|
|
24095
24106
|
unterminated: (pos, lineStart, curLine) => {
|
|
24096
|
-
throw this.raise(Errors
|
|
24107
|
+
throw this.raise(Errors.UnterminatedTemplate, buildPosition(pos, lineStart, curLine));
|
|
24097
24108
|
}
|
|
24098
24109
|
};
|
|
24099
24110
|
};
|
|
@@ -24119,7 +24130,7 @@ var ClassScopeHandler = class {
|
|
|
24119
24130
|
const current = this.current();
|
|
24120
24131
|
for (const [name, loc] of Array.from(oldClassScope.undefinedPrivateNames)) if (current) {
|
|
24121
24132
|
if (!current.undefinedPrivateNames.has(name)) current.undefinedPrivateNames.set(name, loc);
|
|
24122
|
-
} else this.parser.raise(Errors
|
|
24133
|
+
} else this.parser.raise(Errors.InvalidPrivateFieldResolution, loc, { identifierName: name });
|
|
24123
24134
|
}
|
|
24124
24135
|
declarePrivateName(name, elementType, loc) {
|
|
24125
24136
|
const { privateNames, loneAccessors, undefinedPrivateNames } = this.current();
|
|
@@ -24133,7 +24144,7 @@ var ClassScopeHandler = class {
|
|
|
24133
24144
|
if (!redefined) loneAccessors.delete(name);
|
|
24134
24145
|
} else if (!redefined) loneAccessors.set(name, elementType);
|
|
24135
24146
|
}
|
|
24136
|
-
if (redefined) this.parser.raise(Errors
|
|
24147
|
+
if (redefined) this.parser.raise(Errors.PrivateNameRedeclaration, loc, { identifierName: name });
|
|
24137
24148
|
privateNames.add(name);
|
|
24138
24149
|
undefinedPrivateNames.delete(name);
|
|
24139
24150
|
}
|
|
@@ -24141,7 +24152,7 @@ var ClassScopeHandler = class {
|
|
|
24141
24152
|
let classScope;
|
|
24142
24153
|
for (classScope of this.stack) if (classScope.privateNames.has(name)) return;
|
|
24143
24154
|
if (classScope) classScope.undefinedPrivateNames.set(name, loc);
|
|
24144
|
-
else this.parser.raise(Errors
|
|
24155
|
+
else this.parser.raise(Errors.InvalidPrivateFieldResolution, loc, { identifierName: name });
|
|
24145
24156
|
}
|
|
24146
24157
|
};
|
|
24147
24158
|
var ExpressionScope = class {
|
|
@@ -24206,7 +24217,7 @@ var ExpressionScopeHandler = class {
|
|
|
24206
24217
|
let i = stack.length - 1;
|
|
24207
24218
|
let scope = stack[i];
|
|
24208
24219
|
while (scope.canBeArrowParameterDeclaration()) {
|
|
24209
|
-
if (scope.type === 2) scope.recordDeclarationError(Errors
|
|
24220
|
+
if (scope.type === 2) scope.recordDeclarationError(Errors.AwaitBindingIdentifier, at);
|
|
24210
24221
|
scope = stack[--i];
|
|
24211
24222
|
}
|
|
24212
24223
|
}
|
|
@@ -24322,7 +24333,7 @@ var UtilParser = class extends Tokenizer {
|
|
|
24322
24333
|
}
|
|
24323
24334
|
semicolon(allowAsi = true) {
|
|
24324
24335
|
if (allowAsi ? this.isLineTerminator() : this.eat(9)) return;
|
|
24325
|
-
this.raise(Errors
|
|
24336
|
+
this.raise(Errors.MissingSemicolon, this.state.lastTokEndLoc);
|
|
24326
24337
|
}
|
|
24327
24338
|
expect(type, loc) {
|
|
24328
24339
|
if (!this.eat(type)) this.unexpected(loc, type);
|
|
@@ -24378,11 +24389,11 @@ var UtilParser = class extends Tokenizer {
|
|
|
24378
24389
|
const { shorthandAssignLoc, doubleProtoLoc, privateKeyLoc, optionalParametersLoc, voidPatternLoc } = refExpressionErrors;
|
|
24379
24390
|
const hasErrors = !!shorthandAssignLoc || !!doubleProtoLoc || !!optionalParametersLoc || !!privateKeyLoc || !!voidPatternLoc;
|
|
24380
24391
|
if (!andThrow) return hasErrors;
|
|
24381
|
-
if (shorthandAssignLoc != null) this.raise(Errors
|
|
24382
|
-
if (doubleProtoLoc != null) this.raise(Errors
|
|
24383
|
-
if (privateKeyLoc != null) this.raise(Errors
|
|
24392
|
+
if (shorthandAssignLoc != null) this.raise(Errors.InvalidCoverInitializedName, shorthandAssignLoc);
|
|
24393
|
+
if (doubleProtoLoc != null) this.raise(Errors.DuplicateProto, doubleProtoLoc);
|
|
24394
|
+
if (privateKeyLoc != null) this.raise(Errors.UnexpectedPrivateField, privateKeyLoc);
|
|
24384
24395
|
if (optionalParametersLoc != null) this.unexpected(optionalParametersLoc);
|
|
24385
|
-
if (voidPatternLoc != null) this.raise(Errors
|
|
24396
|
+
if (voidPatternLoc != null) this.raise(Errors.InvalidCoverDiscardElement, voidPatternLoc);
|
|
24386
24397
|
}
|
|
24387
24398
|
isLiteralPropertyName() {
|
|
24388
24399
|
return tokenIsLiteralPropertyName(this.state.type);
|
|
@@ -24452,17 +24463,17 @@ var ExpressionErrors = class {
|
|
|
24452
24463
|
optionalParametersLoc = null;
|
|
24453
24464
|
voidPatternLoc = null;
|
|
24454
24465
|
};
|
|
24455
|
-
var Node
|
|
24466
|
+
var Node = class {
|
|
24456
24467
|
constructor(optionFlags, filename, pos, loc) {
|
|
24457
24468
|
this.start = pos;
|
|
24458
24469
|
this.end = 0;
|
|
24459
|
-
if (loc !== void 0) this.loc = new SourceLocation
|
|
24470
|
+
if (loc !== void 0) this.loc = new SourceLocation(loc);
|
|
24460
24471
|
if (optionFlags & 128) this.range = [pos, 0];
|
|
24461
24472
|
if (loc !== void 0 && filename) this.loc.filename = filename;
|
|
24462
24473
|
}
|
|
24463
24474
|
type = "";
|
|
24464
24475
|
};
|
|
24465
|
-
const NodePrototype
|
|
24476
|
+
const NodePrototype = Node.prototype;
|
|
24466
24477
|
var NodeUtils = class extends UtilParser {
|
|
24467
24478
|
createPosition(loc) {
|
|
24468
24479
|
return loc;
|
|
@@ -24474,13 +24485,13 @@ var NodeUtils = class extends UtilParser {
|
|
|
24474
24485
|
}
|
|
24475
24486
|
startNodeAt(loc) {
|
|
24476
24487
|
const { optionFlags, filename } = this;
|
|
24477
|
-
if (!(optionFlags & 256)) return new Node
|
|
24478
|
-
return new Node
|
|
24488
|
+
if (!(optionFlags & 256)) return new Node(optionFlags, filename, loc.index);
|
|
24489
|
+
return new Node(optionFlags, filename, loc.index, this.createPosition(loc));
|
|
24479
24490
|
}
|
|
24480
24491
|
startNodeAtNode(type) {
|
|
24481
24492
|
const { optionFlags, filename } = this;
|
|
24482
|
-
if (!(optionFlags & 256)) return new Node
|
|
24483
|
-
return new Node
|
|
24493
|
+
if (!(optionFlags & 256)) return new Node(optionFlags, filename, type.start);
|
|
24494
|
+
return new Node(optionFlags, filename, type.start, type.loc.start);
|
|
24484
24495
|
}
|
|
24485
24496
|
finishNode(node, type) {
|
|
24486
24497
|
return this.finishNodeAt(node, type, this.state.lastTokEndLoc);
|
|
@@ -24533,7 +24544,7 @@ var NodeUtils = class extends UtilParser {
|
|
|
24533
24544
|
}
|
|
24534
24545
|
cloneIdentifier(node) {
|
|
24535
24546
|
const { type, start, end, loc, range, name } = node;
|
|
24536
|
-
const cloned = Object.create(NodePrototype
|
|
24547
|
+
const cloned = Object.create(NodePrototype);
|
|
24537
24548
|
cloned.type = type;
|
|
24538
24549
|
cloned.start = start;
|
|
24539
24550
|
cloned.end = end;
|
|
@@ -24545,7 +24556,7 @@ var NodeUtils = class extends UtilParser {
|
|
|
24545
24556
|
}
|
|
24546
24557
|
cloneStringLiteral(node) {
|
|
24547
24558
|
const { type, start, end, loc, range, extra } = node;
|
|
24548
|
-
const cloned = Object.create(NodePrototype
|
|
24559
|
+
const cloned = Object.create(NodePrototype);
|
|
24549
24560
|
cloned.type = type;
|
|
24550
24561
|
cloned.start = start;
|
|
24551
24562
|
cloned.end = end;
|
|
@@ -24565,9 +24576,9 @@ var LValParser = class extends NodeUtils {
|
|
|
24565
24576
|
if (node.type === "ParenthesizedExpression" || node.extra?.parenthesized) {
|
|
24566
24577
|
parenthesized = unwrapParenthesizedExpression(node);
|
|
24567
24578
|
if (isLHS) {
|
|
24568
|
-
if (parenthesized.type === "Identifier") this.expressionScope.recordArrowParameterBindingError(Errors
|
|
24569
|
-
else if (parenthesized.type !== "CallExpression" && parenthesized.type !== "MemberExpression" && !this.isOptionalMemberExpression(parenthesized)) this.raise(Errors
|
|
24570
|
-
} else this.raise(Errors
|
|
24579
|
+
if (parenthesized.type === "Identifier") this.expressionScope.recordArrowParameterBindingError(Errors.InvalidParenthesizedAssignment, node);
|
|
24580
|
+
else if (parenthesized.type !== "CallExpression" && parenthesized.type !== "MemberExpression" && !this.isOptionalMemberExpression(parenthesized)) this.raise(Errors.InvalidParenthesizedAssignment, node);
|
|
24581
|
+
} else this.raise(Errors.InvalidParenthesizedAssignment, node);
|
|
24571
24582
|
}
|
|
24572
24583
|
switch (node.type) {
|
|
24573
24584
|
case "Identifier":
|
|
@@ -24582,7 +24593,7 @@ var LValParser = class extends NodeUtils {
|
|
|
24582
24593
|
const prop = node.properties[i];
|
|
24583
24594
|
const isLast = i === last;
|
|
24584
24595
|
this.toAssignableObjectExpressionProp(prop, isLast, isLHS);
|
|
24585
|
-
if (isLast && prop.type === "RestElement" && node.extra?.trailingCommaLoc) this.raise(Errors
|
|
24596
|
+
if (isLast && prop.type === "RestElement" && node.extra?.trailingCommaLoc) this.raise(Errors.RestTrailingComma, node.extra.trailingCommaLoc);
|
|
24586
24597
|
}
|
|
24587
24598
|
break;
|
|
24588
24599
|
case "ObjectProperty": {
|
|
@@ -24597,10 +24608,10 @@ var LValParser = class extends NodeUtils {
|
|
|
24597
24608
|
this.toAssignableList(node.elements, node.extra?.trailingCommaLoc, isLHS);
|
|
24598
24609
|
break;
|
|
24599
24610
|
case "AssignmentExpression":
|
|
24600
|
-
if (node.operator !== "=") this.raise(Errors
|
|
24611
|
+
if (node.operator !== "=") this.raise(Errors.MissingEqInAssignment, this.optionFlags & 256 ? node.left.loc.end : node.left);
|
|
24601
24612
|
this.castNodeTo(node, "AssignmentPattern");
|
|
24602
24613
|
delete node.operator;
|
|
24603
|
-
if (node.left.type === "VoidPattern") this.raise(Errors
|
|
24614
|
+
if (node.left.type === "VoidPattern") this.raise(Errors.VoidPatternInitializer, node.left);
|
|
24604
24615
|
this.toAssignable(node.left, isLHS);
|
|
24605
24616
|
break;
|
|
24606
24617
|
case "ParenthesizedExpression":
|
|
@@ -24609,13 +24620,13 @@ var LValParser = class extends NodeUtils {
|
|
|
24609
24620
|
}
|
|
24610
24621
|
}
|
|
24611
24622
|
toAssignableObjectExpressionProp(prop, isLast, isLHS) {
|
|
24612
|
-
if (prop.type === "ObjectMethod") this.raise(prop.kind === "get" || prop.kind === "set" ? Errors
|
|
24623
|
+
if (prop.type === "ObjectMethod") this.raise(prop.kind === "get" || prop.kind === "set" ? Errors.PatternHasAccessor : Errors.PatternHasMethod, prop.key);
|
|
24613
24624
|
else if (prop.type === "SpreadElement") {
|
|
24614
24625
|
this.castNodeTo(prop, "RestElement");
|
|
24615
24626
|
const arg = prop.argument;
|
|
24616
24627
|
this.checkToRestConversion(arg, false);
|
|
24617
24628
|
this.toAssignable(arg, isLHS);
|
|
24618
|
-
if (!isLast) this.raise(Errors
|
|
24629
|
+
if (!isLast) this.raise(Errors.RestTrailingComma, prop);
|
|
24619
24630
|
} else this.toAssignable(prop, isLHS);
|
|
24620
24631
|
}
|
|
24621
24632
|
toAssignableList(exprList, trailingCommaLoc, isLHS) {
|
|
@@ -24625,8 +24636,8 @@ var LValParser = class extends NodeUtils {
|
|
|
24625
24636
|
if (!elt) continue;
|
|
24626
24637
|
this.toAssignableListItem(exprList, i, isLHS);
|
|
24627
24638
|
if (elt.type === "RestElement") {
|
|
24628
|
-
if (i < end) this.raise(Errors
|
|
24629
|
-
else if (trailingCommaLoc) this.raise(Errors
|
|
24639
|
+
if (i < end) this.raise(Errors.RestTrailingComma, elt);
|
|
24640
|
+
else if (trailingCommaLoc) this.raise(Errors.RestTrailingComma, trailingCommaLoc);
|
|
24630
24641
|
}
|
|
24631
24642
|
}
|
|
24632
24643
|
}
|
|
@@ -24676,7 +24687,7 @@ var LValParser = class extends NodeUtils {
|
|
|
24676
24687
|
const node = this.startNode();
|
|
24677
24688
|
this.next();
|
|
24678
24689
|
const argument = this.parseBindingAtom();
|
|
24679
|
-
if (argument.type === "VoidPattern") this.raise(Errors
|
|
24690
|
+
if (argument.type === "VoidPattern") this.raise(Errors.UnexpectedVoidPattern, argument);
|
|
24680
24691
|
node.argument = argument;
|
|
24681
24692
|
return this.finishNode(node, "RestElement");
|
|
24682
24693
|
}
|
|
@@ -24713,7 +24724,7 @@ var LValParser = class extends NodeUtils {
|
|
|
24713
24724
|
} else {
|
|
24714
24725
|
const decorators = [];
|
|
24715
24726
|
if (flags & 2) {
|
|
24716
|
-
if (this.match(22) && this.hasPlugin("decorators")) this.raise(Errors
|
|
24727
|
+
if (this.match(22) && this.hasPlugin("decorators")) this.raise(Errors.UnsupportedParameterDecorator, this.state.startLoc);
|
|
24717
24728
|
while (this.match(22)) decorators.push(this.parseDecorator());
|
|
24718
24729
|
}
|
|
24719
24730
|
elts.push(this.parseBindingElement(flags, decorators));
|
|
@@ -24725,7 +24736,7 @@ var LValParser = class extends NodeUtils {
|
|
|
24725
24736
|
this.next();
|
|
24726
24737
|
if (this.hasPlugin("discardBinding") && this.match(84)) {
|
|
24727
24738
|
prop.argument = this.parseVoidPattern(null);
|
|
24728
|
-
this.raise(Errors
|
|
24739
|
+
this.raise(Errors.UnexpectedVoidPattern, prop.argument);
|
|
24729
24740
|
} else prop.argument = this.parseIdentifier();
|
|
24730
24741
|
this.checkCommaAfterRest(125);
|
|
24731
24742
|
return this.finishNode(prop, "RestElement");
|
|
@@ -24760,7 +24771,7 @@ var LValParser = class extends NodeUtils {
|
|
|
24760
24771
|
left = left ?? this.parseBindingAtom();
|
|
24761
24772
|
if (!this.eat(25)) return left;
|
|
24762
24773
|
const node = this.startNodeAt(startLoc);
|
|
24763
|
-
if (left.type === "VoidPattern") this.raise(Errors
|
|
24774
|
+
if (left.type === "VoidPattern") this.raise(Errors.VoidPatternInitializer, left);
|
|
24764
24775
|
node.left = left;
|
|
24765
24776
|
node.right = this.parseMaybeAssignAllowIn();
|
|
24766
24777
|
return this.finishNode(node, "AssignmentPattern");
|
|
@@ -24788,24 +24799,24 @@ var LValParser = class extends NodeUtils {
|
|
|
24788
24799
|
if (isOptionalMemberExpression || type === "MemberExpression") {
|
|
24789
24800
|
if (isOptionalMemberExpression) {
|
|
24790
24801
|
this.expectPlugin("optionalChainingAssign", expression.start);
|
|
24791
|
-
if (ancestor.type !== "AssignmentExpression") this.raise(Errors
|
|
24802
|
+
if (ancestor.type !== "AssignmentExpression") this.raise(Errors.InvalidLhsOptionalChaining, expression, { ancestor });
|
|
24792
24803
|
}
|
|
24793
|
-
if (binding !== 64) this.raise(Errors
|
|
24804
|
+
if (binding !== 64) this.raise(Errors.InvalidPropertyBindingPattern, expression);
|
|
24794
24805
|
return;
|
|
24795
24806
|
}
|
|
24796
24807
|
if (type === "Identifier") {
|
|
24797
24808
|
this.checkIdentifier(expression, binding, strictModeChanged);
|
|
24798
24809
|
const { name } = expression;
|
|
24799
|
-
if (checkClashes) if (checkClashes.has(name)) this.raise(Errors
|
|
24810
|
+
if (checkClashes) if (checkClashes.has(name)) this.raise(Errors.ParamDupe, expression);
|
|
24800
24811
|
else checkClashes.add(name);
|
|
24801
24812
|
return;
|
|
24802
|
-
} else if (type === "VoidPattern" && ancestor.type === "CatchClause") this.raise(Errors
|
|
24813
|
+
} else if (type === "VoidPattern" && ancestor.type === "CatchClause") this.raise(Errors.VoidPatternCatchClauseParam, expression);
|
|
24803
24814
|
const unwrappedExpression = unwrapParenthesizedExpression(expression);
|
|
24804
24815
|
disallowCallExpression ||= unwrappedExpression.type === "CallExpression" && (unwrappedExpression.callee.type === "Import" || unwrappedExpression.callee.type === "Super");
|
|
24805
24816
|
const validity = this.isValidLVal(type, disallowCallExpression, !(hasParenthesizedAncestor || expression.extra?.parenthesized) && ancestor.type === "AssignmentExpression", binding);
|
|
24806
24817
|
if (validity === true) return;
|
|
24807
24818
|
if (validity === false) {
|
|
24808
|
-
const ParseErrorClass = binding === 64 ? Errors
|
|
24819
|
+
const ParseErrorClass = binding === 64 ? Errors.InvalidLhs : Errors.InvalidLhsBinding;
|
|
24809
24820
|
this.raise(ParseErrorClass, expression, { ancestor });
|
|
24810
24821
|
return;
|
|
24811
24822
|
}
|
|
@@ -24821,9 +24832,9 @@ var LValParser = class extends NodeUtils {
|
|
|
24821
24832
|
} else if (val) this.checkLVal(val, nextAncestor, binding, checkClashes, strictModeChanged, isParenthesizedExpression, disallowCallExpression);
|
|
24822
24833
|
}
|
|
24823
24834
|
checkIdentifier(at, bindingType, strictModeChanged = false) {
|
|
24824
|
-
if (this.state.strict && (strictModeChanged ? isStrictBindReservedWord(at.name, this.inModule) : isStrictBindOnlyReservedWord(at.name))) if (bindingType === 64) this.raise(Errors
|
|
24825
|
-
else this.raise(Errors
|
|
24826
|
-
if (bindingType & 8192 && at.name === "let") this.raise(Errors
|
|
24835
|
+
if (this.state.strict && (strictModeChanged ? isStrictBindReservedWord(at.name, this.inModule) : isStrictBindOnlyReservedWord(at.name))) if (bindingType === 64) this.raise(Errors.StrictEvalArguments, at, { referenceName: at.name });
|
|
24836
|
+
else this.raise(Errors.StrictEvalArgumentsBinding, at, { bindingName: at.name });
|
|
24837
|
+
if (bindingType & 8192 && at.name === "let") this.raise(Errors.LetInLexicalBinding, at);
|
|
24827
24838
|
if (!(bindingType & 64)) this.declareNameFromIdentifier(at, bindingType);
|
|
24828
24839
|
}
|
|
24829
24840
|
declareNameFromIdentifier(identifier, binding) {
|
|
@@ -24838,12 +24849,12 @@ var LValParser = class extends NodeUtils {
|
|
|
24838
24849
|
case "MemberExpression": break;
|
|
24839
24850
|
case "ArrayExpression":
|
|
24840
24851
|
case "ObjectExpression": if (allowPattern) break;
|
|
24841
|
-
default: this.raise(Errors
|
|
24852
|
+
default: this.raise(Errors.InvalidRestAssignmentPattern, node);
|
|
24842
24853
|
}
|
|
24843
24854
|
}
|
|
24844
24855
|
checkCommaAfterRest(close) {
|
|
24845
24856
|
if (!this.match(8)) return false;
|
|
24846
|
-
this.raise(this.lookaheadCharCode() === close ? Errors
|
|
24857
|
+
this.raise(this.lookaheadCharCode() === close ? Errors.RestTrailingComma : Errors.ElementAfterRest, this.state.startLoc);
|
|
24847
24858
|
return true;
|
|
24848
24859
|
}
|
|
24849
24860
|
};
|
|
@@ -24854,7 +24865,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
24854
24865
|
if ((key.type === "Identifier" ? key.name : key.value) === "__proto__") {
|
|
24855
24866
|
if (sawProto) if (refExpressionErrors) {
|
|
24856
24867
|
if (refExpressionErrors.doubleProtoLoc === null) refExpressionErrors.doubleProtoLoc = this.getLoc(key.start);
|
|
24857
|
-
} else this.raise(Errors
|
|
24868
|
+
} else this.raise(Errors.DuplicateProto, key);
|
|
24858
24869
|
return true;
|
|
24859
24870
|
}
|
|
24860
24871
|
return sawProto;
|
|
@@ -24865,9 +24876,9 @@ var ExpressionParser = class extends LValParser {
|
|
|
24865
24876
|
getExpression() {
|
|
24866
24877
|
this.enterInitialScopes();
|
|
24867
24878
|
this.nextToken();
|
|
24868
|
-
if (this.match(135)) throw this.raise(Errors
|
|
24879
|
+
if (this.match(135)) throw this.raise(Errors.ParseExpressionEmptyInput, this.state.startLoc);
|
|
24869
24880
|
const expr = this.parseExpression();
|
|
24870
|
-
if (!this.match(135)) throw this.raise(Errors
|
|
24881
|
+
if (!this.match(135)) throw this.raise(Errors.ParseExpressionExpectsEOF, this.state.startLoc, { unexpected: this.input.codePointAt(this.state.start) });
|
|
24871
24882
|
this.finalizeRemainingComments();
|
|
24872
24883
|
expr.comments = this.comments;
|
|
24873
24884
|
expr.errors = this.state.errors;
|
|
@@ -24944,7 +24955,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
24944
24955
|
if (isYield) {
|
|
24945
24956
|
const { type } = this.state;
|
|
24946
24957
|
if ((this.hasPlugin("v8intrinsic") ? tokenCanStartExpression(type) : tokenCanStartExpression(type) && !this.match(50)) && !this.isAmbiguousPrefixOrIdentifier()) {
|
|
24947
|
-
this.raiseOverwrite(Errors
|
|
24958
|
+
this.raiseOverwrite(Errors.YieldNotInGeneratorFunction, startLoc);
|
|
24948
24959
|
return this.parseYield(startLoc);
|
|
24949
24960
|
}
|
|
24950
24961
|
}
|
|
@@ -24980,7 +24991,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
24980
24991
|
parseExprOp(left, leftStartLoc, minPrec) {
|
|
24981
24992
|
if (this.isPrivateName(left)) {
|
|
24982
24993
|
const value = this.getPrivateNameSV(left);
|
|
24983
|
-
if (minPrec >= tokenOperatorPrecedence(54) || !this.prodParam.hasIn || !this.match(54)) this.raise(Errors
|
|
24994
|
+
if (minPrec >= tokenOperatorPrecedence(54) || !this.prodParam.hasIn || !this.match(54)) this.raise(Errors.PrivateInExpectedIn, leftStartLoc, { identifierName: value });
|
|
24984
24995
|
this.classScope.usePrivateName(value, leftStartLoc);
|
|
24985
24996
|
}
|
|
24986
24997
|
const op = this.state.type;
|
|
@@ -25001,7 +25012,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
25001
25012
|
node.right = this.parseExprOpRightExpr(op, prec);
|
|
25002
25013
|
const finishedNode = this.finishNode(node, logical || coalesce ? "LogicalExpression" : "BinaryExpression");
|
|
25003
25014
|
const nextOp = this.state.type;
|
|
25004
|
-
if (coalesce && (nextOp === 37 || nextOp === 38) || logical && nextOp === 36) throw this.raise(Errors
|
|
25015
|
+
if (coalesce && (nextOp === 37 || nextOp === 38) || logical && nextOp === 36) throw this.raise(Errors.MixingCoalesceWithLogical, this.state.startLoc);
|
|
25005
25016
|
return this.parseExprOp(finishedNode, leftStartLoc, minPrec);
|
|
25006
25017
|
}
|
|
25007
25018
|
}
|
|
@@ -25025,12 +25036,12 @@ var ExpressionParser = class extends LValParser {
|
|
|
25025
25036
|
parseHackPipeBody() {
|
|
25026
25037
|
const { startLoc } = this.state;
|
|
25027
25038
|
const body = this.parseMaybeAssign();
|
|
25028
|
-
if (UnparenthesizedPipeBodyDescriptions.has(body.type) && !body.extra?.parenthesized) this.raise(Errors
|
|
25029
|
-
if (!this.topicReferenceWasUsedInCurrentContext()) this.raise(Errors
|
|
25039
|
+
if (UnparenthesizedPipeBodyDescriptions.has(body.type) && !body.extra?.parenthesized) this.raise(Errors.PipeUnparenthesizedBody, startLoc, { type: body.type });
|
|
25040
|
+
if (!this.topicReferenceWasUsedInCurrentContext()) this.raise(Errors.PipeTopicUnused, startLoc);
|
|
25030
25041
|
return body;
|
|
25031
25042
|
}
|
|
25032
25043
|
checkExponentialAfterUnary(node) {
|
|
25033
|
-
if (this.match(53)) this.raise(Errors
|
|
25044
|
+
if (this.match(53)) this.raise(Errors.UnexpectedTokenUnaryExponentiation, node.argument);
|
|
25034
25045
|
}
|
|
25035
25046
|
parseMaybeUnary(refExpressionErrors, sawUnary) {
|
|
25036
25047
|
const startLoc = this.state.startLoc;
|
|
@@ -25054,8 +25065,8 @@ var ExpressionParser = class extends LValParser {
|
|
|
25054
25065
|
this.checkExpressionErrors(refExpressionErrors, true);
|
|
25055
25066
|
if (this.state.strict && isDelete) {
|
|
25056
25067
|
const arg = node.argument;
|
|
25057
|
-
if (arg.type === "Identifier") this.raise(Errors
|
|
25058
|
-
else if (this.hasPropertyAsPrivateName(arg)) this.raise(Errors
|
|
25068
|
+
if (arg.type === "Identifier") this.raise(Errors.StrictDelete, node);
|
|
25069
|
+
else if (this.hasPropertyAsPrivateName(arg)) this.raise(Errors.DeletePrivateField, node);
|
|
25059
25070
|
}
|
|
25060
25071
|
if (!update) {
|
|
25061
25072
|
if (!sawUnary) this.checkExponentialAfterUnary(node);
|
|
@@ -25066,7 +25077,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
25066
25077
|
if (isAwait) {
|
|
25067
25078
|
const { type } = this.state;
|
|
25068
25079
|
if ((this.hasPlugin("v8intrinsic") ? tokenCanStartExpression(type) : tokenCanStartExpression(type) && !this.match(50)) && !this.isAmbiguousPrefixOrIdentifier()) {
|
|
25069
|
-
this.raiseOverwrite(Errors
|
|
25080
|
+
this.raiseOverwrite(Errors.AwaitNotInAsyncContext, startLoc);
|
|
25070
25081
|
return this.parseAwait(startLoc);
|
|
25071
25082
|
}
|
|
25072
25083
|
}
|
|
@@ -25117,7 +25128,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
25117
25128
|
let optional = false;
|
|
25118
25129
|
if (type === 14) {
|
|
25119
25130
|
if (noCalls) {
|
|
25120
|
-
this.raise(Errors
|
|
25131
|
+
this.raise(Errors.OptionalChainingNoNew, this.state.startLoc);
|
|
25121
25132
|
if (this.lookaheadCharCode() === 40) return this.stopParseSubscript(base, state);
|
|
25122
25133
|
}
|
|
25123
25134
|
state.optionalChainMember = optional = true;
|
|
@@ -25142,7 +25153,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
25142
25153
|
node.property = this.parseExpression();
|
|
25143
25154
|
this.expect(1);
|
|
25144
25155
|
} else if (this.match(134)) {
|
|
25145
|
-
if (base.type === "Super") this.raise(Errors
|
|
25156
|
+
if (base.type === "Super") this.raise(Errors.SuperPrivateField, startLoc);
|
|
25146
25157
|
this.classScope.usePrivateName(this.state.value, this.state.startLoc);
|
|
25147
25158
|
node.property = this.parsePrivateName();
|
|
25148
25159
|
} else node.property = this.parseIdentifier(true);
|
|
@@ -25157,7 +25168,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
25157
25168
|
this.next();
|
|
25158
25169
|
const isImport = this.match(79);
|
|
25159
25170
|
const callee = this.parseNoCallExpr();
|
|
25160
|
-
if (callee.type === "Super" || isImport && callee.type === "ImportExpression" || callee.type === "Import") throw this.raise(Errors
|
|
25171
|
+
if (callee.type === "Super" || isImport && callee.type === "ImportExpression" || callee.type === "Import") throw this.raise(Errors.UnsupportedBindRHS, callee);
|
|
25161
25172
|
node.callee = callee;
|
|
25162
25173
|
state.stop = true;
|
|
25163
25174
|
return this.parseSubscripts(this.finishNode(node, "BindExpression"), startLoc, false);
|
|
@@ -25195,7 +25206,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
25195
25206
|
const node = this.startNodeAt(startLoc);
|
|
25196
25207
|
node.tag = base;
|
|
25197
25208
|
node.quasi = this.parseTemplate(true);
|
|
25198
|
-
if (state.optionalChainMember) this.raise(Errors
|
|
25209
|
+
if (state.optionalChainMember) this.raise(Errors.OptionalChainingNoTemplate, startLoc);
|
|
25199
25210
|
return this.finishNode(node, "TaggedTemplateExpression");
|
|
25200
25211
|
}
|
|
25201
25212
|
atPossibleAsyncArrow(base) {
|
|
@@ -25203,8 +25214,8 @@ var ExpressionParser = class extends LValParser {
|
|
|
25203
25214
|
}
|
|
25204
25215
|
finishCallExpression(node, optional) {
|
|
25205
25216
|
if (node.callee.type === "Import") {
|
|
25206
|
-
if (node.arguments.length === 0 || node.arguments.length > 2) this.raise(Errors
|
|
25207
|
-
else for (const arg of node.arguments) if (arg.type === "SpreadElement") this.raise(Errors
|
|
25217
|
+
if (node.arguments.length === 0 || node.arguments.length > 2) this.raise(Errors.ImportCallArity, node);
|
|
25218
|
+
else for (const arg of node.arguments) if (arg.type === "SpreadElement") this.raise(Errors.ImportCallSpreadArgument, arg);
|
|
25208
25219
|
}
|
|
25209
25220
|
return this.finishNode(node, optional ? "OptionalCallExpression" : "CallExpression");
|
|
25210
25221
|
}
|
|
@@ -25253,7 +25264,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
25253
25264
|
if (this.match(6)) if (this.optionFlags & 1024) return this.parseImportCall(node);
|
|
25254
25265
|
else return this.finishNode(node, "Import");
|
|
25255
25266
|
else {
|
|
25256
|
-
this.raise(Errors
|
|
25267
|
+
this.raise(Errors.UnsupportedImport, this.state.lastTokStartLoc);
|
|
25257
25268
|
return this.finishNode(node, "Import");
|
|
25258
25269
|
}
|
|
25259
25270
|
case 74:
|
|
@@ -25286,10 +25297,10 @@ var ExpressionParser = class extends LValParser {
|
|
|
25286
25297
|
node.object = null;
|
|
25287
25298
|
const callee = node.callee = this.parseNoCallExpr();
|
|
25288
25299
|
if (callee.type === "MemberExpression") return this.finishNode(node, "BindExpression");
|
|
25289
|
-
else throw this.raise(Errors
|
|
25300
|
+
else throw this.raise(Errors.UnsupportedBind, callee);
|
|
25290
25301
|
}
|
|
25291
25302
|
case 134:
|
|
25292
|
-
this.raise(Errors
|
|
25303
|
+
this.raise(Errors.PrivateInExpectedIn, this.state.startLoc, { identifierName: this.state.value });
|
|
25293
25304
|
return this.parsePrivateName();
|
|
25294
25305
|
case 29: return this.parseTopicReferenceThenEqualsSign(50, "%");
|
|
25295
25306
|
case 28: return this.parseTopicReferenceThenEqualsSign(40, "^");
|
|
@@ -25357,22 +25368,22 @@ var ExpressionParser = class extends LValParser {
|
|
|
25357
25368
|
}
|
|
25358
25369
|
finishTopicReference(node, startLoc, pipeProposal, tokenType) {
|
|
25359
25370
|
if (this.testTopicReferenceConfiguration(pipeProposal, startLoc, tokenType)) {
|
|
25360
|
-
if (!this.topicReferenceIsAllowedInCurrentContext()) this.raise(Errors
|
|
25371
|
+
if (!this.topicReferenceIsAllowedInCurrentContext()) this.raise(Errors.PipeTopicUnbound, startLoc);
|
|
25361
25372
|
this.registerTopicReference();
|
|
25362
25373
|
return this.finishNode(node, "TopicReference");
|
|
25363
|
-
} else throw this.raise(Errors
|
|
25374
|
+
} else throw this.raise(Errors.PipeTopicUnconfiguredToken, startLoc, { token: tokenLabelName(tokenType) });
|
|
25364
25375
|
}
|
|
25365
25376
|
testTopicReferenceConfiguration(pipeProposal, startLoc, tokenType) {
|
|
25366
25377
|
switch (pipeProposal) {
|
|
25367
25378
|
case "hack": return this.hasPlugin(["pipelineOperator", { topicToken: tokenLabelName(tokenType) }]);
|
|
25368
|
-
default: throw this.raise(Errors
|
|
25379
|
+
default: throw this.raise(Errors.PipeTopicRequiresHackPipes, startLoc);
|
|
25369
25380
|
}
|
|
25370
25381
|
}
|
|
25371
25382
|
parseAsyncArrowUnaryFunction(node) {
|
|
25372
25383
|
this.prodParam.enter(functionFlags(true, this.prodParam.hasYield));
|
|
25373
25384
|
const params = [this.parseIdentifier()];
|
|
25374
25385
|
this.prodParam.exit();
|
|
25375
|
-
if (this.hasPrecedingLineBreak()) this.raise(Errors
|
|
25386
|
+
if (this.hasPrecedingLineBreak()) this.raise(Errors.LineTerminatorBeforeArrow, this.state.curPosition());
|
|
25376
25387
|
this.expect(15);
|
|
25377
25388
|
return this.parseArrowExpression(node, params, true);
|
|
25378
25389
|
}
|
|
@@ -25394,9 +25405,9 @@ var ExpressionParser = class extends LValParser {
|
|
|
25394
25405
|
parseSuper() {
|
|
25395
25406
|
const node = this.startNode();
|
|
25396
25407
|
this.next();
|
|
25397
|
-
if (this.match(6) && !this.scope.allowDirectSuper) this.raise(Errors
|
|
25398
|
-
else if (!this.scope.allowSuper) this.raise(Errors
|
|
25399
|
-
if (!this.match(6) && !this.match(0) && !this.match(12)) this.raise(Errors
|
|
25408
|
+
if (this.match(6) && !this.scope.allowDirectSuper) this.raise(Errors.SuperNotAllowed, node);
|
|
25409
|
+
else if (!this.scope.allowSuper) this.raise(Errors.UnexpectedSuper, node);
|
|
25410
|
+
if (!this.match(6) && !this.match(0) && !this.match(12)) this.raise(Errors.UnsupportedSuper, node);
|
|
25400
25411
|
return this.finishNode(node, "Super");
|
|
25401
25412
|
}
|
|
25402
25413
|
parsePrivateName() {
|
|
@@ -25423,7 +25434,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
25423
25434
|
node.meta = meta;
|
|
25424
25435
|
const containsEsc = this.state.containsEsc;
|
|
25425
25436
|
node.property = this.parseIdentifier(true);
|
|
25426
|
-
if (node.property.name !== propertyName || containsEsc) this.raise(Errors
|
|
25437
|
+
if (node.property.name !== propertyName || containsEsc) this.raise(Errors.UnsupportedMetaProperty, node.property, {
|
|
25427
25438
|
target: meta.name,
|
|
25428
25439
|
onlyValidPropertyName: propertyName
|
|
25429
25440
|
});
|
|
@@ -25440,7 +25451,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
25440
25451
|
} else {
|
|
25441
25452
|
const id = this.createIdentifierAt(this.startNodeAtNode(node), "import", this.state.lastTokStartLoc);
|
|
25442
25453
|
if (this.isContextual(97)) {
|
|
25443
|
-
if (!this.inModule) this.raise(Errors
|
|
25454
|
+
if (!this.inModule) this.raise(Errors.ImportMetaOutsideModule, id);
|
|
25444
25455
|
this.sawUnambiguousESM = true;
|
|
25445
25456
|
}
|
|
25446
25457
|
return this.parseMetaProperty(node, id, "meta");
|
|
@@ -25569,7 +25580,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
25569
25580
|
const meta = this.createIdentifier(this.startNodeAtNode(node), "new");
|
|
25570
25581
|
this.next();
|
|
25571
25582
|
const metaProp = this.parseMetaProperty(node, meta, "target");
|
|
25572
|
-
if (!this.scope.allowNewTarget) this.raise(Errors
|
|
25583
|
+
if (!this.scope.allowNewTarget) this.raise(Errors.UnexpectedNewTarget, metaProp);
|
|
25573
25584
|
return metaProp;
|
|
25574
25585
|
}
|
|
25575
25586
|
return this.parseNew(node);
|
|
@@ -25587,16 +25598,16 @@ var ExpressionParser = class extends LValParser {
|
|
|
25587
25598
|
const isImport = this.match(79);
|
|
25588
25599
|
const callee = this.parseNoCallExpr();
|
|
25589
25600
|
node.callee = callee;
|
|
25590
|
-
if (isImport && callee.type === "ImportExpression") this.raise(Errors
|
|
25591
|
-
if (callee.type === "Import") this.raise(Errors
|
|
25592
|
-
if (callee.type === "Super") this.raise(Errors
|
|
25601
|
+
if (isImport && callee.type === "ImportExpression") this.raise(Errors.ImportCallNotNewExpression, callee, callee);
|
|
25602
|
+
if (callee.type === "Import") this.raise(Errors.ImportCallNotNewExpression, callee);
|
|
25603
|
+
if (callee.type === "Super") this.raise(Errors.SuperCallNotNewExpression, callee);
|
|
25593
25604
|
}
|
|
25594
25605
|
parseTemplateElement(isTagged) {
|
|
25595
25606
|
const { start, startLoc, end, value } = this.state;
|
|
25596
25607
|
const elemStart = start + 1;
|
|
25597
25608
|
const elem = this.startNodeAt(createPositionWithColumnOffset(startLoc, 1));
|
|
25598
25609
|
if (value === null) {
|
|
25599
|
-
if (!isTagged) this.raise(Errors
|
|
25610
|
+
if (!isTagged) this.raise(Errors.InvalidEscapeSequenceTemplate, createPositionWithColumnOffset(this.state.firstInvalidTemplateEscapePos, 1));
|
|
25600
25611
|
}
|
|
25601
25612
|
const isTail = this.match(20);
|
|
25602
25613
|
const endOffset = isTail ? -1 : -2;
|
|
@@ -25665,7 +25676,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
25665
25676
|
parsePropertyDefinition(refExpressionErrors) {
|
|
25666
25677
|
const decorators = [];
|
|
25667
25678
|
if (this.match(22)) {
|
|
25668
|
-
if (this.hasPlugin("decorators")) this.raise(Errors
|
|
25679
|
+
if (this.hasPlugin("decorators")) this.raise(Errors.UnsupportedPropertyDecorator, this.state.startLoc);
|
|
25669
25680
|
while (this.match(22)) decorators.push(this.parseDecorator());
|
|
25670
25681
|
}
|
|
25671
25682
|
const prop = this.startNode();
|
|
@@ -25698,7 +25709,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
25698
25709
|
prop.kind = keyName;
|
|
25699
25710
|
if (this.match(51)) {
|
|
25700
25711
|
isGenerator = true;
|
|
25701
|
-
this.raise(Errors
|
|
25712
|
+
this.raise(Errors.AccessorIsGenerator, this.state.curPosition(), { kind: keyName });
|
|
25702
25713
|
this.next();
|
|
25703
25714
|
}
|
|
25704
25715
|
this.parsePropertyName(prop);
|
|
@@ -25715,8 +25726,8 @@ var ExpressionParser = class extends LValParser {
|
|
|
25715
25726
|
checkGetterSetterParams(method) {
|
|
25716
25727
|
const paramCount = this.getGetterSetterExpectedParamCount(method);
|
|
25717
25728
|
const params = this.getObjectOrClassMethodParams(method);
|
|
25718
|
-
if (params.length !== paramCount) this.raise(method.kind === "get" ? Errors
|
|
25719
|
-
if (method.kind === "set" && params[params.length - 1]?.type === "RestElement") this.raise(Errors
|
|
25729
|
+
if (params.length !== paramCount) this.raise(method.kind === "get" ? Errors.BadGetterArity : Errors.BadSetterArity, method);
|
|
25730
|
+
if (method.kind === "set" && params[params.length - 1]?.type === "RestElement") this.raise(Errors.BadSetterRestParameter, method);
|
|
25720
25731
|
}
|
|
25721
25732
|
parseObjectMethod(prop, isGenerator, isAsync, isPattern, isAccessor) {
|
|
25722
25733
|
if (isAccessor) {
|
|
@@ -25744,7 +25755,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
25744
25755
|
const shorthandAssignLoc = this.state.startLoc;
|
|
25745
25756
|
if (refExpressionErrors != null) {
|
|
25746
25757
|
if (refExpressionErrors.shorthandAssignLoc === null) refExpressionErrors.shorthandAssignLoc = shorthandAssignLoc;
|
|
25747
|
-
} else this.raise(Errors
|
|
25758
|
+
} else this.raise(Errors.InvalidCoverInitializedName, shorthandAssignLoc);
|
|
25748
25759
|
prop.value = this.parseMaybeDefault(startLoc, this.cloneIdentifier(prop.key));
|
|
25749
25760
|
} else prop.value = this.cloneIdentifier(prop.key);
|
|
25750
25761
|
prop.shorthand = true;
|
|
@@ -25782,7 +25793,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
25782
25793
|
const privateKeyLoc = this.state.startLoc;
|
|
25783
25794
|
if (refExpressionErrors != null) {
|
|
25784
25795
|
if (refExpressionErrors.privateKeyLoc === null) refExpressionErrors.privateKeyLoc = privateKeyLoc;
|
|
25785
|
-
} else this.raise(Errors
|
|
25796
|
+
} else this.raise(Errors.UnexpectedPrivateField, privateKeyLoc);
|
|
25786
25797
|
key = this.parsePrivateName();
|
|
25787
25798
|
break;
|
|
25788
25799
|
}
|
|
@@ -25847,7 +25858,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
25847
25858
|
this.prodParam.enter(this.prodParam.currentFlags() | 4);
|
|
25848
25859
|
node.body = this.parseBlock(true, false, (hasStrictModeDirective) => {
|
|
25849
25860
|
const nonSimple = !this.isSimpleParamList(node.params);
|
|
25850
|
-
if (hasStrictModeDirective && nonSimple) this.raise(Errors
|
|
25861
|
+
if (hasStrictModeDirective && nonSimple) this.raise(Errors.IllegalLanguageModeDirective, (node.kind === "method" || node.kind === "constructor") && !!node.key ? this.optionFlags & 256 ? node.key.loc.end : node.key : node);
|
|
25851
25862
|
const strictModeChanged = !oldStrict && this.state.strict;
|
|
25852
25863
|
this.checkParams(node, !this.state.strict && !allowExpression && !isMethod && !nonSimple, allowExpression, strictModeChanged);
|
|
25853
25864
|
if (this.state.strict && node.id) this.checkIdentifier(node.id, 65, strictModeChanged);
|
|
@@ -25889,14 +25900,14 @@ var ExpressionParser = class extends LValParser {
|
|
|
25889
25900
|
parseExprListItem(close, allowEmpty, refExpressionErrors, allowPlaceholder) {
|
|
25890
25901
|
let elt;
|
|
25891
25902
|
if (this.match(8)) {
|
|
25892
|
-
if (!allowEmpty) this.raise(Errors
|
|
25903
|
+
if (!allowEmpty) this.raise(Errors.UnexpectedToken, this.state.curPosition(), { unexpected: "," });
|
|
25893
25904
|
elt = null;
|
|
25894
25905
|
} else if (this.match(17)) {
|
|
25895
25906
|
const spreadNodeStartLoc = this.state.startLoc;
|
|
25896
25907
|
elt = this.parseParenItem(this.parseSpread(refExpressionErrors), spreadNodeStartLoc);
|
|
25897
25908
|
} else if (this.match(13)) {
|
|
25898
25909
|
this.expectPlugin("partialApplication");
|
|
25899
|
-
if (!allowPlaceholder) this.raise(Errors
|
|
25910
|
+
if (!allowPlaceholder) this.raise(Errors.UnexpectedArgumentPlaceholder, this.state.startLoc);
|
|
25900
25911
|
const node = this.startNode();
|
|
25901
25912
|
this.next();
|
|
25902
25913
|
elt = this.finishNode(node, "ArgumentPlaceholder");
|
|
@@ -25934,30 +25945,30 @@ var ExpressionParser = class extends LValParser {
|
|
|
25934
25945
|
if (word.length > 10) return;
|
|
25935
25946
|
if (!canBeReservedWord(word)) return;
|
|
25936
25947
|
if (checkKeywords && isKeyword(word)) {
|
|
25937
|
-
this.raise(Errors
|
|
25948
|
+
this.raise(Errors.UnexpectedKeyword, startLoc, { keyword: word });
|
|
25938
25949
|
return;
|
|
25939
25950
|
}
|
|
25940
25951
|
if ((!this.state.strict ? isReservedWord : isBinding ? isStrictBindReservedWord : isStrictReservedWord)(word, this.inModule)) {
|
|
25941
|
-
this.raise(Errors
|
|
25952
|
+
this.raise(Errors.UnexpectedReservedWord, startLoc, { reservedWord: word });
|
|
25942
25953
|
return;
|
|
25943
25954
|
} else if (word === "yield") {
|
|
25944
25955
|
if (this.prodParam.hasYield) {
|
|
25945
|
-
this.raise(Errors
|
|
25956
|
+
this.raise(Errors.YieldBindingIdentifier, startLoc);
|
|
25946
25957
|
return;
|
|
25947
25958
|
}
|
|
25948
25959
|
} else if (word === "await") {
|
|
25949
25960
|
if (this.prodParam.hasAwait) {
|
|
25950
|
-
this.raise(Errors
|
|
25961
|
+
this.raise(Errors.AwaitBindingIdentifier, startLoc);
|
|
25951
25962
|
return;
|
|
25952
25963
|
}
|
|
25953
25964
|
if (this.scope.inStaticBlock) {
|
|
25954
|
-
this.raise(Errors
|
|
25965
|
+
this.raise(Errors.AwaitBindingIdentifierInStaticBlock, startLoc);
|
|
25955
25966
|
return;
|
|
25956
25967
|
}
|
|
25957
25968
|
this.expressionScope.recordAsyncArrowParametersError(startLoc);
|
|
25958
25969
|
} else if (word === "arguments") {
|
|
25959
25970
|
if (this.scope.inClassAndNotInNonArrowFunction) {
|
|
25960
|
-
this.raise(Errors
|
|
25971
|
+
this.raise(Errors.ArgumentsInClass, startLoc);
|
|
25961
25972
|
return;
|
|
25962
25973
|
}
|
|
25963
25974
|
}
|
|
@@ -25971,8 +25982,8 @@ var ExpressionParser = class extends LValParser {
|
|
|
25971
25982
|
const startIndex = startLoc.index;
|
|
25972
25983
|
this.setLoc(startLoc);
|
|
25973
25984
|
const node = this.startNodeAt(startLoc);
|
|
25974
|
-
this.expressionScope.recordParameterInitializerError(Errors
|
|
25975
|
-
if (this.eat(51)) this.raise(Errors
|
|
25985
|
+
this.expressionScope.recordParameterInitializerError(Errors.AwaitExpressionFormalParameter, startIndex);
|
|
25986
|
+
if (this.eat(51)) this.raise(Errors.ObsoleteAwaitStar, startLoc);
|
|
25976
25987
|
if (!this.scope.inFunction && !(this.optionFlags & 1)) if (this.isAmbiguousPrefixOrIdentifier()) this.ambiguousScriptDifferentAst = true;
|
|
25977
25988
|
else this.sawUnambiguousESM = true;
|
|
25978
25989
|
if (!soloAwait) node.argument = this.parseMaybeUnary(null, true);
|
|
@@ -25986,7 +25997,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
25986
25997
|
parseYield(startLoc) {
|
|
25987
25998
|
this.setLoc(startLoc);
|
|
25988
25999
|
const node = this.startNodeAt(startLoc);
|
|
25989
|
-
this.expressionScope.recordParameterInitializerError(Errors
|
|
26000
|
+
this.expressionScope.recordParameterInitializerError(Errors.YieldInParameter, startLoc.index);
|
|
25990
26001
|
let delegating = false;
|
|
25991
26002
|
let argument = null;
|
|
25992
26003
|
if (!this.hasPrecedingLineBreak()) {
|
|
@@ -26010,8 +26021,8 @@ var ExpressionParser = class extends LValParser {
|
|
|
26010
26021
|
parseImportCall(node) {
|
|
26011
26022
|
this.next();
|
|
26012
26023
|
const args = this.parseCallExpressionArguments();
|
|
26013
|
-
if (args.length === 0 || args.length > 2) this.raise(Errors
|
|
26014
|
-
else for (const arg of args) if (arg.type === "SpreadElement") this.raise(Errors
|
|
26024
|
+
if (args.length === 0 || args.length > 2) this.raise(Errors.ImportCallArity, node, node);
|
|
26025
|
+
else for (const arg of args) if (arg.type === "SpreadElement") this.raise(Errors.ImportCallSpreadArgument, arg, node);
|
|
26015
26026
|
node.source = args[0];
|
|
26016
26027
|
node.options = args[1] ?? null;
|
|
26017
26028
|
return this.finishNode(node, "ImportExpression");
|
|
@@ -26071,7 +26082,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
26071
26082
|
this.next();
|
|
26072
26083
|
ret = this.parseAwait(startLoc, true);
|
|
26073
26084
|
const nextOp = this.state.type;
|
|
26074
|
-
if (tokenIsOperator(nextOp) && nextOp !== 35 && (this.prodParam.hasIn || nextOp !== 54)) this.raise(Errors
|
|
26085
|
+
if (tokenIsOperator(nextOp) && nextOp !== 35 && (this.prodParam.hasIn || nextOp !== 54)) this.raise(Errors.PipelineUnparenthesized, startLoc);
|
|
26075
26086
|
} else {
|
|
26076
26087
|
this.state.canStartArrow = true;
|
|
26077
26088
|
ret = this.parseExprOp(this.parseMaybeUnaryOrPrivate(), startLoc, prec);
|
|
@@ -26118,7 +26129,7 @@ function createExportedTokens(tokens) {
|
|
|
26118
26129
|
for (let i = 0; i < tokens.length; i++) {
|
|
26119
26130
|
const token = tokens[i];
|
|
26120
26131
|
const { type } = token;
|
|
26121
|
-
if (typeof type === "number") token.type = getExportedToken
|
|
26132
|
+
if (typeof type === "number") token.type = getExportedToken(type);
|
|
26122
26133
|
}
|
|
26123
26134
|
return tokens;
|
|
26124
26135
|
}
|
|
@@ -26134,7 +26145,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
26134
26145
|
program.interpreter = this.parseInterpreterDirective();
|
|
26135
26146
|
this.parseBlockBody(program, true, true, end);
|
|
26136
26147
|
if (this.inModule) {
|
|
26137
|
-
if (!(this.optionFlags & 64) && this.scope.undefinedExports.size > 0) for (const [localName, at] of Array.from(this.scope.undefinedExports)) this.raise(Errors
|
|
26148
|
+
if (!(this.optionFlags & 64) && this.scope.undefinedExports.size > 0) for (const [localName, at] of Array.from(this.scope.undefinedExports)) this.raise(Errors.ModuleExportUndefined, at, { localName });
|
|
26138
26149
|
this.addExtra(program, "topLevelAwait", this.state.hasTopLevelAwait);
|
|
26139
26150
|
}
|
|
26140
26151
|
let finishedProgram;
|
|
@@ -26259,7 +26270,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
26259
26270
|
case 87: return this.parseForStatement(node);
|
|
26260
26271
|
case 64:
|
|
26261
26272
|
if (this.lookaheadCharCode() === 46) break;
|
|
26262
|
-
if (!allowFunctionDeclaration) this.raise(this.state.strict ? Errors
|
|
26273
|
+
if (!allowFunctionDeclaration) this.raise(this.state.strict ? Errors.StrictFunction : this.options.annexB ? Errors.SloppyFunctionAnnexB : Errors.SloppyFunction, this.state.startLoc);
|
|
26263
26274
|
return this.parseFunctionStatement(node, false, !allowDeclaration && allowFunctionDeclaration);
|
|
26264
26275
|
case 76:
|
|
26265
26276
|
if (!allowDeclaration) this.unexpected();
|
|
@@ -26271,17 +26282,17 @@ var StatementParser = class extends ExpressionParser {
|
|
|
26271
26282
|
case 69: return this.parseTryStatement(node);
|
|
26272
26283
|
case 92:
|
|
26273
26284
|
if (this.isAwaitUsing()) {
|
|
26274
|
-
if (!this.allowsUsing()) this.raise(Errors
|
|
26275
|
-
else if (!allowDeclaration) this.raise(Errors
|
|
26276
|
-
else if (!this.recordAwaitIfAllowed()) this.raise(Errors
|
|
26285
|
+
if (!this.allowsUsing()) this.raise(Errors.UnexpectedUsingDeclaration, node);
|
|
26286
|
+
else if (!allowDeclaration) this.raise(Errors.UnexpectedLexicalDeclaration, node);
|
|
26287
|
+
else if (!this.recordAwaitIfAllowed()) this.raise(Errors.AwaitUsingNotInAsyncContext, node);
|
|
26277
26288
|
this.next();
|
|
26278
26289
|
return this.parseVarStatement(node, "await using");
|
|
26279
26290
|
}
|
|
26280
26291
|
break;
|
|
26281
26292
|
case 103:
|
|
26282
26293
|
if (this.state.containsEsc || !this.hasInLineFollowingBindingIdentifierOrBrace()) break;
|
|
26283
|
-
if (!this.allowsUsing()) this.raise(Errors
|
|
26284
|
-
else if (!allowDeclaration) this.raise(Errors
|
|
26294
|
+
if (!this.allowsUsing()) this.raise(Errors.UnexpectedUsingDeclaration, this.state.startLoc);
|
|
26295
|
+
else if (!allowDeclaration) this.raise(Errors.UnexpectedLexicalDeclaration, this.state.startLoc);
|
|
26285
26296
|
return this.parseVarStatement(node, "using");
|
|
26286
26297
|
case 96: {
|
|
26287
26298
|
if (this.state.containsEsc) break;
|
|
@@ -26292,7 +26303,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
26292
26303
|
if (!this.chStartsBindingIdentifier(nextCh, next) && nextCh !== 123) break;
|
|
26293
26304
|
}
|
|
26294
26305
|
}
|
|
26295
|
-
case 71: if (!allowDeclaration) this.raise(Errors
|
|
26306
|
+
case 71: if (!allowDeclaration) this.raise(Errors.UnexpectedLexicalDeclaration, this.state.startLoc);
|
|
26296
26307
|
case 70: {
|
|
26297
26308
|
const kind = this.state.value;
|
|
26298
26309
|
return this.parseVarStatement(node, kind);
|
|
@@ -26306,7 +26317,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
26306
26317
|
if (nextTokenCharCode === 40 || nextTokenCharCode === 46) break;
|
|
26307
26318
|
}
|
|
26308
26319
|
case 78: {
|
|
26309
|
-
if (!(this.optionFlags & 8) && !topLevel) this.raise(Errors
|
|
26320
|
+
if (!(this.optionFlags & 8) && !topLevel) this.raise(Errors.UnexpectedImportExport, this.state.startLoc);
|
|
26310
26321
|
this.next();
|
|
26311
26322
|
let result;
|
|
26312
26323
|
if (startType === 79) result = this.parseImport(node);
|
|
@@ -26315,7 +26326,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
26315
26326
|
return result;
|
|
26316
26327
|
}
|
|
26317
26328
|
default: if (this.isAsyncFunction()) {
|
|
26318
|
-
if (!allowDeclaration) this.raise(Errors
|
|
26329
|
+
if (!allowDeclaration) this.raise(Errors.AsyncFunctionInSingleStatementContext, this.state.startLoc);
|
|
26319
26330
|
this.next();
|
|
26320
26331
|
return this.parseFunctionStatement(node, true, !allowDeclaration && allowFunctionDeclaration);
|
|
26321
26332
|
}
|
|
@@ -26326,12 +26337,12 @@ var StatementParser = class extends ExpressionParser {
|
|
|
26326
26337
|
else return this.parseExpressionStatement(node, expr, decorators);
|
|
26327
26338
|
}
|
|
26328
26339
|
assertModuleNodeAllowed(node) {
|
|
26329
|
-
if (!(this.optionFlags & 8) && !this.inModule) this.raise(Errors
|
|
26340
|
+
if (!(this.optionFlags & 8) && !this.inModule) this.raise(Errors.ImportOutsideModule, node);
|
|
26330
26341
|
}
|
|
26331
26342
|
maybeTakeDecorators(maybeDecorators, classNode, exportNode) {
|
|
26332
26343
|
if (maybeDecorators) {
|
|
26333
26344
|
if (classNode.decorators?.length) {
|
|
26334
|
-
this.raise(Errors
|
|
26345
|
+
this.raise(Errors.DecoratorsBeforeAfterExport, classNode.decorators[0]);
|
|
26335
26346
|
classNode.decorators.unshift(...maybeDecorators);
|
|
26336
26347
|
} else classNode.decorators = maybeDecorators;
|
|
26337
26348
|
this.resetStartLocationFromNode(classNode, maybeDecorators[0]);
|
|
@@ -26349,7 +26360,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
26349
26360
|
while (this.match(22));
|
|
26350
26361
|
if (this.match(78)) {
|
|
26351
26362
|
if (!allowExport) this.unexpected();
|
|
26352
|
-
} else if (!this.canHaveLeadingDecorator()) throw this.raise(Errors
|
|
26363
|
+
} else if (!this.canHaveLeadingDecorator()) throw this.raise(Errors.UnexpectedLeadingDecorator, this.state.startLoc);
|
|
26353
26364
|
return decorators;
|
|
26354
26365
|
}
|
|
26355
26366
|
parseDecorator() {
|
|
@@ -26367,7 +26378,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
26367
26378
|
expr = this.wrapParenthesis(startLoc, expr);
|
|
26368
26379
|
const paramsStartLoc = this.state.startLoc;
|
|
26369
26380
|
node.expression = this.parseMaybeDecoratorArguments(expr, startLoc);
|
|
26370
|
-
if (node.expression !== expr) this.raise(Errors
|
|
26381
|
+
if (node.expression !== expr) this.raise(Errors.DecoratorArgumentsOutsideParentheses, paramsStartLoc);
|
|
26371
26382
|
} else {
|
|
26372
26383
|
expr = this.parseIdentifier(false);
|
|
26373
26384
|
while (this.eat(12)) {
|
|
@@ -26419,7 +26430,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
26419
26430
|
}
|
|
26420
26431
|
if (i === this.state.labels.length) {
|
|
26421
26432
|
const type = isBreak ? "BreakStatement" : "ContinueStatement";
|
|
26422
|
-
this.raise(Errors
|
|
26433
|
+
this.raise(Errors.IllegalBreakContinue, node, { type });
|
|
26423
26434
|
}
|
|
26424
26435
|
}
|
|
26425
26436
|
parseDebuggerStatement(node) {
|
|
@@ -26467,14 +26478,14 @@ var StatementParser = class extends ExpressionParser {
|
|
|
26467
26478
|
let kind;
|
|
26468
26479
|
if (startsWithAwaitUsing) {
|
|
26469
26480
|
kind = "await using";
|
|
26470
|
-
if (!this.recordAwaitIfAllowed()) this.raise(Errors
|
|
26481
|
+
if (!this.recordAwaitIfAllowed()) this.raise(Errors.AwaitUsingNotInAsyncContext, this.state.startLoc);
|
|
26471
26482
|
this.next();
|
|
26472
26483
|
} else kind = this.state.value;
|
|
26473
26484
|
this.next();
|
|
26474
26485
|
this.parseVar(initNode, true, kind);
|
|
26475
26486
|
const init = this.finishNode(initNode, "VariableDeclaration");
|
|
26476
26487
|
const isForIn = this.match(54);
|
|
26477
|
-
if (isForIn && starsWithUsingDeclaration) this.raise(Errors
|
|
26488
|
+
if (isForIn && starsWithUsingDeclaration) this.raise(Errors.ForInUsing, init);
|
|
26478
26489
|
if ((isForIn || this.isContextual(98)) && init.declarations.length === 1) return this.parseForIn(node, init, awaitAt);
|
|
26479
26490
|
if (awaitAt !== null) this.unexpected(awaitAt);
|
|
26480
26491
|
return this.parseFor(node, init);
|
|
@@ -26485,8 +26496,8 @@ var StatementParser = class extends ExpressionParser {
|
|
|
26485
26496
|
const init = this.parseExpression(true, refExpressionErrors);
|
|
26486
26497
|
const isForOf = this.isContextual(98);
|
|
26487
26498
|
if (isForOf) {
|
|
26488
|
-
if (startsWithLet) this.raise(Errors
|
|
26489
|
-
if (awaitAt === null && startsWithAsync && init.type === "Identifier") this.raise(Errors
|
|
26499
|
+
if (startsWithLet) this.raise(Errors.ForOfLet, init);
|
|
26500
|
+
if (awaitAt === null && startsWithAsync && init.type === "Identifier") this.raise(Errors.ForOfAsync, init);
|
|
26490
26501
|
}
|
|
26491
26502
|
if (isForOf || this.match(54)) {
|
|
26492
26503
|
this.checkDestructuringPrivate(refExpressionErrors);
|
|
@@ -26510,7 +26521,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
26510
26521
|
return this.finishNode(node, "IfStatement");
|
|
26511
26522
|
}
|
|
26512
26523
|
parseReturnStatement(node) {
|
|
26513
|
-
if (!this.prodParam.hasReturn) this.raise(Errors
|
|
26524
|
+
if (!this.prodParam.hasReturn) this.raise(Errors.IllegalReturn, this.state.startLoc);
|
|
26514
26525
|
this.next();
|
|
26515
26526
|
if (this.isLineTerminator()) node.argument = null;
|
|
26516
26527
|
else {
|
|
@@ -26535,7 +26546,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
26535
26546
|
this.next();
|
|
26536
26547
|
if (isCase) cur.test = this.parseExpression();
|
|
26537
26548
|
else {
|
|
26538
|
-
if (sawDefault) this.raise(Errors
|
|
26549
|
+
if (sawDefault) this.raise(Errors.MultipleDefaultsInSwitch, this.state.lastTokStartLoc);
|
|
26539
26550
|
sawDefault = true;
|
|
26540
26551
|
cur.test = null;
|
|
26541
26552
|
}
|
|
@@ -26550,7 +26561,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
26550
26561
|
}
|
|
26551
26562
|
parseThrowStatement(node) {
|
|
26552
26563
|
this.next();
|
|
26553
|
-
if (this.hasPrecedingLineBreak()) this.raise(Errors
|
|
26564
|
+
if (this.hasPrecedingLineBreak()) this.raise(Errors.NewlineAfterThrow, this.state.lastTokEndLoc);
|
|
26554
26565
|
node.argument = this.parseExpression();
|
|
26555
26566
|
this.semicolon();
|
|
26556
26567
|
return this.finishNode(node, "ThrowStatement");
|
|
@@ -26581,7 +26592,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
26581
26592
|
node.handler = this.finishNode(clause, "CatchClause");
|
|
26582
26593
|
}
|
|
26583
26594
|
node.finalizer = this.eat(63) ? this.parseBlock() : null;
|
|
26584
|
-
if (!node.handler && !node.finalizer) this.raise(Errors
|
|
26595
|
+
if (!node.handler && !node.finalizer) this.raise(Errors.NoCatchOrFinally, node);
|
|
26585
26596
|
return this.finishNode(node, "TryStatement");
|
|
26586
26597
|
}
|
|
26587
26598
|
parseVarStatement(node, kind, allowMissingInitializer = false) {
|
|
@@ -26599,7 +26610,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
26599
26610
|
return this.finishNode(node, "WhileStatement");
|
|
26600
26611
|
}
|
|
26601
26612
|
parseWithStatement(node) {
|
|
26602
|
-
if (this.state.strict) this.raise(Errors
|
|
26613
|
+
if (this.state.strict) this.raise(Errors.StrictWith, this.state.startLoc);
|
|
26603
26614
|
this.next();
|
|
26604
26615
|
node.object = this.parseHeaderExpression();
|
|
26605
26616
|
node.body = this.parseStatement();
|
|
@@ -26610,7 +26621,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
26610
26621
|
return this.finishNode(node, "EmptyStatement");
|
|
26611
26622
|
}
|
|
26612
26623
|
parseLabeledStatement(node, maybeName, expr, flags) {
|
|
26613
|
-
for (const label of this.state.labels) if (label.name === maybeName) this.raise(Errors
|
|
26624
|
+
for (const label of this.state.labels) if (label.name === maybeName) this.raise(Errors.LabelRedeclaration, expr, { labelName: maybeName });
|
|
26614
26625
|
const kind = tokenIsLoop(this.state.type) ? 1 : this.match(67) ? 2 : null;
|
|
26615
26626
|
for (let i = this.state.labels.length - 1; i >= 0; i--) {
|
|
26616
26627
|
const label = this.state.labels[i];
|
|
@@ -26694,8 +26705,8 @@ var StatementParser = class extends ExpressionParser {
|
|
|
26694
26705
|
if (isForIn) {
|
|
26695
26706
|
if (awaitAt !== null) this.unexpected(awaitAt);
|
|
26696
26707
|
} else node.await = awaitAt !== null;
|
|
26697
|
-
if (init.type === "VariableDeclaration" && init.declarations[0].init != null && (!isForIn || !this.options.annexB || this.state.strict || init.kind !== "var" || init.declarations[0].id.type !== "Identifier")) this.raise(Errors
|
|
26698
|
-
if (init.type === "AssignmentPattern") this.raise(Errors
|
|
26708
|
+
if (init.type === "VariableDeclaration" && init.declarations[0].init != null && (!isForIn || !this.options.annexB || this.state.strict || init.kind !== "var" || init.declarations[0].id.type !== "Identifier")) this.raise(Errors.ForInOfLoopInitializer, init, { type: isForIn ? "ForInStatement" : "ForOfStatement" });
|
|
26709
|
+
if (init.type === "AssignmentPattern") this.raise(Errors.InvalidLhs, init, { ancestor: { type: "ForStatement" } });
|
|
26699
26710
|
node.left = init;
|
|
26700
26711
|
node.right = isForIn ? this.parseExpression() : this.parseMaybeAssignAllowIn();
|
|
26701
26712
|
this.expect(7);
|
|
@@ -26712,8 +26723,8 @@ var StatementParser = class extends ExpressionParser {
|
|
|
26712
26723
|
this.parseVarId(decl, kind);
|
|
26713
26724
|
decl.init = !this.eat(25) ? null : isFor ? this.parseMaybeAssignDisallowIn() : this.parseMaybeAssignAllowIn();
|
|
26714
26725
|
if (decl.init === null && !allowMissingInitializer) {
|
|
26715
|
-
if (decl.id.type !== "Identifier" && !(isFor && (this.match(54) || this.isContextual(98)))) this.raise(Errors
|
|
26716
|
-
else if ((kind === "const" || kind === "using" || kind === "await using") && !(this.match(54) || this.isContextual(98))) this.raise(Errors
|
|
26726
|
+
if (decl.id.type !== "Identifier" && !(isFor && (this.match(54) || this.isContextual(98)))) this.raise(Errors.DeclarationMissingInitializer, this.state.lastTokEndLoc, { kind: "destructuring" });
|
|
26727
|
+
else if ((kind === "const" || kind === "using" || kind === "await using") && !(this.match(54) || this.isContextual(98))) this.raise(Errors.DeclarationMissingInitializer, this.state.lastTokEndLoc, { kind });
|
|
26717
26728
|
}
|
|
26718
26729
|
declarations.push(this.finishNode(decl, "VariableDeclarator"));
|
|
26719
26730
|
if (!this.eat(8)) break;
|
|
@@ -26723,8 +26734,8 @@ var StatementParser = class extends ExpressionParser {
|
|
|
26723
26734
|
parseVarId(decl, kind) {
|
|
26724
26735
|
const id = this.parseBindingAtom();
|
|
26725
26736
|
if (kind === "using" || kind === "await using") {
|
|
26726
|
-
if (id.type === "ArrayPattern" || id.type === "ObjectPattern") this.raise(Errors
|
|
26727
|
-
} else if (id.type === "VoidPattern") this.raise(Errors
|
|
26737
|
+
if (id.type === "ArrayPattern" || id.type === "ObjectPattern") this.raise(Errors.UsingDeclarationHasBindingPattern, id);
|
|
26738
|
+
} else if (id.type === "VoidPattern") this.raise(Errors.UnexpectedVoidPattern, id);
|
|
26728
26739
|
this.checkLVal(id, { type: "VariableDeclarator" }, kind === "var" ? 5 : 8201);
|
|
26729
26740
|
decl.id = id;
|
|
26730
26741
|
}
|
|
@@ -26738,7 +26749,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
26738
26749
|
const isAsync = !!(flags & 8);
|
|
26739
26750
|
this.initFunction(node, isAsync);
|
|
26740
26751
|
if (this.match(51)) {
|
|
26741
|
-
if (hangingDeclaration) this.raise(Errors
|
|
26752
|
+
if (hangingDeclaration) this.raise(Errors.GeneratorInSingleStatementContext, this.state.startLoc);
|
|
26742
26753
|
this.next();
|
|
26743
26754
|
node.generator = true;
|
|
26744
26755
|
}
|
|
@@ -26799,7 +26810,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
26799
26810
|
this.expect(2);
|
|
26800
26811
|
while (!this.match(4)) {
|
|
26801
26812
|
if (this.eat(9)) {
|
|
26802
|
-
if (decorators.length > 0) throw this.raise(Errors
|
|
26813
|
+
if (decorators.length > 0) throw this.raise(Errors.DecoratorSemicolon, this.state.lastTokEndLoc);
|
|
26803
26814
|
continue;
|
|
26804
26815
|
}
|
|
26805
26816
|
if (this.match(22)) {
|
|
@@ -26813,14 +26824,10 @@ var StatementParser = class extends ExpressionParser {
|
|
|
26813
26824
|
decorators = [];
|
|
26814
26825
|
}
|
|
26815
26826
|
this.parseClassMember(classBody, member, state);
|
|
26816
|
-
if (member.decorators && member.decorators.length > 0) {
|
|
26817
|
-
if (this.hasPlugin("typescript") && (this.hasPlugin("estree") ? member.type === "TSAbstractMethodDefinition" : member.type === "TSDeclareMethod")) this.raise(Errors$1.DecoratorAbstractMethod, member);
|
|
26818
|
-
if (member.kind === "constructor") this.raise(Errors$1.DecoratorConstructor, member);
|
|
26819
|
-
}
|
|
26820
26827
|
}
|
|
26821
26828
|
this.state.strict = oldStrict;
|
|
26822
26829
|
this.next();
|
|
26823
|
-
if (decorators.length) throw this.raise(Errors
|
|
26830
|
+
if (decorators.length) throw this.raise(Errors.TrailingDecorator, this.state.startLoc);
|
|
26824
26831
|
this.classScope.exit();
|
|
26825
26832
|
return this.finishNode(classBody, "ClassBody");
|
|
26826
26833
|
}
|
|
@@ -26875,7 +26882,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
26875
26882
|
this.pushClassPrivateMethod(classBody, privateMethod, true, false);
|
|
26876
26883
|
return;
|
|
26877
26884
|
}
|
|
26878
|
-
if (this.isNonstaticConstructor(publicMethod)) this.raise(Errors
|
|
26885
|
+
if (this.isNonstaticConstructor(publicMethod)) this.raise(Errors.ConstructorIsGenerator, publicMethod.key);
|
|
26879
26886
|
this.pushClassMethod(classBody, publicMethod, true, false, false, false);
|
|
26880
26887
|
return;
|
|
26881
26888
|
}
|
|
@@ -26895,8 +26902,9 @@ var StatementParser = class extends ExpressionParser {
|
|
|
26895
26902
|
let allowsDirectSuper = false;
|
|
26896
26903
|
if (isConstructor) {
|
|
26897
26904
|
publicMethod.kind = "constructor";
|
|
26898
|
-
if (
|
|
26899
|
-
if (
|
|
26905
|
+
if (publicMethod.decorators && publicMethod.decorators.length > 0) this.raise(Errors.DecoratorConstructor, member);
|
|
26906
|
+
if (state.hadConstructor && !this.hasPlugin("typescript")) this.raise(Errors.DuplicateConstructor, key);
|
|
26907
|
+
if (isConstructor && this.hasPlugin("typescript") && member.override) this.raise(Errors.OverrideOnConstructor, key);
|
|
26900
26908
|
state.hadConstructor = true;
|
|
26901
26909
|
allowsDirectSuper = state.hadSuperClass;
|
|
26902
26910
|
}
|
|
@@ -26913,7 +26921,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
26913
26921
|
this.parsePostMemberNameModifiers(publicMember);
|
|
26914
26922
|
if (isPrivate) this.pushClassPrivateMethod(classBody, privateMethod, isGenerator, true);
|
|
26915
26923
|
else {
|
|
26916
|
-
if (this.isNonstaticConstructor(publicMethod)) this.raise(Errors
|
|
26924
|
+
if (this.isNonstaticConstructor(publicMethod)) this.raise(Errors.ConstructorIsAsync, publicMethod.key);
|
|
26917
26925
|
this.pushClassMethod(classBody, publicMethod, isGenerator, true, false, false);
|
|
26918
26926
|
}
|
|
26919
26927
|
} else if ((maybeContextualKw === "get" || maybeContextualKw === "set") && !(this.match(51) && this.isLineTerminator())) {
|
|
@@ -26923,7 +26931,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
26923
26931
|
this.parseClassElementName(publicMethod);
|
|
26924
26932
|
if (isPrivate) this.pushClassPrivateMethod(classBody, privateMethod, false, false);
|
|
26925
26933
|
else {
|
|
26926
|
-
if (this.isNonstaticConstructor(publicMethod)) this.raise(Errors
|
|
26934
|
+
if (this.isNonstaticConstructor(publicMethod)) this.raise(Errors.ConstructorIsAccessor, publicMethod.key);
|
|
26927
26935
|
this.pushClassMethod(classBody, publicMethod, false, false, false, false);
|
|
26928
26936
|
}
|
|
26929
26937
|
this.checkGetterSetterParams(publicMethod);
|
|
@@ -26939,9 +26947,9 @@ var StatementParser = class extends ExpressionParser {
|
|
|
26939
26947
|
}
|
|
26940
26948
|
parseClassElementName(member) {
|
|
26941
26949
|
const { type, value } = this.state;
|
|
26942
|
-
if ((type === 128 || type === 130) && member.static && value === "prototype") this.raise(Errors
|
|
26950
|
+
if ((type === 128 || type === 130) && member.static && value === "prototype") this.raise(Errors.StaticPrototype, this.state.startLoc);
|
|
26943
26951
|
if (type === 134) {
|
|
26944
|
-
if (value === "constructor") this.raise(Errors
|
|
26952
|
+
if (value === "constructor") this.raise(Errors.ConstructorClassPrivateField, this.state.startLoc);
|
|
26945
26953
|
const key = this.parsePrivateName();
|
|
26946
26954
|
member.key = key;
|
|
26947
26955
|
return key;
|
|
@@ -26960,10 +26968,10 @@ var StatementParser = class extends ExpressionParser {
|
|
|
26960
26968
|
this.scope.exit();
|
|
26961
26969
|
this.state.labels = oldLabels;
|
|
26962
26970
|
classBody.body.push(this.finishNode(member, "StaticBlock"));
|
|
26963
|
-
if (member.decorators?.length) this.raise(Errors
|
|
26971
|
+
if (member.decorators?.length) this.raise(Errors.DecoratorStaticBlock, member);
|
|
26964
26972
|
}
|
|
26965
26973
|
pushClassProperty(classBody, prop) {
|
|
26966
|
-
if (!prop.computed && this.nameIsConstructor(prop.key)) this.raise(Errors
|
|
26974
|
+
if (!prop.computed && this.nameIsConstructor(prop.key)) this.raise(Errors.ConstructorClassField, prop.key);
|
|
26967
26975
|
classBody.body.push(this.parseClassProperty(prop));
|
|
26968
26976
|
}
|
|
26969
26977
|
pushClassPrivateProperty(classBody, prop) {
|
|
@@ -26972,7 +26980,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
26972
26980
|
this.classScope.declarePrivateName(this.getPrivateNameSV(node.key), 0, node.key.start);
|
|
26973
26981
|
}
|
|
26974
26982
|
pushClassAccessorProperty(classBody, prop, isPrivate) {
|
|
26975
|
-
if (!isPrivate && !prop.computed && this.nameIsConstructor(prop.key)) this.raise(Errors
|
|
26983
|
+
if (!isPrivate && !prop.computed && this.nameIsConstructor(prop.key)) this.raise(Errors.ConstructorClassField, prop.key);
|
|
26976
26984
|
const node = this.parseClassAccessorProperty(prop);
|
|
26977
26985
|
classBody.body.push(node);
|
|
26978
26986
|
if (isPrivate) this.classScope.declarePrivateName(this.getPrivateNameSV(node.key), 0, node.key.start);
|
|
@@ -27019,7 +27027,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
27019
27027
|
node.id = this.parseIdentifier();
|
|
27020
27028
|
if (isStatement) this.declareNameFromIdentifier(node.id, bindingType);
|
|
27021
27029
|
} else if (optionalId || !isStatement) node.id = null;
|
|
27022
|
-
else throw this.raise(Errors
|
|
27030
|
+
else throw this.raise(Errors.MissingClassName, this.state.startLoc);
|
|
27023
27031
|
}
|
|
27024
27032
|
parseClassSuper(node) {
|
|
27025
27033
|
if (this.eat(77)) {
|
|
@@ -27037,7 +27045,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
27037
27045
|
const isFromRequired = hasDefault || hasStar;
|
|
27038
27046
|
if (hasStar && !hasNamespace) {
|
|
27039
27047
|
if (hasDefault) this.unexpected();
|
|
27040
|
-
if (decorators) throw this.raise(Errors
|
|
27048
|
+
if (decorators) throw this.raise(Errors.UnsupportedDecoratorExport, node);
|
|
27041
27049
|
this.parseExportFrom(node, true);
|
|
27042
27050
|
this.sawUnambiguousESM = true;
|
|
27043
27051
|
return this.finishNode(node, "ExportAllDeclaration");
|
|
@@ -27048,14 +27056,14 @@ var StatementParser = class extends ExpressionParser {
|
|
|
27048
27056
|
let hasDeclaration;
|
|
27049
27057
|
if (isFromRequired || hasSpecifiers) {
|
|
27050
27058
|
hasDeclaration = false;
|
|
27051
|
-
if (decorators) throw this.raise(Errors
|
|
27059
|
+
if (decorators) throw this.raise(Errors.UnsupportedDecoratorExport, node);
|
|
27052
27060
|
this.parseExportFrom(node, isFromRequired);
|
|
27053
27061
|
} else hasDeclaration = this.maybeParseExportDeclaration(node);
|
|
27054
27062
|
if (isFromRequired || hasSpecifiers || hasDeclaration) {
|
|
27055
27063
|
const node2 = node;
|
|
27056
27064
|
this.checkExport(node2, true, false, !!node2.source);
|
|
27057
27065
|
if (node2.declaration?.type === "ClassDeclaration") this.maybeTakeDecorators(decorators, node2.declaration, node2);
|
|
27058
|
-
else if (decorators) throw this.raise(Errors
|
|
27066
|
+
else if (decorators) throw this.raise(Errors.UnsupportedDecoratorExport, node);
|
|
27059
27067
|
this.sawUnambiguousESM = true;
|
|
27060
27068
|
return this.finishNode(node2, "ExportNamedDeclaration");
|
|
27061
27069
|
}
|
|
@@ -27064,14 +27072,14 @@ var StatementParser = class extends ExpressionParser {
|
|
|
27064
27072
|
const decl = this.parseExportDefaultExpression();
|
|
27065
27073
|
node2.declaration = decl;
|
|
27066
27074
|
if (decl.type === "ClassDeclaration") this.maybeTakeDecorators(decorators, decl, node2);
|
|
27067
|
-
else if (decorators) throw this.raise(Errors
|
|
27075
|
+
else if (decorators) throw this.raise(Errors.UnsupportedDecoratorExport, node);
|
|
27068
27076
|
this.checkExport(node2, true, true);
|
|
27069
27077
|
this.sawUnambiguousESM = true;
|
|
27070
27078
|
return this.finishNode(node2, "ExportDefaultDeclaration");
|
|
27071
27079
|
}
|
|
27072
27080
|
throw this.unexpected(null, 2);
|
|
27073
27081
|
}
|
|
27074
|
-
eatExportStar(
|
|
27082
|
+
eatExportStar(_) {
|
|
27075
27083
|
return this.eat(51);
|
|
27076
27084
|
}
|
|
27077
27085
|
maybeParseExportDefaultSpecifier(node, maybeDefaultIdentifier) {
|
|
@@ -27136,7 +27144,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
27136
27144
|
}
|
|
27137
27145
|
if (this.match(76)) return this.parseClass(expr, true, true);
|
|
27138
27146
|
if (this.match(22)) return this.parseClass(this.maybeTakeDecorators(this.parseDecorators(false), this.startNode()), true, true);
|
|
27139
|
-
if (this.match(71) || this.match(70) || this.isLet() || this.isUsing() || this.isAwaitUsing()) throw this.raise(Errors
|
|
27147
|
+
if (this.match(71) || this.match(70) || this.isLet() || this.isUsing() || this.isAwaitUsing()) throw this.raise(Errors.UnsupportedDefaultExport, this.state.startLoc);
|
|
27140
27148
|
const res = this.parseMaybeAssignAllowIn();
|
|
27141
27149
|
this.semicolon();
|
|
27142
27150
|
return res;
|
|
@@ -27182,11 +27190,11 @@ var StatementParser = class extends ExpressionParser {
|
|
|
27182
27190
|
if (this.hasPlugin("decorators")) return true;
|
|
27183
27191
|
}
|
|
27184
27192
|
if (this.isUsing()) {
|
|
27185
|
-
this.raise(Errors
|
|
27193
|
+
this.raise(Errors.UsingDeclarationExport, this.state.startLoc);
|
|
27186
27194
|
return true;
|
|
27187
27195
|
}
|
|
27188
27196
|
if (this.isAwaitUsing()) {
|
|
27189
|
-
this.raise(Errors
|
|
27197
|
+
this.raise(Errors.UsingDeclarationExport, this.state.startLoc);
|
|
27190
27198
|
return true;
|
|
27191
27199
|
}
|
|
27192
27200
|
return type === 70 || type === 71 || type === 64 || type === 76 || this.isLet() || this.isAsyncFunction();
|
|
@@ -27197,7 +27205,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
27197
27205
|
this.checkDuplicateExports(node, "default");
|
|
27198
27206
|
if (this.hasPlugin("exportDefaultFrom")) {
|
|
27199
27207
|
const declaration = node.declaration;
|
|
27200
|
-
if (declaration.type === "Identifier" && declaration.name === "from" && declaration.end - declaration.start === 4 && !declaration.extra?.parenthesized) this.raise(Errors
|
|
27208
|
+
if (declaration.type === "Identifier" && declaration.name === "from" && declaration.end - declaration.start === 4 && !declaration.extra?.parenthesized) this.raise(Errors.ExportDefaultFromAsIdentifier, declaration);
|
|
27201
27209
|
}
|
|
27202
27210
|
} else if (node.specifiers?.length) for (const specifier of node.specifiers) {
|
|
27203
27211
|
const { exported } = specifier;
|
|
@@ -27205,7 +27213,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
27205
27213
|
this.checkDuplicateExports(specifier, exportName);
|
|
27206
27214
|
if (!isFrom && specifier.local) {
|
|
27207
27215
|
const { local } = specifier;
|
|
27208
|
-
if (local.type !== "Identifier") this.raise(Errors
|
|
27216
|
+
if (local.type !== "Identifier") this.raise(Errors.ExportBindingIsString, specifier, {
|
|
27209
27217
|
localName: local.value,
|
|
27210
27218
|
exportName
|
|
27211
27219
|
});
|
|
@@ -27235,8 +27243,8 @@ var StatementParser = class extends ExpressionParser {
|
|
|
27235
27243
|
else if (node.type === "AssignmentPattern") this.checkDeclaration(node.left);
|
|
27236
27244
|
}
|
|
27237
27245
|
checkDuplicateExports(node, exportName) {
|
|
27238
|
-
if (this.exportedIdentifiers.has(exportName)) if (exportName === "default") this.raise(Errors
|
|
27239
|
-
else this.raise(Errors
|
|
27246
|
+
if (this.exportedIdentifiers.has(exportName)) if (exportName === "default") this.raise(Errors.DuplicateDefaultExport, node);
|
|
27247
|
+
else this.raise(Errors.DuplicateExport, node, { exportName });
|
|
27240
27248
|
this.exportedIdentifiers.add(exportName);
|
|
27241
27249
|
}
|
|
27242
27250
|
parseExportSpecifiers(isInTypeExport) {
|
|
@@ -27267,7 +27275,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
27267
27275
|
if (this.match(130)) {
|
|
27268
27276
|
const result = this.parseStringLiteral(this.state.value);
|
|
27269
27277
|
const surrogate = loneSurrogate.exec(result.value);
|
|
27270
|
-
if (surrogate) this.raise(Errors
|
|
27278
|
+
if (surrogate) this.raise(Errors.ModuleExportNameHasLoneSurrogate, result, { surrogateCharCode: surrogate[0].charCodeAt(0) });
|
|
27271
27279
|
return result;
|
|
27272
27280
|
}
|
|
27273
27281
|
return this.parseIdentifier(true);
|
|
@@ -27276,9 +27284,9 @@ var StatementParser = class extends ExpressionParser {
|
|
|
27276
27284
|
const { specifiers } = node;
|
|
27277
27285
|
const singleBindingType = specifiers.length === 1 ? specifiers[0].type : null;
|
|
27278
27286
|
if (node.phase === "source") {
|
|
27279
|
-
if (singleBindingType !== "ImportDefaultSpecifier") this.raise(Errors
|
|
27287
|
+
if (singleBindingType !== "ImportDefaultSpecifier") this.raise(Errors.SourcePhaseImportRequiresDefault, specifiers[0]);
|
|
27280
27288
|
} else if (node.phase === "defer") {
|
|
27281
|
-
if (singleBindingType !== "ImportNamespaceSpecifier") this.raise(Errors
|
|
27289
|
+
if (singleBindingType !== "ImportNamespaceSpecifier") this.raise(Errors.DeferImportRequiresNamespace, specifiers[0]);
|
|
27282
27290
|
}
|
|
27283
27291
|
}
|
|
27284
27292
|
isPotentialImportPhase(isExport) {
|
|
@@ -27356,12 +27364,12 @@ var StatementParser = class extends ExpressionParser {
|
|
|
27356
27364
|
if (this.match(4)) break;
|
|
27357
27365
|
const node = this.startNode();
|
|
27358
27366
|
const keyName = this.state.value;
|
|
27359
|
-
if (attrNames.has(keyName)) this.raise(Errors
|
|
27367
|
+
if (attrNames.has(keyName)) this.raise(Errors.ModuleAttributesWithDuplicateKeys, this.state.startLoc, { key: keyName });
|
|
27360
27368
|
attrNames.add(keyName);
|
|
27361
27369
|
if (this.match(130)) node.key = this.parseStringLiteral(keyName);
|
|
27362
27370
|
else node.key = this.parseIdentifier(true);
|
|
27363
27371
|
this.expect(10);
|
|
27364
|
-
if (!this.match(130)) throw this.raise(Errors
|
|
27372
|
+
if (!this.match(130)) throw this.raise(Errors.ModuleAttributeInvalidValue, this.state.startLoc);
|
|
27365
27373
|
node.value = this.parseStringLiteral(this.state.value);
|
|
27366
27374
|
attrs.push(this.finishNode(node, "ImportAttribute"));
|
|
27367
27375
|
} while (this.eat(8));
|
|
@@ -27405,7 +27413,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
27405
27413
|
while (!this.eat(4)) {
|
|
27406
27414
|
if (first) first = false;
|
|
27407
27415
|
else {
|
|
27408
|
-
if (this.eat(10)) throw this.raise(Errors
|
|
27416
|
+
if (this.eat(10)) throw this.raise(Errors.DestructureNamedImport, this.state.startLoc);
|
|
27409
27417
|
this.expect(8);
|
|
27410
27418
|
if (this.eat(4)) break;
|
|
27411
27419
|
}
|
|
@@ -27421,7 +27429,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
27421
27429
|
if (this.eatContextual(89)) specifier.local = this.parseIdentifier();
|
|
27422
27430
|
else {
|
|
27423
27431
|
const { imported } = specifier;
|
|
27424
|
-
if (importedIsString) throw this.raise(Errors
|
|
27432
|
+
if (importedIsString) throw this.raise(Errors.ImportBindingIsString, specifier, { importName: imported.value });
|
|
27425
27433
|
this.checkReservedWord(imported.name, specifier.start, true, true);
|
|
27426
27434
|
if (!specifier.local) specifier.local = this.cloneIdentifier(imported);
|
|
27427
27435
|
}
|
|
@@ -27439,7 +27447,7 @@ function nonNull(x) {
|
|
|
27439
27447
|
function assert(x) {
|
|
27440
27448
|
if (!x) throw new Error("Assert fail");
|
|
27441
27449
|
}
|
|
27442
|
-
const TSErrors
|
|
27450
|
+
const TSErrors = ParseErrorEnum`typescript`({
|
|
27443
27451
|
AbstractMethodHasImplementation: ({ methodName }) => `Method '${methodName}' cannot have an implementation because it is marked abstract.`,
|
|
27444
27452
|
AbstractPropertyHasInitializer: ({ propertyName }) => `Property '${propertyName}' cannot have an initializer because it is marked abstract.`,
|
|
27445
27453
|
AccessorCannotBeOptional: "An 'accessor' property cannot be declared optional.",
|
|
@@ -27452,6 +27460,7 @@ const TSErrors$1 = ParseErrorEnum$1`typescript`({
|
|
|
27452
27460
|
DeclareAccessor: ({ kind }) => `'declare' is not allowed in ${kind}ters.`,
|
|
27453
27461
|
DeclareClassFieldHasInitializer: "Initializers are not allowed in ambient contexts.",
|
|
27454
27462
|
DeclareFunctionHasImplementation: "An implementation cannot be declared in ambient contexts.",
|
|
27463
|
+
DecoratorAbstractMethod: ({ kind }) => `Decorators can't be used with ${kind.startsWith("a") ? "an" : "a"} ${kind}.`,
|
|
27455
27464
|
DuplicateAccessibilityModifier: ({ modifier }) => `Accessibility modifier already seen: '${modifier}'.`,
|
|
27456
27465
|
DuplicateModifier: ({ modifier }) => `Duplicate modifier: '${modifier}'.`,
|
|
27457
27466
|
EmptyHeritageClauseType: ({ token }) => `'${token}' list cannot be empty.`,
|
|
@@ -27573,18 +27582,18 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
27573
27582
|
if (this.tsTryParse(this.tsNextTokenCanFollowModifier.bind(this))) return modifier;
|
|
27574
27583
|
}
|
|
27575
27584
|
}
|
|
27576
|
-
tsParseModifiers({ allowedModifiers, disallowedModifiers, stopOnStartOfClassStaticBlock, errorTemplate = TSErrors
|
|
27585
|
+
tsParseModifiers({ allowedModifiers, disallowedModifiers, stopOnStartOfClassStaticBlock, errorTemplate = TSErrors.InvalidModifierOnTypeMember }, modified) {
|
|
27577
27586
|
const enforceOrder = (loc, modifier, before, after) => {
|
|
27578
|
-
if (modifier === before && modified[after]) this.raise(TSErrors
|
|
27587
|
+
if (modifier === before && modified[after]) this.raise(TSErrors.InvalidModifiersOrder, loc, { orderedModifiers: [before, after] });
|
|
27579
27588
|
};
|
|
27580
27589
|
const incompatible = (loc, modifier, mod1, mod2) => {
|
|
27581
|
-
if (modified[mod1] && modifier === mod2 || modified[mod2] && modifier === mod1) this.raise(TSErrors
|
|
27590
|
+
if (modified[mod1] && modifier === mod2 || modified[mod2] && modifier === mod1) this.raise(TSErrors.IncompatibleModifiers, loc, { modifiers: [mod1, mod2] });
|
|
27582
27591
|
};
|
|
27583
27592
|
for (;;) {
|
|
27584
27593
|
const { startLoc } = this.state;
|
|
27585
27594
|
const modifier = this.tsParseModifier(allowedModifiers.concat(disallowedModifiers ?? []), stopOnStartOfClassStaticBlock, modified.static);
|
|
27586
27595
|
if (!modifier) break;
|
|
27587
|
-
if (tsIsAccessModifier(modifier)) if (modified.accessibility) this.raise(TSErrors
|
|
27596
|
+
if (tsIsAccessModifier(modifier)) if (modified.accessibility) this.raise(TSErrors.DuplicateAccessibilityModifier, startLoc, { modifier });
|
|
27588
27597
|
else {
|
|
27589
27598
|
enforceOrder(startLoc, modifier, modifier, "override");
|
|
27590
27599
|
enforceOrder(startLoc, modifier, modifier, "static");
|
|
@@ -27592,11 +27601,11 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
27592
27601
|
modified.accessibility = modifier;
|
|
27593
27602
|
}
|
|
27594
27603
|
else if (tsIsVarianceAnnotations(modifier)) {
|
|
27595
|
-
if (modified[modifier]) this.raise(TSErrors
|
|
27604
|
+
if (modified[modifier]) this.raise(TSErrors.DuplicateModifier, startLoc, { modifier });
|
|
27596
27605
|
modified[modifier] = true;
|
|
27597
27606
|
enforceOrder(startLoc, modifier, "in", "out");
|
|
27598
27607
|
} else {
|
|
27599
|
-
if (Object.hasOwn(modified, modifier)) this.raise(TSErrors
|
|
27608
|
+
if (Object.hasOwn(modified, modifier)) this.raise(TSErrors.DuplicateModifier, startLoc, { modifier });
|
|
27600
27609
|
else {
|
|
27601
27610
|
enforceOrder(startLoc, modifier, "static", "readonly");
|
|
27602
27611
|
enforceOrder(startLoc, modifier, "static", "override");
|
|
@@ -27660,7 +27669,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
27660
27669
|
this.expect(79);
|
|
27661
27670
|
this.expect(6);
|
|
27662
27671
|
if (!this.match(130)) {
|
|
27663
|
-
this.raise(TSErrors
|
|
27672
|
+
this.raise(TSErrors.UnsupportedImportTypeArgument, this.state.startLoc);
|
|
27664
27673
|
node.source = this.tsParseNonConditionalType();
|
|
27665
27674
|
} else node.source = this.parseStringLiteral(this.state.value);
|
|
27666
27675
|
if (this.eat(8)) node.options = this.tsParseImportTypeOptions();
|
|
@@ -27757,12 +27766,12 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
27757
27766
|
"abstract",
|
|
27758
27767
|
"override"
|
|
27759
27768
|
],
|
|
27760
|
-
errorTemplate: TSErrors
|
|
27769
|
+
errorTemplate: TSErrors.InvalidModifierOnTypeParameter
|
|
27761
27770
|
});
|
|
27762
27771
|
tsParseConstModifier = this.tsParseModifiers.bind(this, {
|
|
27763
27772
|
allowedModifiers: ["const"],
|
|
27764
27773
|
disallowedModifiers: ["in", "out"],
|
|
27765
|
-
errorTemplate: TSErrors
|
|
27774
|
+
errorTemplate: TSErrors.InvalidModifierOnTypeParameterPositions
|
|
27766
27775
|
});
|
|
27767
27776
|
tsParseInOutConstModifiers = this.tsParseModifiers.bind(this, {
|
|
27768
27777
|
allowedModifiers: [
|
|
@@ -27779,7 +27788,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
27779
27788
|
"abstract",
|
|
27780
27789
|
"override"
|
|
27781
27790
|
],
|
|
27782
|
-
errorTemplate: TSErrors
|
|
27791
|
+
errorTemplate: TSErrors.InvalidModifierOnTypeParameter
|
|
27783
27792
|
});
|
|
27784
27793
|
tsParseTypeParameter(parseModifiers) {
|
|
27785
27794
|
const node = this.startNode();
|
|
@@ -27798,7 +27807,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
27798
27807
|
else this.unexpected();
|
|
27799
27808
|
const refTrailingCommaPos = { value: -1 };
|
|
27800
27809
|
node.params = this.tsParseBracketedList("TypeParametersOrArguments", this.tsParseTypeParameter.bind(this, parseModifiers), false, true, refTrailingCommaPos);
|
|
27801
|
-
if (node.params.length === 0) this.raise(TSErrors
|
|
27810
|
+
if (node.params.length === 0) this.raise(TSErrors.EmptyTypeParameters, node);
|
|
27802
27811
|
if (refTrailingCommaPos.value !== -1) this.addExtra(node, "trailingComma", refTrailingCommaPos.value);
|
|
27803
27812
|
return this.finishNode(node, "TSTypeParameterDeclaration");
|
|
27804
27813
|
}
|
|
@@ -27816,7 +27825,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
27816
27825
|
const list = super.parseBindingList(7, 41, 2);
|
|
27817
27826
|
for (const pattern of list) {
|
|
27818
27827
|
const { type } = pattern;
|
|
27819
|
-
if (type === "AssignmentPattern" || type === "TSParameterProperty") this.raise(TSErrors
|
|
27828
|
+
if (type === "AssignmentPattern" || type === "TSParameterProperty") this.raise(TSErrors.UnsupportedSignatureParameterKind, pattern, { type });
|
|
27820
27829
|
}
|
|
27821
27830
|
return list;
|
|
27822
27831
|
}
|
|
@@ -27852,25 +27861,25 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
27852
27861
|
tsParsePropertyOrMethodSignature(node, readonly) {
|
|
27853
27862
|
if (this.eat(13)) node.optional = true;
|
|
27854
27863
|
if (this.match(6) || this.match(43)) {
|
|
27855
|
-
if (readonly) this.raise(TSErrors
|
|
27864
|
+
if (readonly) this.raise(TSErrors.ReadonlyForMethodSignature, node);
|
|
27856
27865
|
const method = node;
|
|
27857
|
-
if (method.kind && this.match(43)) this.raise(TSErrors
|
|
27866
|
+
if (method.kind && this.match(43)) this.raise(TSErrors.AccessorCannotHaveTypeParameters, this.state.curPosition());
|
|
27858
27867
|
this.tsFillSignature(10, method);
|
|
27859
27868
|
this.tsParseTypeMemberSemicolon();
|
|
27860
27869
|
if (method.kind === "get") {
|
|
27861
27870
|
if (method.params.length > 0) {
|
|
27862
|
-
this.raise(Errors
|
|
27863
|
-
if (this.isThisParam(method.params[0])) this.raise(TSErrors
|
|
27871
|
+
this.raise(Errors.BadGetterArity, this.state.curPosition());
|
|
27872
|
+
if (this.isThisParam(method.params[0])) this.raise(TSErrors.AccessorCannotDeclareThisParameter, this.state.curPosition());
|
|
27864
27873
|
}
|
|
27865
27874
|
} else if (method.kind === "set") {
|
|
27866
|
-
if (method.params.length !== 1) this.raise(Errors
|
|
27875
|
+
if (method.params.length !== 1) this.raise(Errors.BadSetterArity, this.state.curPosition());
|
|
27867
27876
|
else {
|
|
27868
27877
|
const firstParameter = method.params[0];
|
|
27869
|
-
if (this.isThisParam(firstParameter)) this.raise(TSErrors
|
|
27870
|
-
if (firstParameter.type === "Identifier" && firstParameter.optional) this.raise(TSErrors
|
|
27871
|
-
if (firstParameter.type === "RestElement") this.raise(TSErrors
|
|
27878
|
+
if (this.isThisParam(firstParameter)) this.raise(TSErrors.AccessorCannotDeclareThisParameter, this.state.curPosition());
|
|
27879
|
+
if (firstParameter.type === "Identifier" && firstParameter.optional) this.raise(TSErrors.SetAccessorCannotHaveOptionalParameter, this.state.curPosition());
|
|
27880
|
+
if (firstParameter.type === "RestElement") this.raise(TSErrors.SetAccessorCannotHaveRestParameter, this.state.curPosition());
|
|
27872
27881
|
}
|
|
27873
|
-
if (method.returnType) this.raise(TSErrors
|
|
27882
|
+
if (method.returnType) this.raise(TSErrors.SetAccessorCannotHaveReturnType, method.returnType);
|
|
27874
27883
|
} else method.kind = "method";
|
|
27875
27884
|
return this.finishNode(method, "TSMethodSignature");
|
|
27876
27885
|
} else {
|
|
@@ -27966,7 +27975,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
27966
27975
|
let seenOptionalElement = false;
|
|
27967
27976
|
node.elementTypes.forEach((elementNode) => {
|
|
27968
27977
|
const { type } = elementNode;
|
|
27969
|
-
if (seenOptionalElement && type !== "TSRestType" && type !== "TSOptionalType" && !(type === "TSNamedTupleMember" && elementNode.optional)) this.raise(TSErrors
|
|
27978
|
+
if (seenOptionalElement && type !== "TSRestType" && type !== "TSOptionalType" && !(type === "TSNamedTupleMember" && elementNode.optional)) this.raise(TSErrors.OptionalTypeBeforeRequired, elementNode);
|
|
27970
27979
|
seenOptionalElement ||= type === "TSNamedTupleMember" && elementNode.optional || type === "TSOptionalType";
|
|
27971
27980
|
});
|
|
27972
27981
|
return this.finishNode(node, "TSTupleType");
|
|
@@ -28015,12 +28024,12 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
28015
28024
|
labeledNode.elementType = type;
|
|
28016
28025
|
if (this.eat(13)) {
|
|
28017
28026
|
labeledNode.optional = true;
|
|
28018
|
-
this.raise(TSErrors
|
|
28027
|
+
this.raise(TSErrors.TupleOptionalAfterType, this.state.lastTokStartLoc);
|
|
28019
28028
|
}
|
|
28020
28029
|
} else {
|
|
28021
28030
|
labeledNode = this.startNodeAt(startLoc);
|
|
28022
28031
|
labeledNode.optional = optional;
|
|
28023
|
-
this.raise(TSErrors
|
|
28032
|
+
this.raise(TSErrors.InvalidTupleMemberLabel, type);
|
|
28024
28033
|
labeledNode.label = type;
|
|
28025
28034
|
labeledNode.elementType = this.tsParseType();
|
|
28026
28035
|
}
|
|
@@ -28180,7 +28189,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
28180
28189
|
switch (node.typeAnnotation.type) {
|
|
28181
28190
|
case "TSTupleType":
|
|
28182
28191
|
case "TSArrayType": return;
|
|
28183
|
-
default: this.raise(TSErrors
|
|
28192
|
+
default: this.raise(TSErrors.UnexpectedReadonly, node);
|
|
28184
28193
|
}
|
|
28185
28194
|
}
|
|
28186
28195
|
tsParseInferType() {
|
|
@@ -28320,7 +28329,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
28320
28329
|
const containsEsc = this.state.containsEsc;
|
|
28321
28330
|
this.next();
|
|
28322
28331
|
if (!tokenIsIdentifier(this.state.type) && !this.match(74)) return false;
|
|
28323
|
-
if (containsEsc) this.raise(Errors
|
|
28332
|
+
if (containsEsc) this.raise(Errors.InvalidEscapedReservedWord, this.state.lastTokStartLoc, { reservedWord: "asserts" });
|
|
28324
28333
|
return true;
|
|
28325
28334
|
}
|
|
28326
28335
|
tsParseTypeAnnotation(eatColon = true, t = this.startNode()) {
|
|
@@ -28353,7 +28362,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
28353
28362
|
return this.tsParseUnionTypeOrHigher();
|
|
28354
28363
|
}
|
|
28355
28364
|
tsParseTypeAssertion() {
|
|
28356
|
-
if (this.getPluginOption("typescript", "disallowAmbiguousJSXLike")) this.raise(TSErrors
|
|
28365
|
+
if (this.getPluginOption("typescript", "disallowAmbiguousJSXLike")) this.raise(TSErrors.ReservedTypeAssertion, this.state.startLoc);
|
|
28357
28366
|
const node = this.startNode();
|
|
28358
28367
|
node.typeAnnotation = this.tsInType(() => {
|
|
28359
28368
|
this.next();
|
|
@@ -28367,7 +28376,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
28367
28376
|
const originalStartLoc = this.state.startLoc;
|
|
28368
28377
|
const delimitedList = this.tsParseDelimitedList("HeritageClauseElement", () => {
|
|
28369
28378
|
const expression = (this.state.canStartArrow = false, super.parseExprSubscripts());
|
|
28370
|
-
if (!tsIsEntityName(expression)) this.raise(TSErrors
|
|
28379
|
+
if (!tsIsEntityName(expression)) this.raise(TSErrors.InvalidHeritageClauseType, expression.start, { token });
|
|
28371
28380
|
const nodeType = token === "extends" ? "TSInterfaceHeritage" : "TSClassImplements";
|
|
28372
28381
|
if (expression.type === "TSInstantiationExpression") {
|
|
28373
28382
|
expression.type = nodeType;
|
|
@@ -28378,7 +28387,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
28378
28387
|
if (this.match(43) || this.match(47)) node.typeArguments = this.tsParseTypeArgumentsInExpression();
|
|
28379
28388
|
return this.finishNode(node, nodeType);
|
|
28380
28389
|
});
|
|
28381
|
-
if (!delimitedList.length) this.raise(TSErrors
|
|
28390
|
+
if (!delimitedList.length) this.raise(TSErrors.EmptyHeritageClauseType, originalStartLoc, { token });
|
|
28382
28391
|
return delimitedList;
|
|
28383
28392
|
}
|
|
28384
28393
|
tsParseInterfaceDeclaration(node, properties = {}) {
|
|
@@ -28390,7 +28399,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
28390
28399
|
this.checkIdentifier(node.id, 130);
|
|
28391
28400
|
} else {
|
|
28392
28401
|
node.id = null;
|
|
28393
|
-
this.raise(TSErrors
|
|
28402
|
+
this.raise(TSErrors.MissingInterfaceName, this.state.startLoc);
|
|
28394
28403
|
}
|
|
28395
28404
|
node.typeParameters = this.tsTryParseTypeParameters(this.tsParseInOutConstModifiers);
|
|
28396
28405
|
if (this.eat(77)) node.extends = this.tsParseHeritageClause("extends");
|
|
@@ -28416,7 +28425,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
28416
28425
|
return this.finishNode(node, "TSTypeAliasDeclaration");
|
|
28417
28426
|
}
|
|
28418
28427
|
tsInTopLevelContext(cb) {
|
|
28419
|
-
if (this.curContext() !== types
|
|
28428
|
+
if (this.curContext() !== types.brace) {
|
|
28420
28429
|
const oldContext = this.state.context;
|
|
28421
28430
|
this.state.context = [oldContext[0]];
|
|
28422
28431
|
try {
|
|
@@ -28531,7 +28540,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
28531
28540
|
this.checkIdentifier(node.id, 4096);
|
|
28532
28541
|
this.expect(25);
|
|
28533
28542
|
const moduleReference = this.tsParseModuleReference();
|
|
28534
|
-
if (node.importKind === "type" && moduleReference.type !== "TSExternalModuleReference") this.raise(TSErrors
|
|
28543
|
+
if (node.importKind === "type" && moduleReference.type !== "TSExternalModuleReference") this.raise(TSErrors.ImportAliasHasImportType, moduleReference);
|
|
28535
28544
|
node.moduleReference = moduleReference;
|
|
28536
28545
|
this.semicolon();
|
|
28537
28546
|
return this.finishNode(node, "TSImportEqualsDeclaration");
|
|
@@ -28597,14 +28606,14 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
28597
28606
|
});
|
|
28598
28607
|
case 103:
|
|
28599
28608
|
if (this.isUsing()) {
|
|
28600
|
-
this.raise(TSErrors
|
|
28609
|
+
this.raise(TSErrors.InvalidModifierOnUsingDeclaration, this.state.startLoc, "declare");
|
|
28601
28610
|
node.declare = true;
|
|
28602
28611
|
return this.parseVarStatement(node, "using", true);
|
|
28603
28612
|
}
|
|
28604
28613
|
break;
|
|
28605
28614
|
case 92:
|
|
28606
28615
|
if (this.isAwaitUsing()) {
|
|
28607
|
-
this.raise(TSErrors
|
|
28616
|
+
this.raise(TSErrors.InvalidModifierOnAwaitUsingDeclaration, this.state.startLoc, "declare");
|
|
28608
28617
|
node.declare = true;
|
|
28609
28618
|
this.next();
|
|
28610
28619
|
return this.parseVarStatement(node, "await using", true);
|
|
@@ -28671,8 +28680,8 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
28671
28680
|
this.expect(43);
|
|
28672
28681
|
return this.tsParseDelimitedList("TypeParametersOrArguments", this.tsParseType.bind(this));
|
|
28673
28682
|
}));
|
|
28674
|
-
if (node.params.length === 0) this.raise(TSErrors
|
|
28675
|
-
else if (!this.state.inType && this.curContext() === types
|
|
28683
|
+
if (node.params.length === 0) this.raise(TSErrors.EmptyTypeArguments, node);
|
|
28684
|
+
else if (!this.state.inType && this.curContext() === types.brace) this.reScan_lt_gt();
|
|
28676
28685
|
this.expect(44);
|
|
28677
28686
|
return this.finishNode(node, "TSTypeParameterInstantiation");
|
|
28678
28687
|
}
|
|
@@ -28696,7 +28705,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
28696
28705
|
const accessibility = modified.accessibility;
|
|
28697
28706
|
const override = modified.override;
|
|
28698
28707
|
const readonly = modified.readonly;
|
|
28699
|
-
if (!(flags & 4) && (accessibility || readonly || override)) this.raise(TSErrors
|
|
28708
|
+
if (!(flags & 4) && (accessibility || readonly || override)) this.raise(TSErrors.UnexpectedParameterModifier, startLoc || decorators[0]);
|
|
28700
28709
|
const startLoc2 = this.state.startLoc;
|
|
28701
28710
|
const left = this.parseMaybeDefault(startLoc2);
|
|
28702
28711
|
if (flags & 2) this.parseFunctionParamType(left);
|
|
@@ -28708,7 +28717,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
28708
28717
|
if (accessibility) pp.accessibility = accessibility;
|
|
28709
28718
|
if (readonly) pp.readonly = readonly;
|
|
28710
28719
|
if (override) pp.override = override;
|
|
28711
|
-
if (elt.type !== "Identifier" && elt.type !== "AssignmentPattern") this.raise(TSErrors
|
|
28720
|
+
if (elt.type !== "Identifier" && elt.type !== "AssignmentPattern") this.raise(TSErrors.UnsupportedParameterPropertyKind, startLoc || decorators[0]);
|
|
28712
28721
|
pp.parameter = elt;
|
|
28713
28722
|
return this.finishNode(pp, "TSParameterProperty");
|
|
28714
28723
|
}
|
|
@@ -28719,7 +28728,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
28719
28728
|
return node.type === "TSParameterProperty" && super.isSimpleParameter(node.parameter) || super.isSimpleParameter(node);
|
|
28720
28729
|
}
|
|
28721
28730
|
tsDisallowOptionalPattern(node) {
|
|
28722
|
-
for (const param of node.params) if (param.type !== "Identifier" && param.optional && !this.state.isAmbientContext) this.raise(TSErrors
|
|
28731
|
+
for (const param of node.params) if (param.type !== "Identifier" && param.optional && !this.state.isAmbientContext) this.raise(TSErrors.PatternIsOptional, param);
|
|
28723
28732
|
}
|
|
28724
28733
|
setArrowFunctionParameters(node, params, trailingCommaLoc) {
|
|
28725
28734
|
super.setArrowFunctionParameters(node, params, trailingCommaLoc);
|
|
@@ -28730,13 +28739,13 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
28730
28739
|
const bodilessType = type === "FunctionDeclaration" ? "TSDeclareFunction" : type === "ClassMethod" || type === "ClassPrivateMethod" ? "TSDeclareMethod" : void 0;
|
|
28731
28740
|
if (bodilessType && !this.match(2) && this.isLineTerminator()) {
|
|
28732
28741
|
if (bodilessType === "TSDeclareMethod" && node.kind === "constructor") {
|
|
28733
|
-
for (const param of node.params) if (param.type === "TSParameterProperty") this.raise(TSErrors
|
|
28734
|
-
else if (param.type === "AssignmentPattern") this.raise(TSErrors
|
|
28735
|
-
} else for (const param of node.params) if (param.type === "AssignmentPattern") this.raise(TSErrors
|
|
28742
|
+
for (const param of node.params) if (param.type === "TSParameterProperty") this.raise(TSErrors.UnexpectedParameterModifier, param);
|
|
28743
|
+
else if (param.type === "AssignmentPattern") this.raise(TSErrors.UnexpectedParameterInitializer, param);
|
|
28744
|
+
} else for (const param of node.params) if (param.type === "AssignmentPattern") this.raise(TSErrors.UnexpectedParameterInitializer, param);
|
|
28736
28745
|
return this.finishNode(node, bodilessType);
|
|
28737
28746
|
}
|
|
28738
28747
|
if (bodilessType && this.state.isAmbientContext) {
|
|
28739
|
-
this.raise(TSErrors
|
|
28748
|
+
this.raise(TSErrors.DeclareFunctionHasImplementation, this.state.startLoc);
|
|
28740
28749
|
if (bodilessType === "TSDeclareFunction" && node.declare) return super.parseFunctionBodyAndFinish(node, bodilessType, isMethod);
|
|
28741
28750
|
}
|
|
28742
28751
|
this.tsDisallowOptionalPattern(node);
|
|
@@ -28748,7 +28757,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
28748
28757
|
}
|
|
28749
28758
|
tsCheckForInvalidTypeCasts(items) {
|
|
28750
28759
|
items.forEach((node) => {
|
|
28751
|
-
if (node?.type === "TSTypeCastExpression") this.raise(TSErrors
|
|
28760
|
+
if (node?.type === "TSTypeCastExpression") this.raise(TSErrors.UnexpectedTypeAnnotation, node.typeAnnotation);
|
|
28752
28761
|
});
|
|
28753
28762
|
}
|
|
28754
28763
|
toReferencedList(exprList, isInParens) {
|
|
@@ -28817,7 +28826,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
28817
28826
|
if (missingParenErrorLoc) this.unexpected(missingParenErrorLoc, 6);
|
|
28818
28827
|
if (result) {
|
|
28819
28828
|
if (result.type === "TSInstantiationExpression") {
|
|
28820
|
-
if (this.match(12) || this.match(14) && this.lookaheadCharCode() !== 40) this.raise(TSErrors
|
|
28829
|
+
if (this.match(12) || this.match(14) && this.lookaheadCharCode() !== 40) this.raise(TSErrors.InvalidPropertyAccessAfterInstantiationExpression, this.state.startLoc);
|
|
28821
28830
|
if (!this.match(12) && !this.match(14)) result.expression = super.stopParseSubscript(base, state);
|
|
28822
28831
|
}
|
|
28823
28832
|
return result;
|
|
@@ -28841,7 +28850,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
28841
28850
|
node.typeAnnotation = this.tsInType(() => {
|
|
28842
28851
|
this.next();
|
|
28843
28852
|
if (this.match(71)) {
|
|
28844
|
-
if (isSatisfies) this.raise(Errors
|
|
28853
|
+
if (isSatisfies) this.raise(Errors.UnexpectedKeyword, this.state.startLoc, { keyword: "const" });
|
|
28845
28854
|
return this.tsParseTypeReference();
|
|
28846
28855
|
}
|
|
28847
28856
|
return this.tsParseType();
|
|
@@ -28872,24 +28881,24 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
28872
28881
|
parseImport(node) {
|
|
28873
28882
|
if (this.match(130)) {
|
|
28874
28883
|
node.importKind = "value";
|
|
28875
|
-
if (this.scope.inTSNamespace) this.raise(TSErrors
|
|
28884
|
+
if (this.scope.inTSNamespace) this.raise(TSErrors.ImportInTSNamespace, node);
|
|
28876
28885
|
return super.parseImport(node);
|
|
28877
28886
|
}
|
|
28878
28887
|
let importNode;
|
|
28879
28888
|
if (tokenIsIdentifier(this.state.type) && this.lookaheadCharCode() === 61) {
|
|
28880
28889
|
node.importKind = "value";
|
|
28881
28890
|
const result = this.tsParseImportEqualsDeclaration(node);
|
|
28882
|
-
if (this.scope.inTSNamespace && result.moduleReference.type === "TSExternalModuleReference") this.raise(TSErrors
|
|
28891
|
+
if (this.scope.inTSNamespace && result.moduleReference.type === "TSExternalModuleReference") this.raise(TSErrors.ImportInTSNamespace, node);
|
|
28883
28892
|
return result;
|
|
28884
28893
|
} else if (this.isContextual(126)) {
|
|
28885
28894
|
const maybeDefaultIdentifier = this.parseMaybeImportPhase(node, false);
|
|
28886
28895
|
if (this.lookaheadCharCode() === 61) {
|
|
28887
|
-
if (this.scope.inTSNamespace) this.raise(TSErrors
|
|
28896
|
+
if (this.scope.inTSNamespace) this.raise(TSErrors.ImportInTSNamespace, node);
|
|
28888
28897
|
return this.tsParseImportEqualsDeclaration(node, maybeDefaultIdentifier);
|
|
28889
28898
|
} else importNode = super.parseImportSpecifiersAndAfter(node, maybeDefaultIdentifier);
|
|
28890
28899
|
} else importNode = super.parseImport(node);
|
|
28891
|
-
if (importNode.importKind === "type" && importNode.specifiers.length > 1 && importNode.specifiers[0].type === "ImportDefaultSpecifier") this.raise(TSErrors
|
|
28892
|
-
else if (this.scope.inTSNamespace) this.raise(TSErrors
|
|
28900
|
+
if (importNode.importKind === "type" && importNode.specifiers.length > 1 && importNode.specifiers[0].type === "ImportDefaultSpecifier") this.raise(TSErrors.TypeImportCannotSpecifyDefaultAndNamed, importNode);
|
|
28901
|
+
else if (this.scope.inTSNamespace) this.raise(TSErrors.ImportInTSNamespace, importNode);
|
|
28893
28902
|
return importNode;
|
|
28894
28903
|
}
|
|
28895
28904
|
parseExport(node, decorators) {
|
|
@@ -28911,7 +28920,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
28911
28920
|
assign.expression = super.parseExpression();
|
|
28912
28921
|
this.semicolon();
|
|
28913
28922
|
this.sawUnambiguousESM = true;
|
|
28914
|
-
if (this.scope.inTSNamespace) this.raise(TSErrors
|
|
28923
|
+
if (this.scope.inTSNamespace) this.raise(TSErrors.ExportAssignmentInTSNamespace, assign);
|
|
28915
28924
|
return this.finishNode(assign, "TSExportAssignment");
|
|
28916
28925
|
} else if (this.eatContextual(89)) {
|
|
28917
28926
|
const decl = node;
|
|
@@ -28919,11 +28928,11 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
28919
28928
|
decl.id = this.parseIdentifier();
|
|
28920
28929
|
this.checkIdentifier(decl.id, 8201);
|
|
28921
28930
|
this.semicolon();
|
|
28922
|
-
if (this.scope.inTSNamespace) this.raise(TSErrors
|
|
28931
|
+
if (this.scope.inTSNamespace) this.raise(TSErrors.NamespaceExportInTSNamespace, decl);
|
|
28923
28932
|
return this.finishNode(decl, "TSNamespaceExportDeclaration");
|
|
28924
28933
|
} else {
|
|
28925
28934
|
const result = super.parseExport(node, decorators);
|
|
28926
|
-
if (this.scope.inTSNamespace && (result.type !== "ExportNamedDeclaration" || result.source || !result.declaration && !this.state.isAmbientContext)) this.raise(TSErrors
|
|
28935
|
+
if (this.scope.inTSNamespace && (result.type !== "ExportNamedDeclaration" || result.source || !result.declaration && !this.state.isAmbientContext)) this.raise(TSErrors.ExportInTSNamespace, result);
|
|
28927
28936
|
return result;
|
|
28928
28937
|
}
|
|
28929
28938
|
}
|
|
@@ -28948,13 +28957,13 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
28948
28957
|
const declaration = super.parseVarStatement(node, kind, allowMissingInitializer || isAmbientContext);
|
|
28949
28958
|
if (!isAmbientContext) return declaration;
|
|
28950
28959
|
if (!node.declare && (kind === "using" || kind === "await using")) {
|
|
28951
|
-
this.raiseOverwrite(TSErrors
|
|
28960
|
+
this.raiseOverwrite(TSErrors.UsingDeclarationInAmbientContext, node, kind);
|
|
28952
28961
|
return declaration;
|
|
28953
28962
|
}
|
|
28954
28963
|
for (const { id, init } of declaration.declarations) {
|
|
28955
28964
|
if (!init) continue;
|
|
28956
|
-
if (kind === "var" || kind === "let" || !!id.typeAnnotation) this.raise(TSErrors
|
|
28957
|
-
else if (!isValidAmbientConstInitializer(init, this.hasPlugin("estree"))) this.raise(TSErrors
|
|
28965
|
+
if (kind === "var" || kind === "let" || !!id.typeAnnotation) this.raise(TSErrors.InitializerNotAllowedInAmbientContext, init);
|
|
28966
|
+
else if (!isValidAmbientConstInitializer(init, this.hasPlugin("estree"))) this.raise(TSErrors.ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference, init);
|
|
28958
28967
|
}
|
|
28959
28968
|
return declaration;
|
|
28960
28969
|
}
|
|
@@ -28995,7 +29004,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
28995
29004
|
case 125: {
|
|
28996
29005
|
const result = this.tsParseInterfaceDeclaration(this.startNode());
|
|
28997
29006
|
if (result) {
|
|
28998
|
-
if (!allowDeclaration) this.raise(TSErrors
|
|
29007
|
+
if (!allowDeclaration) this.raise(TSErrors.UnexpectedTypeDeclaration, result, "interface");
|
|
28999
29008
|
return result;
|
|
29000
29009
|
}
|
|
29001
29010
|
break;
|
|
@@ -29006,7 +29015,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
29006
29015
|
this.next();
|
|
29007
29016
|
return this.tsParseDeclaration(node, 123, false, decorators);
|
|
29008
29017
|
} else if (this.nextTokenIsIdentifierOnSameLine()) {
|
|
29009
|
-
this.raise(TSErrors
|
|
29018
|
+
this.raise(TSErrors.InlineModuleDeclarationMustUseString, this.state.startLoc);
|
|
29010
29019
|
const node = this.startNode();
|
|
29011
29020
|
this.next();
|
|
29012
29021
|
return this.tsParseDeclaration(node, 124, false, decorators);
|
|
@@ -29022,7 +29031,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
29022
29031
|
case 126:
|
|
29023
29032
|
if (this.nextTokenIsIdentifierOnSameLine()) {
|
|
29024
29033
|
const node = this.startNode();
|
|
29025
|
-
if (!allowDeclaration) this.raise(TSErrors
|
|
29034
|
+
if (!allowDeclaration) this.raise(TSErrors.UnexpectedTypeDeclaration, node, "type");
|
|
29026
29035
|
this.next();
|
|
29027
29036
|
return this.tsParseTypeAliasDeclaration(node);
|
|
29028
29037
|
}
|
|
@@ -29061,39 +29070,43 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
29061
29070
|
allowedModifiers: modifiers,
|
|
29062
29071
|
disallowedModifiers: ["in", "out"],
|
|
29063
29072
|
stopOnStartOfClassStaticBlock: true,
|
|
29064
|
-
errorTemplate: TSErrors
|
|
29073
|
+
errorTemplate: TSErrors.InvalidModifierOnTypeParameterPositions
|
|
29065
29074
|
}, member);
|
|
29066
29075
|
const callParseClassMemberWithIsStatic = () => {
|
|
29067
29076
|
if (this.tsIsStartOfStaticBlocks()) {
|
|
29068
29077
|
this.next();
|
|
29069
29078
|
this.next();
|
|
29070
|
-
if (this.tsHasSomeModifiers(member, modifiers)) this.raise(TSErrors
|
|
29079
|
+
if (this.tsHasSomeModifiers(member, modifiers)) this.raise(TSErrors.StaticBlockCannotHaveModifier, this.state.curPosition());
|
|
29071
29080
|
super.parseClassStaticBlock(classBody, member);
|
|
29072
29081
|
} else this.parseClassMemberWithIsStatic(classBody, member, state, !!member.static);
|
|
29073
29082
|
};
|
|
29074
29083
|
if (member.declare) this.tsInAmbientContext(callParseClassMemberWithIsStatic);
|
|
29075
29084
|
else callParseClassMemberWithIsStatic();
|
|
29085
|
+
if (member.decorators && member.decorators.length > 0 && !this.hasPlugin("decorators-legacy")) {
|
|
29086
|
+
if (member.type === "TSAbstractMethodDefinition" || member.type === "TSDeclareMethod") this.raise(TSErrors.DecoratorAbstractMethod, member, { kind: "abstract method" });
|
|
29087
|
+
else if (member.type === "ClassProperty" && member.abstract || member.type === "ClassProperty" && member.declare || member.type === "TSAbstractPropertyDefinition" || member.type === "PropertyDefinition" && member.declare) this.raise(TSErrors.DecoratorAbstractMethod, member, { kind: member.declare ? "declare field" : "abstract field" });
|
|
29088
|
+
}
|
|
29076
29089
|
}
|
|
29077
29090
|
parseClassMemberWithIsStatic(classBody, member, state, isStatic) {
|
|
29078
29091
|
const idx = this.tsTryParseIndexSignature(member);
|
|
29079
29092
|
if (idx) {
|
|
29080
29093
|
classBody.body.push(idx);
|
|
29081
|
-
if (member.abstract) this.raise(TSErrors
|
|
29082
|
-
if (member.accessibility) this.raise(TSErrors
|
|
29083
|
-
if (member.declare) this.raise(TSErrors
|
|
29084
|
-
if (member.override) this.raise(TSErrors
|
|
29094
|
+
if (member.abstract) this.raise(TSErrors.IndexSignatureHasAbstract, member);
|
|
29095
|
+
if (member.accessibility) this.raise(TSErrors.IndexSignatureHasAccessibility, member, { modifier: member.accessibility });
|
|
29096
|
+
if (member.declare) this.raise(TSErrors.IndexSignatureHasDeclare, member);
|
|
29097
|
+
if (member.override) this.raise(TSErrors.IndexSignatureHasOverride, member);
|
|
29085
29098
|
return;
|
|
29086
29099
|
}
|
|
29087
|
-
if (!this.state.inAbstractClass && member.abstract) this.raise(TSErrors
|
|
29100
|
+
if (!this.state.inAbstractClass && member.abstract) this.raise(TSErrors.NonAbstractClassHasAbstractMethod, member);
|
|
29088
29101
|
if (member.override) {
|
|
29089
|
-
if (!state.hadSuperClass) this.raise(TSErrors
|
|
29102
|
+
if (!state.hadSuperClass) this.raise(TSErrors.OverrideNotInSubClass, member);
|
|
29090
29103
|
}
|
|
29091
29104
|
super.parseClassMemberWithIsStatic(classBody, member, state, isStatic);
|
|
29092
29105
|
}
|
|
29093
29106
|
parsePostMemberNameModifiers(methodOrProp) {
|
|
29094
29107
|
if (this.eat(13)) methodOrProp.optional = true;
|
|
29095
|
-
if (methodOrProp.readonly && this.match(6)) this.raise(TSErrors
|
|
29096
|
-
if (methodOrProp.declare && this.match(6)) this.raise(TSErrors
|
|
29108
|
+
if (methodOrProp.readonly && this.match(6)) this.raise(TSErrors.ClassMethodHasReadonly, methodOrProp);
|
|
29109
|
+
if (methodOrProp.declare && this.match(6)) this.raise(TSErrors.ClassMethodHasDeclare, methodOrProp);
|
|
29097
29110
|
}
|
|
29098
29111
|
shouldParseExportDeclaration() {
|
|
29099
29112
|
if (this.tsIsDeclarationStart()) return true;
|
|
@@ -29137,7 +29150,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
29137
29150
|
if (!this.state.isAmbientContext && this.isContextual(121)) return this.tsInAmbientContext(() => this.parseExportDeclaration(node));
|
|
29138
29151
|
const startLoc = this.state.startLoc;
|
|
29139
29152
|
const isDeclare = this.eatContextual(121);
|
|
29140
|
-
if (isDeclare && (this.isContextual(121) || !this.shouldParseExportDeclaration())) throw this.raise(TSErrors
|
|
29153
|
+
if (isDeclare && (this.isContextual(121) || !this.shouldParseExportDeclaration())) throw this.raise(TSErrors.ExpectedAmbientAfterExportDeclare, this.state.startLoc);
|
|
29141
29154
|
const declaration = tokenIsIdentifier(this.state.type) && this.tsTryParseExportDeclaration() || super.parseExportDeclaration(node);
|
|
29142
29155
|
if (!declaration) return null;
|
|
29143
29156
|
if (declaration.type === "TSInterfaceDeclaration" || declaration.type === "TSTypeAliasDeclaration" || isDeclare) node.exportKind = "type";
|
|
@@ -29166,29 +29179,29 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
29166
29179
|
}
|
|
29167
29180
|
parseClassProperty(node) {
|
|
29168
29181
|
this.parseClassPropertyAnnotation(node);
|
|
29169
|
-
if (this.state.isAmbientContext && !(node.readonly && !node.typeAnnotation) && this.match(25)) this.raise(TSErrors
|
|
29182
|
+
if (this.state.isAmbientContext && !(node.readonly && !node.typeAnnotation) && this.match(25)) this.raise(TSErrors.DeclareClassFieldHasInitializer, this.state.startLoc);
|
|
29170
29183
|
if (node.abstract && this.match(25)) {
|
|
29171
29184
|
const { key } = node;
|
|
29172
|
-
this.raise(TSErrors
|
|
29185
|
+
this.raise(TSErrors.AbstractPropertyHasInitializer, this.state.startLoc, { propertyName: key.type === "Identifier" && !node.computed ? key.name : `[${this.input.slice(this.offsetToSourcePos(key.start), this.offsetToSourcePos(key.end))}]` });
|
|
29173
29186
|
}
|
|
29174
29187
|
return super.parseClassProperty(node);
|
|
29175
29188
|
}
|
|
29176
29189
|
parseClassPrivateProperty(node) {
|
|
29177
|
-
if (node.abstract) this.raise(TSErrors
|
|
29178
|
-
if (node.accessibility) this.raise(TSErrors
|
|
29190
|
+
if (node.abstract) this.raise(TSErrors.PrivateElementHasAbstract, node);
|
|
29191
|
+
if (node.accessibility) this.raise(TSErrors.PrivateElementHasAccessibility, node, { modifier: node.accessibility });
|
|
29179
29192
|
this.parseClassPropertyAnnotation(node);
|
|
29180
29193
|
return super.parseClassPrivateProperty(node);
|
|
29181
29194
|
}
|
|
29182
29195
|
parseClassAccessorProperty(node) {
|
|
29183
29196
|
this.parseClassPropertyAnnotation(node);
|
|
29184
|
-
if (node.optional) this.raise(TSErrors
|
|
29197
|
+
if (node.optional) this.raise(TSErrors.AccessorCannotBeOptional, node);
|
|
29185
29198
|
return super.parseClassAccessorProperty(node);
|
|
29186
29199
|
}
|
|
29187
29200
|
pushClassMethod(classBody, method, isGenerator, isAsync, isConstructor, allowsDirectSuper) {
|
|
29188
29201
|
const typeParameters = this.tsTryParseTypeParameters(this.tsParseConstModifier);
|
|
29189
|
-
if (typeParameters && isConstructor) this.raise(TSErrors
|
|
29202
|
+
if (typeParameters && isConstructor) this.raise(TSErrors.ConstructorHasTypeParameters, typeParameters);
|
|
29190
29203
|
const { declare = false, kind } = method;
|
|
29191
|
-
if (declare && (kind === "get" || kind === "set")) this.raise(TSErrors
|
|
29204
|
+
if (declare && (kind === "get" || kind === "set")) this.raise(TSErrors.DeclareAccessor, method, { kind });
|
|
29192
29205
|
if (typeParameters) method.typeParameters = typeParameters;
|
|
29193
29206
|
super.pushClassMethod(classBody, method, isGenerator, isAsync, isConstructor, allowsDirectSuper);
|
|
29194
29207
|
}
|
|
@@ -29250,7 +29263,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
29250
29263
|
if (!jsx.error) return jsx.node;
|
|
29251
29264
|
const { context } = this.state;
|
|
29252
29265
|
const currentContext = context[context.length - 1];
|
|
29253
|
-
if (currentContext === types
|
|
29266
|
+
if (currentContext === types.j_oTag || currentContext === types.j_expr) context.pop();
|
|
29254
29267
|
}
|
|
29255
29268
|
if (!jsx?.error && !this.match(43)) return super.parseMaybeAssign(refExpressionErrors, afterLeftParse);
|
|
29256
29269
|
if (!state || state === this.state) state = this.state.clone();
|
|
@@ -29263,7 +29276,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
29263
29276
|
expr.typeParameters = typeParameters;
|
|
29264
29277
|
if (this.hasPlugin("jsx") && expr.typeParameters.params.length === 1 && !expr.typeParameters.extra?.trailingComma) {
|
|
29265
29278
|
const parameter = expr.typeParameters.params[0];
|
|
29266
|
-
if (!parameter.constraint) this.raise(TSErrors
|
|
29279
|
+
if (!parameter.constraint) this.raise(TSErrors.SingleTypeParameterWithoutTrailingComma, this.optionFlags & 256 ? createPositionWithColumnOffset(parameter.loc.end, 1) : parameter, { typeParameterName: parameter.name.name });
|
|
29267
29280
|
}
|
|
29268
29281
|
return expr;
|
|
29269
29282
|
}, state);
|
|
@@ -29292,7 +29305,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
29292
29305
|
throw jsx?.error || arrow.error || typeCast?.error;
|
|
29293
29306
|
}
|
|
29294
29307
|
reportReservedArrowTypeParam(node) {
|
|
29295
|
-
if (node.params.length === 1 && !node.params[0].constraint && !node.extra?.trailingComma && this.getPluginOption("typescript", "disallowAmbiguousJSXLike")) this.raise(TSErrors
|
|
29308
|
+
if (node.params.length === 1 && !node.params[0].constraint && !node.extra?.trailingComma && this.getPluginOption("typescript", "disallowAmbiguousJSXLike")) this.raise(TSErrors.ReservedArrowTypeParam, node);
|
|
29296
29309
|
}
|
|
29297
29310
|
parseMaybeUnary(refExpressionErrors, sawUnary) {
|
|
29298
29311
|
if (!this.hasPlugin("jsx") && this.match(43)) return this.tsParseTypeAssertion();
|
|
@@ -29336,8 +29349,8 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
29336
29349
|
case "TSSatisfiesExpression":
|
|
29337
29350
|
case "TSNonNullExpression":
|
|
29338
29351
|
case "TSTypeAssertion":
|
|
29339
|
-
if (isLHS) this.expressionScope.recordArrowParameterBindingError(TSErrors
|
|
29340
|
-
else this.raise(TSErrors
|
|
29352
|
+
if (isLHS) this.expressionScope.recordArrowParameterBindingError(TSErrors.UnexpectedTypeCastInParameter, node);
|
|
29353
|
+
else this.raise(TSErrors.UnexpectedTypeCastInParameter, node);
|
|
29341
29354
|
this.toAssignable(node.expression, isLHS);
|
|
29342
29355
|
break;
|
|
29343
29356
|
case "AssignmentExpression": if (!isLHS && node.left.type === "TSTypeCastExpression") node.left = this.typeCastToParameter(node.left);
|
|
@@ -29409,7 +29422,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
29409
29422
|
}
|
|
29410
29423
|
parseMaybeDefault(startLoc, left) {
|
|
29411
29424
|
const node = super.parseMaybeDefault(startLoc, left);
|
|
29412
|
-
if (node.type === "AssignmentPattern" && node.typeAnnotation && node.right.start < node.typeAnnotation.start) this.raise(TSErrors
|
|
29425
|
+
if (node.type === "AssignmentPattern" && node.typeAnnotation && node.right.start < node.typeAnnotation.start) this.raise(TSErrors.TypeAnnotationAfterAssign, node.typeAnnotation);
|
|
29413
29426
|
return node;
|
|
29414
29427
|
}
|
|
29415
29428
|
getTokenFromCode(code) {
|
|
@@ -29522,7 +29535,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
29522
29535
|
return this.maybeTakeDecorators(decorators, this.parseClass(node, true, false));
|
|
29523
29536
|
} else if (this.isContextual(125)) if (!this.hasFollowingLineBreak()) {
|
|
29524
29537
|
node.abstract = true;
|
|
29525
|
-
this.raise(TSErrors
|
|
29538
|
+
this.raise(TSErrors.NonClassMethodPropertyHasAbstractModifier, node);
|
|
29526
29539
|
return this.tsParseInterfaceDeclaration(node);
|
|
29527
29540
|
} else return null;
|
|
29528
29541
|
throw this.unexpected(null, 76);
|
|
@@ -29532,7 +29545,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
29532
29545
|
if (method.abstract || method.type === "TSAbstractMethodDefinition") {
|
|
29533
29546
|
if ((this.hasPlugin("estree") ? method.value : method).body) {
|
|
29534
29547
|
const { key } = method;
|
|
29535
|
-
this.raise(TSErrors
|
|
29548
|
+
this.raise(TSErrors.AbstractMethodHasImplementation, method, { methodName: key.type === "Identifier" && !method.computed ? key.name : `[${this.input.slice(this.offsetToSourcePos(key.start), this.offsetToSourcePos(key.end))}]` });
|
|
29536
29549
|
}
|
|
29537
29550
|
}
|
|
29538
29551
|
return method;
|
|
@@ -29602,7 +29615,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
29602
29615
|
if (!this.isContextual(89)) this.checkReservedWord(leftOfAs.name, leftOfAs.start, true, true);
|
|
29603
29616
|
} else leftOfAs = this.parseModuleExportName();
|
|
29604
29617
|
}
|
|
29605
|
-
if (hasTypeSpecifier && isInTypeOnlyImportExport) this.raise(isImport ? TSErrors
|
|
29618
|
+
if (hasTypeSpecifier && isInTypeOnlyImportExport) this.raise(isImport ? TSErrors.TypeModifierIsUsedInTypeImports : TSErrors.TypeModifierIsUsedInTypeExports, loc);
|
|
29606
29619
|
node[leftOfAsKey] = leftOfAs;
|
|
29607
29620
|
node[rightOfAsKey] = rightOfAs;
|
|
29608
29621
|
const kindKey = isImport ? "importKind" : "exportKind";
|
|
@@ -29772,7 +29785,7 @@ function isUncomputedMemberExpressionChain(expression) {
|
|
|
29772
29785
|
if (expression.type !== "MemberExpression" || expression.computed) return false;
|
|
29773
29786
|
return isUncomputedMemberExpressionChain(expression.object);
|
|
29774
29787
|
}
|
|
29775
|
-
const PlaceholderErrors
|
|
29788
|
+
const PlaceholderErrors = ParseErrorEnum`placeholders`({
|
|
29776
29789
|
ClassNameIsRequired: "A class name is required.",
|
|
29777
29790
|
UnexpectedSpace: "Unexpected space in placeholder."
|
|
29778
29791
|
});
|
|
@@ -29866,7 +29879,7 @@ const placeholders = (superClass) => class PlaceholdersParserMixin extends super
|
|
|
29866
29879
|
node.id = null;
|
|
29867
29880
|
node.body = this.finishPlaceholder(placeholder, "ClassBody");
|
|
29868
29881
|
return this.finishNode(node, type);
|
|
29869
|
-
} else throw this.raise(PlaceholderErrors
|
|
29882
|
+
} else throw this.raise(PlaceholderErrors.ClassNameIsRequired, this.state.startLoc);
|
|
29870
29883
|
else this.parseClassId(node, isStatement, optionalId);
|
|
29871
29884
|
super.parseClassSuper(node);
|
|
29872
29885
|
node.body = this.parsePlaceholder("ClassBody") || super.parseClassBody(!!node.superClass, oldStrict);
|
|
@@ -29931,7 +29944,7 @@ const placeholders = (superClass) => class PlaceholdersParserMixin extends super
|
|
|
29931
29944
|
return this.parsePlaceholder("StringLiteral") || super.parseImportSource();
|
|
29932
29945
|
}
|
|
29933
29946
|
assertNoSpace() {
|
|
29934
|
-
if (this.state.start > this.offsetToSourcePos(this.state.lastTokEndLoc.index)) this.raise(PlaceholderErrors
|
|
29947
|
+
if (this.state.start > this.offsetToSourcePos(this.state.lastTokEndLoc.index)) this.raise(PlaceholderErrors.UnexpectedSpace, this.state.lastTokEndLoc);
|
|
29935
29948
|
}
|
|
29936
29949
|
};
|
|
29937
29950
|
const v8intrinsic = (superClass) => class V8IntrinsicMixin extends superClass {
|
|
@@ -30073,12 +30086,12 @@ function parse$1(input, options) {
|
|
|
30073
30086
|
}
|
|
30074
30087
|
} else return getParser(options, input).parse();
|
|
30075
30088
|
}
|
|
30076
|
-
function generateExportedTokenTypes
|
|
30089
|
+
function generateExportedTokenTypes(internalTokenTypes) {
|
|
30077
30090
|
const tokenTypes = {};
|
|
30078
|
-
for (const typeName of Object.keys(internalTokenTypes)) tokenTypes[typeName] = getExportedToken
|
|
30091
|
+
for (const typeName of Object.keys(internalTokenTypes)) tokenTypes[typeName] = getExportedToken(internalTokenTypes[typeName]);
|
|
30079
30092
|
return tokenTypes;
|
|
30080
30093
|
}
|
|
30081
|
-
generateExportedTokenTypes
|
|
30094
|
+
generateExportedTokenTypes(tt);
|
|
30082
30095
|
function getParser(options, input) {
|
|
30083
30096
|
let cls = Parser;
|
|
30084
30097
|
const pluginsMap = /* @__PURE__ */ new Map();
|
|
@@ -30108,816 +30121,6 @@ function getParserClass(pluginsMap) {
|
|
|
30108
30121
|
return cls;
|
|
30109
30122
|
}
|
|
30110
30123
|
//#endregion
|
|
30111
|
-
//#region ../../node_modules/.pnpm/@babel+parser@8.0.0-rc.5/node_modules/@babel/parser/lib/index.js
|
|
30112
|
-
var Position = class {
|
|
30113
|
-
constructor(line, col, index) {
|
|
30114
|
-
this.line = void 0;
|
|
30115
|
-
this.column = void 0;
|
|
30116
|
-
if (index !== void 0) this.index = void 0;
|
|
30117
|
-
this.line = line;
|
|
30118
|
-
this.column = col;
|
|
30119
|
-
if (index !== void 0) this.index = index;
|
|
30120
|
-
}
|
|
30121
|
-
};
|
|
30122
|
-
var SourceLocation = class {
|
|
30123
|
-
start;
|
|
30124
|
-
end;
|
|
30125
|
-
filename;
|
|
30126
|
-
identifierName;
|
|
30127
|
-
constructor(start, end) {
|
|
30128
|
-
this.start = start;
|
|
30129
|
-
this.end = end;
|
|
30130
|
-
}
|
|
30131
|
-
};
|
|
30132
|
-
const code = "BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED";
|
|
30133
|
-
const ModuleErrors = {
|
|
30134
|
-
ImportMetaOutsideModule: {
|
|
30135
|
-
message: `import.meta may appear only with 'sourceType: "module"'`,
|
|
30136
|
-
code
|
|
30137
|
-
},
|
|
30138
|
-
ImportOutsideModule: {
|
|
30139
|
-
message: `'import' and 'export' may appear only with 'sourceType: "module"'`,
|
|
30140
|
-
code
|
|
30141
|
-
}
|
|
30142
|
-
};
|
|
30143
|
-
const NodeDescriptions = {
|
|
30144
|
-
ArrayPattern: "array destructuring pattern",
|
|
30145
|
-
AssignmentExpression: "assignment expression",
|
|
30146
|
-
AssignmentPattern: "assignment expression",
|
|
30147
|
-
ArrowFunctionExpression: "arrow function expression",
|
|
30148
|
-
ConditionalExpression: "conditional expression",
|
|
30149
|
-
CatchClause: "catch clause",
|
|
30150
|
-
ForOfStatement: "for-of statement",
|
|
30151
|
-
ForInStatement: "for-in statement",
|
|
30152
|
-
ForStatement: "for-loop",
|
|
30153
|
-
FormalParameters: "function parameter list",
|
|
30154
|
-
Identifier: "identifier",
|
|
30155
|
-
ImportSpecifier: "import specifier",
|
|
30156
|
-
ImportDefaultSpecifier: "import default specifier",
|
|
30157
|
-
ImportNamespaceSpecifier: "import namespace specifier",
|
|
30158
|
-
ObjectPattern: "object destructuring pattern",
|
|
30159
|
-
ParenthesizedExpression: "parenthesized expression",
|
|
30160
|
-
RestElement: "rest element",
|
|
30161
|
-
UpdateExpression: {
|
|
30162
|
-
true: "prefix operation",
|
|
30163
|
-
false: "postfix operation"
|
|
30164
|
-
},
|
|
30165
|
-
VariableDeclarator: "variable declaration",
|
|
30166
|
-
YieldExpression: "yield expression"
|
|
30167
|
-
};
|
|
30168
|
-
const toNodeDescription = (node) => node.type === "UpdateExpression" ? NodeDescriptions.UpdateExpression[`${node.prefix}`] : NodeDescriptions[node.type];
|
|
30169
|
-
const StandardErrors = {
|
|
30170
|
-
AccessorIsGenerator: ({ kind }) => `A ${kind}ter cannot be a generator.`,
|
|
30171
|
-
ArgumentsInClass: "'arguments' is only allowed in functions and class methods.",
|
|
30172
|
-
AsyncFunctionInSingleStatementContext: "Async functions can only be declared at the top level or inside a block.",
|
|
30173
|
-
AwaitBindingIdentifier: "Can not use 'await' as identifier inside an async function.",
|
|
30174
|
-
AwaitBindingIdentifierInStaticBlock: "Can not use 'await' as identifier inside a static block.",
|
|
30175
|
-
AwaitExpressionFormalParameter: "'await' is not allowed in async function parameters.",
|
|
30176
|
-
AwaitUsingNotInAsyncContext: "'await using' is only allowed within async functions and at the top levels of modules.",
|
|
30177
|
-
AwaitNotInAsyncContext: "'await' is only allowed within async functions and at the top levels of modules.",
|
|
30178
|
-
BadGetterArity: "A 'get' accessor must not have any formal parameters.",
|
|
30179
|
-
BadSetterArity: "A 'set' accessor must have exactly one formal parameter.",
|
|
30180
|
-
BadSetterRestParameter: "A 'set' accessor function argument must not be a rest parameter.",
|
|
30181
|
-
ConstructorClassField: "Classes may not have a field named 'constructor'.",
|
|
30182
|
-
ConstructorClassPrivateField: "Classes may not have a private field named '#constructor'.",
|
|
30183
|
-
ConstructorIsAccessor: "Class constructor may not be an accessor.",
|
|
30184
|
-
ConstructorIsAsync: "Constructor can't be an async function.",
|
|
30185
|
-
ConstructorIsGenerator: "Constructor can't be a generator.",
|
|
30186
|
-
DeclarationMissingInitializer: ({ kind }) => `Missing initializer in ${kind} declaration.`,
|
|
30187
|
-
DecoratorArgumentsOutsideParentheses: "Decorator arguments must be moved inside parentheses: use '@(decorator(args))' instead of '@(decorator)(args)'.",
|
|
30188
|
-
DecoratorsBeforeAfterExport: "Decorators can be placed *either* before or after the 'export' keyword, but not in both locations at the same time.",
|
|
30189
|
-
DecoratorConstructor: "Decorators can't be used with a constructor. Did you mean '@dec class { ... }'?",
|
|
30190
|
-
DecoratorSemicolon: "Decorators must not be followed by a semicolon.",
|
|
30191
|
-
DecoratorStaticBlock: "Decorators can't be used with a static block.",
|
|
30192
|
-
DeferImportRequiresNamespace: "Only `import defer * as x from \"./module\"` is valid.",
|
|
30193
|
-
DeletePrivateField: "Deleting a private field is not allowed.",
|
|
30194
|
-
DestructureNamedImport: "ES2015 named imports do not destructure. Use another statement for destructuring after the import.",
|
|
30195
|
-
DuplicateConstructor: "Duplicate constructor in the same class.",
|
|
30196
|
-
DuplicateDefaultExport: "Only one default export allowed per module.",
|
|
30197
|
-
DuplicateExport: ({ exportName }) => `\`${exportName}\` has already been exported. Exported identifiers must be unique.`,
|
|
30198
|
-
DuplicateProto: "Redefinition of __proto__ property.",
|
|
30199
|
-
DuplicateRegExpFlags: "Duplicate regular expression flag.",
|
|
30200
|
-
ElementAfterRest: "Rest element must be last element.",
|
|
30201
|
-
EscapedCharNotAnIdentifier: "Invalid Unicode escape.",
|
|
30202
|
-
ExportBindingIsString: ({ localName, exportName }) => `A string literal cannot be used as an exported binding without \`from\`.\n- Did you mean \`export { '${localName}' as '${exportName}' } from 'some-module'\`?`,
|
|
30203
|
-
ExportDefaultFromAsIdentifier: "'from' is not allowed as an identifier after 'export default'.",
|
|
30204
|
-
ForInOfLoopInitializer: ({ type }) => `'${type === "ForInStatement" ? "for-in" : "for-of"}' loop variable declaration may not have an initializer.`,
|
|
30205
|
-
ForInUsing: "For-in loop may not start with 'using' declaration.",
|
|
30206
|
-
ForOfAsync: "The left-hand side of a for-of loop may not be 'async'.",
|
|
30207
|
-
ForOfLet: "The left-hand side of a for-of loop may not start with 'let'.",
|
|
30208
|
-
GeneratorInSingleStatementContext: "Generators can only be declared at the top level or inside a block.",
|
|
30209
|
-
IllegalBreakContinue: ({ type }) => `Unsyntactic ${type === "BreakStatement" ? "break" : "continue"}.`,
|
|
30210
|
-
IllegalLanguageModeDirective: "Illegal 'use strict' directive in function with non-simple parameter list.",
|
|
30211
|
-
IllegalReturn: "'return' outside of function.",
|
|
30212
|
-
ImportBindingIsString: ({ importName }) => `A string literal cannot be used as an imported binding.\n- Did you mean \`import { "${importName}" as foo }\`?`,
|
|
30213
|
-
ImportCallArity: ({ phase }) => `\`import${phase ? `.${phase}` : ""}()\` requires exactly one or two arguments.`,
|
|
30214
|
-
ImportCallNotNewExpression: ({ phase }) => `Cannot use new with import${phase ? `.${phase}` : ""}().`,
|
|
30215
|
-
ImportCallSpreadArgument: ({ phase }) => `\`...\` is not allowed in \`import${phase ? `.${phase}` : ""}()\`.`,
|
|
30216
|
-
IncompatibleRegExpUVFlags: "The 'u' and 'v' regular expression flags cannot be enabled at the same time.",
|
|
30217
|
-
InvalidBigIntLiteral: "Invalid BigIntLiteral.",
|
|
30218
|
-
InvalidCodePoint: "Code point out of bounds.",
|
|
30219
|
-
InvalidCoverDiscardElement: "'void' must be followed by an expression when not used in a binding position.",
|
|
30220
|
-
InvalidCoverInitializedName: "Invalid shorthand property initializer.",
|
|
30221
|
-
InvalidDigit: ({ radix }) => `Expected number in radix ${radix}.`,
|
|
30222
|
-
InvalidEscapeSequence: "Bad character escape sequence.",
|
|
30223
|
-
InvalidEscapeSequenceTemplate: "Invalid escape sequence in template.",
|
|
30224
|
-
InvalidEscapedReservedWord: ({ reservedWord }) => `Escape sequence in keyword ${reservedWord}.`,
|
|
30225
|
-
InvalidIdentifier: ({ identifierName }) => `Invalid identifier ${identifierName}.`,
|
|
30226
|
-
InvalidLhs: ({ ancestor }) => `Invalid left-hand side in ${toNodeDescription(ancestor)}.`,
|
|
30227
|
-
InvalidLhsBinding: ({ ancestor }) => `Binding invalid left-hand side in ${toNodeDescription(ancestor)}.`,
|
|
30228
|
-
InvalidLhsOptionalChaining: ({ ancestor }) => `Invalid optional chaining in the left-hand side of ${toNodeDescription(ancestor)}.`,
|
|
30229
|
-
InvalidNumber: "Invalid number.",
|
|
30230
|
-
InvalidOrMissingExponent: "Floating-point numbers require a valid exponent after the 'e'.",
|
|
30231
|
-
InvalidOrUnexpectedToken: ({ unexpected }) => `Unexpected character '${unexpected}'.`,
|
|
30232
|
-
InvalidParenthesizedAssignment: "Invalid parenthesized assignment pattern.",
|
|
30233
|
-
InvalidPrivateFieldResolution: ({ identifierName }) => `Private name #${identifierName} is not defined.`,
|
|
30234
|
-
InvalidPropertyBindingPattern: "Binding member expression.",
|
|
30235
|
-
InvalidRestAssignmentPattern: "Invalid rest operator's argument.",
|
|
30236
|
-
LabelRedeclaration: ({ labelName }) => `Label '${labelName}' is already declared.`,
|
|
30237
|
-
LetInLexicalBinding: "'let' is disallowed as a lexically bound name.",
|
|
30238
|
-
LineTerminatorBeforeArrow: "No line break is allowed before '=>'.",
|
|
30239
|
-
MalformedRegExpFlags: "Invalid regular expression flag.",
|
|
30240
|
-
MissingClassName: "A class name is required.",
|
|
30241
|
-
MissingEqInAssignment: "Only '=' operator can be used for specifying default value.",
|
|
30242
|
-
MissingSemicolon: "Missing semicolon.",
|
|
30243
|
-
MissingPlugin: ({ missingPlugin }) => `This experimental syntax requires enabling the parser plugin: ${missingPlugin.map((name) => JSON.stringify(name)).join(", ")}.`,
|
|
30244
|
-
MissingOneOfPlugins: ({ missingPlugin }) => `This experimental syntax requires enabling one of the following parser plugin(s): ${missingPlugin.map((name) => JSON.stringify(name)).join(", ")}.`,
|
|
30245
|
-
MissingUnicodeEscape: "Expecting Unicode escape sequence \\uXXXX.",
|
|
30246
|
-
MixingCoalesceWithLogical: "Nullish coalescing operator(??) requires parens when mixing with logical operators.",
|
|
30247
|
-
ModuleAttributeInvalidValue: "Only string literals are allowed as module attribute values.",
|
|
30248
|
-
ModuleAttributesWithDuplicateKeys: ({ key }) => `Duplicate key "${key}" is not allowed in module attributes.`,
|
|
30249
|
-
ModuleExportNameHasLoneSurrogate: ({ surrogateCharCode }) => `An export name cannot include a lone surrogate, found '\\u${surrogateCharCode.toString(16)}'.`,
|
|
30250
|
-
ModuleExportUndefined: ({ localName }) => `Export '${localName}' is not defined.`,
|
|
30251
|
-
MultipleDefaultsInSwitch: "Multiple default clauses.",
|
|
30252
|
-
NewlineAfterThrow: "Illegal newline after throw.",
|
|
30253
|
-
NoCatchOrFinally: "Missing catch or finally clause.",
|
|
30254
|
-
NumberIdentifier: "Identifier directly after number.",
|
|
30255
|
-
NumericSeparatorInEscapeSequence: "Numeric separators are not allowed inside unicode escape sequences or hex escape sequences.",
|
|
30256
|
-
ObsoleteAwaitStar: "'await*' has been removed from the async functions proposal. Use Promise.all() instead.",
|
|
30257
|
-
OptionalChainingNoNew: "Constructors in/after an Optional Chain are not allowed.",
|
|
30258
|
-
OptionalChainingNoTemplate: "Tagged Template Literals are not allowed in optionalChain.",
|
|
30259
|
-
OverrideOnConstructor: "'override' modifier cannot appear on a constructor declaration.",
|
|
30260
|
-
ParamDupe: "Argument name clash.",
|
|
30261
|
-
PatternHasAccessor: "Object pattern can't contain getter or setter.",
|
|
30262
|
-
PatternHasMethod: "Object pattern can't contain methods.",
|
|
30263
|
-
PrivateInExpectedIn: ({ identifierName }) => `Private names are only allowed in property accesses (\`obj.#${identifierName}\`) or in \`in\` expressions (\`#${identifierName} in obj\`).`,
|
|
30264
|
-
PrivateNameRedeclaration: ({ identifierName }) => `Duplicate private name #${identifierName}.`,
|
|
30265
|
-
RestTrailingComma: "Unexpected trailing comma after rest element.",
|
|
30266
|
-
SloppyFunction: "In non-strict mode code, functions can only be declared at top level or inside a block.",
|
|
30267
|
-
SloppyFunctionAnnexB: "In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement.",
|
|
30268
|
-
SourcePhaseImportRequiresDefault: "Only `import source x from \"./module\"` is valid.",
|
|
30269
|
-
StaticPrototype: "Classes may not have static property named prototype.",
|
|
30270
|
-
SuperCallNotNewExpression: "Cannot use new with super(...).",
|
|
30271
|
-
SuperNotAllowed: "`super()` is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class?",
|
|
30272
|
-
SuperPrivateField: "Private fields can't be accessed on super.",
|
|
30273
|
-
TrailingDecorator: "Decorators must be attached to a class element.",
|
|
30274
|
-
UnexpectedArgumentPlaceholder: "Unexpected argument placeholder.",
|
|
30275
|
-
UnexpectedDigitAfterHash: "Unexpected digit after hash token.",
|
|
30276
|
-
UnexpectedImportExport: "'import' and 'export' may only appear at the top level.",
|
|
30277
|
-
UnexpectedKeyword: ({ keyword }) => `Unexpected keyword '${keyword}'.`,
|
|
30278
|
-
UnexpectedLeadingDecorator: "Leading decorators must be attached to a class declaration.",
|
|
30279
|
-
UnexpectedLexicalDeclaration: "Lexical declaration cannot appear in a single-statement context.",
|
|
30280
|
-
UnexpectedNewTarget: "`new.target` can only be used in functions or class properties.",
|
|
30281
|
-
UnexpectedNumericSeparator: "A numeric separator is only allowed between two digits.",
|
|
30282
|
-
UnexpectedPrivateField: "Unexpected private name.",
|
|
30283
|
-
UnexpectedReservedWord: ({ reservedWord }) => `Unexpected reserved word '${reservedWord}'.`,
|
|
30284
|
-
UnexpectedSuper: "'super' is only allowed in object methods and classes.",
|
|
30285
|
-
UnexpectedToken: ({ expected, unexpected }) => `Unexpected token${unexpected ? ` '${unexpected}'.` : ""}${expected ? `, expected "${expected}"` : ""}`,
|
|
30286
|
-
UnexpectedTokenUnaryExponentiation: "Illegal expression. Wrap left hand side or entire exponentiation in parentheses.",
|
|
30287
|
-
UnexpectedUsingDeclaration: "Using declaration cannot appear in the top level when source type is `script` or in the bare case statement.",
|
|
30288
|
-
UnexpectedVoidPattern: "Unexpected void binding.",
|
|
30289
|
-
UnsupportedDecoratorExport: "A decorated export must export a class declaration.",
|
|
30290
|
-
UnsupportedDefaultExport: "Only expressions, functions or classes are allowed as the `default` export.",
|
|
30291
|
-
UnsupportedImport: "`import` can only be used in `import()` or `import.meta`.",
|
|
30292
|
-
UnsupportedMetaProperty: ({ target, onlyValidPropertyName }) => `The only valid meta property for ${target} is ${target}.${onlyValidPropertyName}.`,
|
|
30293
|
-
UnsupportedParameterDecorator: "Decorators cannot be used to decorate parameters.",
|
|
30294
|
-
UnsupportedPropertyDecorator: "Decorators cannot be used to decorate object literal properties.",
|
|
30295
|
-
UnsupportedSuper: "'super' can only be used with function calls (i.e. super()) or in property accesses (i.e. super.prop or super[prop]).",
|
|
30296
|
-
UnterminatedComment: "Unterminated comment.",
|
|
30297
|
-
UnterminatedRegExp: "Unterminated regular expression.",
|
|
30298
|
-
UnterminatedString: "Unterminated string constant.",
|
|
30299
|
-
UnterminatedTemplate: "Unterminated template.",
|
|
30300
|
-
UsingDeclarationExport: "Using declaration cannot be exported.",
|
|
30301
|
-
UsingDeclarationHasBindingPattern: "Using declaration cannot have destructuring patterns.",
|
|
30302
|
-
VarRedeclaration: ({ identifierName }) => `Identifier '${identifierName}' has already been declared.`,
|
|
30303
|
-
VoidPatternCatchClauseParam: "A void binding can not be the catch clause parameter. Use `try { ... } catch { ... }` if you want to discard the caught error.",
|
|
30304
|
-
VoidPatternInitializer: "A void binding may not have an initializer.",
|
|
30305
|
-
YieldBindingIdentifier: "Can not use 'yield' as identifier inside a generator.",
|
|
30306
|
-
YieldInParameter: "Yield expression is not allowed in formal parameters.",
|
|
30307
|
-
YieldNotInGeneratorFunction: "'yield' is only allowed within generator functions.",
|
|
30308
|
-
ZeroDigitNumericSeparator: "Numeric separator can not be used after leading 0."
|
|
30309
|
-
};
|
|
30310
|
-
const StrictModeErrors = {
|
|
30311
|
-
StrictDelete: "Deleting local variable in strict mode.",
|
|
30312
|
-
StrictEvalArguments: ({ referenceName }) => `Assigning to '${referenceName}' in strict mode.`,
|
|
30313
|
-
StrictEvalArgumentsBinding: ({ bindingName }) => `Binding '${bindingName}' in strict mode.`,
|
|
30314
|
-
StrictFunction: "In strict mode code, functions can only be declared at top level or inside a block.",
|
|
30315
|
-
StrictNumericEscape: "The only valid numeric escape in strict mode is '\\0'.",
|
|
30316
|
-
StrictOctalLiteral: "Legacy octal literals are not allowed in strict mode.",
|
|
30317
|
-
StrictWith: "'with' in strict mode."
|
|
30318
|
-
};
|
|
30319
|
-
const ParseExpressionErrors = {
|
|
30320
|
-
ParseExpressionEmptyInput: "Unexpected parseExpression() input: The input is empty or contains only comments.",
|
|
30321
|
-
ParseExpressionExpectsEOF: ({ unexpected }) => `Unexpected parseExpression() input: The input should contain exactly one expression, but the first expression is followed by the unexpected character \`${String.fromCodePoint(unexpected)}\`.`
|
|
30322
|
-
};
|
|
30323
|
-
const PipelineOperatorErrors = {
|
|
30324
|
-
PipeTopicRequiresHackPipes: "Topic references are only supported when using the `\"proposal\": \"hack\"` version of the pipeline proposal.",
|
|
30325
|
-
PipeTopicUnbound: "Topic reference is unbound; it must be inside a pipe body.",
|
|
30326
|
-
PipeTopicUnconfiguredToken: ({ token }) => `Invalid topic token ${token}. In order to use ${token} as a topic reference, the pipelineOperator plugin must be configured with { "proposal": "hack", "topicToken": "${token}" }.`,
|
|
30327
|
-
PipeTopicUnused: "Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once.",
|
|
30328
|
-
PipeUnparenthesizedBody: ({ type }) => `Hack-style pipe body cannot be an unparenthesized ${toNodeDescription({ type })}; please wrap it in parentheses.`,
|
|
30329
|
-
PipelineUnparenthesized: "Cannot mix binary operator with solo-await F#-style pipeline. Please wrap the pipeline in parentheses."
|
|
30330
|
-
};
|
|
30331
|
-
const FunctionBindErrors = {
|
|
30332
|
-
UnsupportedBind: "Binding should be performed on object property.",
|
|
30333
|
-
UnsupportedBindRHS: "The right-hand side of binding can not be super or import."
|
|
30334
|
-
};
|
|
30335
|
-
function defineHidden(obj, key, value) {
|
|
30336
|
-
Object.defineProperty(obj, key, {
|
|
30337
|
-
enumerable: false,
|
|
30338
|
-
configurable: true,
|
|
30339
|
-
value
|
|
30340
|
-
});
|
|
30341
|
-
}
|
|
30342
|
-
function toParseErrorConstructor({ toMessage, code, reasonCode, syntaxPlugin }) {
|
|
30343
|
-
const hasMissingPlugin = reasonCode === "MissingPlugin" || reasonCode === "MissingOneOfPlugins";
|
|
30344
|
-
return function constructor(loc, pos, details) {
|
|
30345
|
-
const error = /* @__PURE__ */ new SyntaxError();
|
|
30346
|
-
error.code = code;
|
|
30347
|
-
error.reasonCode = reasonCode;
|
|
30348
|
-
error.loc = loc;
|
|
30349
|
-
error.pos = pos;
|
|
30350
|
-
error.syntaxPlugin = syntaxPlugin;
|
|
30351
|
-
if (hasMissingPlugin) error.missingPlugin = details.missingPlugin;
|
|
30352
|
-
defineHidden(error, "clone", function clone(overrides = {}) {
|
|
30353
|
-
const { line, column, index = pos } = overrides.loc ?? loc;
|
|
30354
|
-
return constructor(new Position(line, column), index, {
|
|
30355
|
-
...details,
|
|
30356
|
-
...overrides.details
|
|
30357
|
-
});
|
|
30358
|
-
});
|
|
30359
|
-
defineHidden(error, "details", details);
|
|
30360
|
-
Object.defineProperty(error, "message", {
|
|
30361
|
-
configurable: true,
|
|
30362
|
-
get() {
|
|
30363
|
-
const message = `${toMessage(details)} (${loc.line}:${loc.column})`;
|
|
30364
|
-
this.message = message;
|
|
30365
|
-
return message;
|
|
30366
|
-
},
|
|
30367
|
-
set(value) {
|
|
30368
|
-
Object.defineProperty(this, "message", {
|
|
30369
|
-
value,
|
|
30370
|
-
writable: true
|
|
30371
|
-
});
|
|
30372
|
-
}
|
|
30373
|
-
});
|
|
30374
|
-
return error;
|
|
30375
|
-
};
|
|
30376
|
-
}
|
|
30377
|
-
function ParseErrorEnum(argument, syntaxPlugin) {
|
|
30378
|
-
if (Array.isArray(argument)) return (parseErrorTemplates) => ParseErrorEnum(parseErrorTemplates, argument[0]);
|
|
30379
|
-
const ParseErrorConstructors = {};
|
|
30380
|
-
for (const reasonCode of Object.keys(argument)) {
|
|
30381
|
-
const template = argument[reasonCode];
|
|
30382
|
-
const { message, ...rest } = typeof template === "string" ? { message: () => template } : typeof template === "function" ? { message: template } : template;
|
|
30383
|
-
ParseErrorConstructors[reasonCode] = toParseErrorConstructor({
|
|
30384
|
-
code: "BABEL_PARSER_SYNTAX_ERROR",
|
|
30385
|
-
reasonCode,
|
|
30386
|
-
toMessage: typeof message === "string" ? () => message : message,
|
|
30387
|
-
...syntaxPlugin ? { syntaxPlugin } : {},
|
|
30388
|
-
...rest
|
|
30389
|
-
});
|
|
30390
|
-
}
|
|
30391
|
-
return ParseErrorConstructors;
|
|
30392
|
-
}
|
|
30393
|
-
({
|
|
30394
|
-
...ParseErrorEnum(ModuleErrors),
|
|
30395
|
-
...ParseErrorEnum(StandardErrors),
|
|
30396
|
-
...ParseErrorEnum(StrictModeErrors),
|
|
30397
|
-
...ParseErrorEnum(ParseExpressionErrors),
|
|
30398
|
-
...ParseErrorEnum`pipelineOperator`(PipelineOperatorErrors),
|
|
30399
|
-
...ParseErrorEnum`functionBind`(FunctionBindErrors)
|
|
30400
|
-
});
|
|
30401
|
-
const beforeExpr = true;
|
|
30402
|
-
const startsExpr = true;
|
|
30403
|
-
const isLoop = true;
|
|
30404
|
-
const isAssign = true;
|
|
30405
|
-
const prefix = true;
|
|
30406
|
-
const postfix = true;
|
|
30407
|
-
var ExportedTokenType = class {
|
|
30408
|
-
label;
|
|
30409
|
-
keyword;
|
|
30410
|
-
beforeExpr;
|
|
30411
|
-
startsExpr;
|
|
30412
|
-
rightAssociative;
|
|
30413
|
-
isLoop;
|
|
30414
|
-
isAssign;
|
|
30415
|
-
prefix;
|
|
30416
|
-
postfix;
|
|
30417
|
-
binop;
|
|
30418
|
-
constructor(label, conf = {}) {
|
|
30419
|
-
this.label = label;
|
|
30420
|
-
this.keyword = conf.keyword;
|
|
30421
|
-
this.beforeExpr = !!conf.beforeExpr;
|
|
30422
|
-
this.startsExpr = !!conf.startsExpr;
|
|
30423
|
-
this.rightAssociative = !!conf.rightAssociative;
|
|
30424
|
-
this.isLoop = !!conf.isLoop;
|
|
30425
|
-
this.isAssign = !!conf.isAssign;
|
|
30426
|
-
this.prefix = !!conf.prefix;
|
|
30427
|
-
this.postfix = !!conf.postfix;
|
|
30428
|
-
this.binop = conf.binop != null ? conf.binop : null;
|
|
30429
|
-
}
|
|
30430
|
-
};
|
|
30431
|
-
const keywords$1 = /* @__PURE__ */ new Map();
|
|
30432
|
-
function createKeyword(name, options = {}) {
|
|
30433
|
-
options.keyword = name;
|
|
30434
|
-
const token = createToken(name, options);
|
|
30435
|
-
keywords$1.set(name, token);
|
|
30436
|
-
return token;
|
|
30437
|
-
}
|
|
30438
|
-
function createBinop(name, binop) {
|
|
30439
|
-
return createToken(name, {
|
|
30440
|
-
beforeExpr,
|
|
30441
|
-
binop
|
|
30442
|
-
});
|
|
30443
|
-
}
|
|
30444
|
-
let tokenTypeCounter = -1;
|
|
30445
|
-
const tokenTypes = [];
|
|
30446
|
-
const tokenLabels = [];
|
|
30447
|
-
const tokenBinops = [];
|
|
30448
|
-
const tokenBeforeExprs = [];
|
|
30449
|
-
const tokenStartsExprs = [];
|
|
30450
|
-
const tokenPrefixes = [];
|
|
30451
|
-
function createToken(name, options = {}) {
|
|
30452
|
-
++tokenTypeCounter;
|
|
30453
|
-
tokenLabels.push(name);
|
|
30454
|
-
tokenBinops.push(options.binop ?? -1);
|
|
30455
|
-
tokenBeforeExprs.push(options.beforeExpr ?? false);
|
|
30456
|
-
tokenStartsExprs.push(options.startsExpr ?? false);
|
|
30457
|
-
tokenPrefixes.push(options.prefix ?? false);
|
|
30458
|
-
tokenTypes.push(new ExportedTokenType(name, options));
|
|
30459
|
-
return tokenTypeCounter;
|
|
30460
|
-
}
|
|
30461
|
-
function createKeywordLike(name, options = {}) {
|
|
30462
|
-
++tokenTypeCounter;
|
|
30463
|
-
keywords$1.set(name, tokenTypeCounter);
|
|
30464
|
-
tokenLabels.push(name);
|
|
30465
|
-
tokenBinops.push(options.binop ?? -1);
|
|
30466
|
-
tokenBeforeExprs.push(options.beforeExpr ?? false);
|
|
30467
|
-
tokenStartsExprs.push(options.startsExpr ?? false);
|
|
30468
|
-
tokenPrefixes.push(options.prefix ?? false);
|
|
30469
|
-
tokenTypes.push(new ExportedTokenType("name", options));
|
|
30470
|
-
return tokenTypeCounter;
|
|
30471
|
-
}
|
|
30472
|
-
const tt = {
|
|
30473
|
-
bracketL: createToken("[", {
|
|
30474
|
-
beforeExpr,
|
|
30475
|
-
startsExpr
|
|
30476
|
-
}),
|
|
30477
|
-
bracketR: createToken("]"),
|
|
30478
|
-
braceL: createToken("{", {
|
|
30479
|
-
beforeExpr,
|
|
30480
|
-
startsExpr
|
|
30481
|
-
}),
|
|
30482
|
-
braceBarL: createToken("{|", {
|
|
30483
|
-
beforeExpr,
|
|
30484
|
-
startsExpr
|
|
30485
|
-
}),
|
|
30486
|
-
braceR: createToken("}"),
|
|
30487
|
-
braceBarR: createToken("|}"),
|
|
30488
|
-
parenL: createToken("(", {
|
|
30489
|
-
beforeExpr,
|
|
30490
|
-
startsExpr
|
|
30491
|
-
}),
|
|
30492
|
-
parenR: createToken(")"),
|
|
30493
|
-
comma: createToken(",", { beforeExpr }),
|
|
30494
|
-
semi: createToken(";", { beforeExpr }),
|
|
30495
|
-
colon: createToken(":", { beforeExpr }),
|
|
30496
|
-
doubleColon: createToken("::", { beforeExpr }),
|
|
30497
|
-
dot: createToken("."),
|
|
30498
|
-
question: createToken("?", { beforeExpr }),
|
|
30499
|
-
questionDot: createToken("?."),
|
|
30500
|
-
arrow: createToken("=>", { beforeExpr }),
|
|
30501
|
-
template: createToken("template"),
|
|
30502
|
-
ellipsis: createToken("...", { beforeExpr }),
|
|
30503
|
-
backQuote: createToken("`", { startsExpr }),
|
|
30504
|
-
dollarBraceL: createToken("${", {
|
|
30505
|
-
beforeExpr,
|
|
30506
|
-
startsExpr
|
|
30507
|
-
}),
|
|
30508
|
-
templateTail: createToken("...`", { startsExpr }),
|
|
30509
|
-
templateNonTail: createToken("...${", {
|
|
30510
|
-
beforeExpr,
|
|
30511
|
-
startsExpr
|
|
30512
|
-
}),
|
|
30513
|
-
at: createToken("@"),
|
|
30514
|
-
hash: createToken("#", { startsExpr }),
|
|
30515
|
-
interpreterDirective: createToken("#!..."),
|
|
30516
|
-
eq: createToken("=", {
|
|
30517
|
-
beforeExpr,
|
|
30518
|
-
isAssign
|
|
30519
|
-
}),
|
|
30520
|
-
assign: createToken("_=", {
|
|
30521
|
-
beforeExpr,
|
|
30522
|
-
isAssign
|
|
30523
|
-
}),
|
|
30524
|
-
slashAssign: createToken("_=", {
|
|
30525
|
-
beforeExpr,
|
|
30526
|
-
isAssign
|
|
30527
|
-
}),
|
|
30528
|
-
xorAssign: createToken("_=", {
|
|
30529
|
-
beforeExpr,
|
|
30530
|
-
isAssign
|
|
30531
|
-
}),
|
|
30532
|
-
moduloAssign: createToken("_=", {
|
|
30533
|
-
beforeExpr,
|
|
30534
|
-
isAssign
|
|
30535
|
-
}),
|
|
30536
|
-
incDec: createToken("++/--", {
|
|
30537
|
-
prefix,
|
|
30538
|
-
postfix,
|
|
30539
|
-
startsExpr
|
|
30540
|
-
}),
|
|
30541
|
-
bang: createToken("!", {
|
|
30542
|
-
beforeExpr,
|
|
30543
|
-
prefix,
|
|
30544
|
-
startsExpr
|
|
30545
|
-
}),
|
|
30546
|
-
tilde: createToken("~", {
|
|
30547
|
-
beforeExpr,
|
|
30548
|
-
prefix,
|
|
30549
|
-
startsExpr
|
|
30550
|
-
}),
|
|
30551
|
-
doubleCaret: createToken("^^", { startsExpr }),
|
|
30552
|
-
doubleAt: createToken("@@", { startsExpr }),
|
|
30553
|
-
pipeline: createBinop("|>", 0),
|
|
30554
|
-
nullishCoalescing: createBinop("??", 1),
|
|
30555
|
-
logicalOR: createBinop("||", 1),
|
|
30556
|
-
logicalAND: createBinop("&&", 2),
|
|
30557
|
-
bitwiseOR: createBinop("|", 3),
|
|
30558
|
-
bitwiseXOR: createBinop("^", 4),
|
|
30559
|
-
bitwiseAND: createBinop("&", 5),
|
|
30560
|
-
equality: createBinop("==/!=/===/!==", 6),
|
|
30561
|
-
lt: createBinop("</>/<=/>=", 7),
|
|
30562
|
-
gt: createBinop("</>/<=/>=", 7),
|
|
30563
|
-
relational: createBinop("</>/<=/>=", 7),
|
|
30564
|
-
bitShift: createBinop("<</>>/>>>", 8),
|
|
30565
|
-
bitShiftL: createBinop("<</>>/>>>", 8),
|
|
30566
|
-
bitShiftR: createBinop("<</>>/>>>", 8),
|
|
30567
|
-
plusMin: createToken("+/-", {
|
|
30568
|
-
beforeExpr,
|
|
30569
|
-
binop: 9,
|
|
30570
|
-
prefix,
|
|
30571
|
-
startsExpr
|
|
30572
|
-
}),
|
|
30573
|
-
modulo: createToken("%", {
|
|
30574
|
-
binop: 10,
|
|
30575
|
-
startsExpr
|
|
30576
|
-
}),
|
|
30577
|
-
star: createToken("*", { binop: 10 }),
|
|
30578
|
-
slash: createBinop("/", 10),
|
|
30579
|
-
exponent: createToken("**", {
|
|
30580
|
-
beforeExpr,
|
|
30581
|
-
binop: 11,
|
|
30582
|
-
rightAssociative: true
|
|
30583
|
-
}),
|
|
30584
|
-
_in: createKeyword("in", {
|
|
30585
|
-
beforeExpr,
|
|
30586
|
-
binop: 7
|
|
30587
|
-
}),
|
|
30588
|
-
_instanceof: createKeyword("instanceof", {
|
|
30589
|
-
beforeExpr,
|
|
30590
|
-
binop: 7
|
|
30591
|
-
}),
|
|
30592
|
-
_break: createKeyword("break"),
|
|
30593
|
-
_case: createKeyword("case", { beforeExpr }),
|
|
30594
|
-
_catch: createKeyword("catch"),
|
|
30595
|
-
_continue: createKeyword("continue"),
|
|
30596
|
-
_debugger: createKeyword("debugger"),
|
|
30597
|
-
_default: createKeyword("default", { beforeExpr }),
|
|
30598
|
-
_else: createKeyword("else", { beforeExpr }),
|
|
30599
|
-
_finally: createKeyword("finally"),
|
|
30600
|
-
_function: createKeyword("function", { startsExpr }),
|
|
30601
|
-
_if: createKeyword("if"),
|
|
30602
|
-
_return: createKeyword("return", { beforeExpr }),
|
|
30603
|
-
_switch: createKeyword("switch"),
|
|
30604
|
-
_throw: createKeyword("throw", {
|
|
30605
|
-
beforeExpr,
|
|
30606
|
-
prefix,
|
|
30607
|
-
startsExpr
|
|
30608
|
-
}),
|
|
30609
|
-
_try: createKeyword("try"),
|
|
30610
|
-
_var: createKeyword("var"),
|
|
30611
|
-
_const: createKeyword("const"),
|
|
30612
|
-
_with: createKeyword("with"),
|
|
30613
|
-
_new: createKeyword("new", {
|
|
30614
|
-
beforeExpr,
|
|
30615
|
-
startsExpr
|
|
30616
|
-
}),
|
|
30617
|
-
_this: createKeyword("this", { startsExpr }),
|
|
30618
|
-
_super: createKeyword("super", { startsExpr }),
|
|
30619
|
-
_class: createKeyword("class", { startsExpr }),
|
|
30620
|
-
_extends: createKeyword("extends", { beforeExpr }),
|
|
30621
|
-
_export: createKeyword("export"),
|
|
30622
|
-
_import: createKeyword("import", { startsExpr }),
|
|
30623
|
-
_null: createKeyword("null", { startsExpr }),
|
|
30624
|
-
_true: createKeyword("true", { startsExpr }),
|
|
30625
|
-
_false: createKeyword("false", { startsExpr }),
|
|
30626
|
-
_typeof: createKeyword("typeof", {
|
|
30627
|
-
beforeExpr,
|
|
30628
|
-
prefix,
|
|
30629
|
-
startsExpr
|
|
30630
|
-
}),
|
|
30631
|
-
_void: createKeyword("void", {
|
|
30632
|
-
beforeExpr,
|
|
30633
|
-
prefix,
|
|
30634
|
-
startsExpr
|
|
30635
|
-
}),
|
|
30636
|
-
_delete: createKeyword("delete", {
|
|
30637
|
-
beforeExpr,
|
|
30638
|
-
prefix,
|
|
30639
|
-
startsExpr
|
|
30640
|
-
}),
|
|
30641
|
-
_do: createKeyword("do", {
|
|
30642
|
-
isLoop,
|
|
30643
|
-
beforeExpr
|
|
30644
|
-
}),
|
|
30645
|
-
_for: createKeyword("for", { isLoop }),
|
|
30646
|
-
_while: createKeyword("while", { isLoop }),
|
|
30647
|
-
_as: createKeywordLike("as", { startsExpr }),
|
|
30648
|
-
_assert: createKeywordLike("assert", { startsExpr }),
|
|
30649
|
-
_async: createKeywordLike("async", { startsExpr }),
|
|
30650
|
-
_await: createKeywordLike("await", { startsExpr }),
|
|
30651
|
-
_defer: createKeywordLike("defer", { startsExpr }),
|
|
30652
|
-
_from: createKeywordLike("from", { startsExpr }),
|
|
30653
|
-
_get: createKeywordLike("get", { startsExpr }),
|
|
30654
|
-
_let: createKeywordLike("let", { startsExpr }),
|
|
30655
|
-
_meta: createKeywordLike("meta", { startsExpr }),
|
|
30656
|
-
_of: createKeywordLike("of", { startsExpr }),
|
|
30657
|
-
_sent: createKeywordLike("sent", { startsExpr }),
|
|
30658
|
-
_set: createKeywordLike("set", { startsExpr }),
|
|
30659
|
-
_source: createKeywordLike("source", { startsExpr }),
|
|
30660
|
-
_static: createKeywordLike("static", { startsExpr }),
|
|
30661
|
-
_using: createKeywordLike("using", { startsExpr }),
|
|
30662
|
-
_yield: createKeywordLike("yield", { startsExpr }),
|
|
30663
|
-
_asserts: createKeywordLike("asserts", { startsExpr }),
|
|
30664
|
-
_checks: createKeywordLike("checks", { startsExpr }),
|
|
30665
|
-
_exports: createKeywordLike("exports", { startsExpr }),
|
|
30666
|
-
_global: createKeywordLike("global", { startsExpr }),
|
|
30667
|
-
_implements: createKeywordLike("implements", { startsExpr }),
|
|
30668
|
-
_intrinsic: createKeywordLike("intrinsic", { startsExpr }),
|
|
30669
|
-
_infer: createKeywordLike("infer", { startsExpr }),
|
|
30670
|
-
_is: createKeywordLike("is", { startsExpr }),
|
|
30671
|
-
_mixins: createKeywordLike("mixins", { startsExpr }),
|
|
30672
|
-
_proto: createKeywordLike("proto", { startsExpr }),
|
|
30673
|
-
_require: createKeywordLike("require", { startsExpr }),
|
|
30674
|
-
_satisfies: createKeywordLike("satisfies", { startsExpr }),
|
|
30675
|
-
_keyof: createKeywordLike("keyof", { startsExpr }),
|
|
30676
|
-
_readonly: createKeywordLike("readonly", { startsExpr }),
|
|
30677
|
-
_unique: createKeywordLike("unique", { startsExpr }),
|
|
30678
|
-
_abstract: createKeywordLike("abstract", { startsExpr }),
|
|
30679
|
-
_declare: createKeywordLike("declare", { startsExpr }),
|
|
30680
|
-
_enum: createKeywordLike("enum", { startsExpr }),
|
|
30681
|
-
_module: createKeywordLike("module", { startsExpr }),
|
|
30682
|
-
_namespace: createKeywordLike("namespace", { startsExpr }),
|
|
30683
|
-
_interface: createKeywordLike("interface", { startsExpr }),
|
|
30684
|
-
_type: createKeywordLike("type", { startsExpr }),
|
|
30685
|
-
_opaque: createKeywordLike("opaque", { startsExpr }),
|
|
30686
|
-
name: createToken("name", { startsExpr }),
|
|
30687
|
-
placeholder: createToken("%%", { startsExpr }),
|
|
30688
|
-
string: createToken("string", { startsExpr }),
|
|
30689
|
-
num: createToken("num", { startsExpr }),
|
|
30690
|
-
bigint: createToken("bigint", { startsExpr }),
|
|
30691
|
-
regexp: createToken("regexp", { startsExpr }),
|
|
30692
|
-
privateName: createToken("#name", { startsExpr }),
|
|
30693
|
-
eof: createToken("eof"),
|
|
30694
|
-
jsxName: createToken("jsxName"),
|
|
30695
|
-
jsxText: createToken("jsxText", { beforeExpr }),
|
|
30696
|
-
jsxTagStart: createToken("jsxTagStart", { startsExpr }),
|
|
30697
|
-
jsxTagEnd: createToken("jsxTagEnd")
|
|
30698
|
-
};
|
|
30699
|
-
function getExportedToken(token) {
|
|
30700
|
-
return tokenTypes[token];
|
|
30701
|
-
}
|
|
30702
|
-
var TokContext = class {
|
|
30703
|
-
constructor(token, preserveSpace) {
|
|
30704
|
-
this.token = token;
|
|
30705
|
-
this.preserveSpace = !!preserveSpace;
|
|
30706
|
-
}
|
|
30707
|
-
token;
|
|
30708
|
-
preserveSpace;
|
|
30709
|
-
};
|
|
30710
|
-
new TokContext("{"), new TokContext("<tag"), new TokContext("</tag"), new TokContext("<tag>...</tag>", true);
|
|
30711
|
-
const reservedWords = {
|
|
30712
|
-
keyword: [
|
|
30713
|
-
"break",
|
|
30714
|
-
"case",
|
|
30715
|
-
"catch",
|
|
30716
|
-
"continue",
|
|
30717
|
-
"debugger",
|
|
30718
|
-
"default",
|
|
30719
|
-
"do",
|
|
30720
|
-
"else",
|
|
30721
|
-
"finally",
|
|
30722
|
-
"for",
|
|
30723
|
-
"function",
|
|
30724
|
-
"if",
|
|
30725
|
-
"return",
|
|
30726
|
-
"switch",
|
|
30727
|
-
"throw",
|
|
30728
|
-
"try",
|
|
30729
|
-
"var",
|
|
30730
|
-
"const",
|
|
30731
|
-
"while",
|
|
30732
|
-
"with",
|
|
30733
|
-
"new",
|
|
30734
|
-
"this",
|
|
30735
|
-
"super",
|
|
30736
|
-
"class",
|
|
30737
|
-
"extends",
|
|
30738
|
-
"export",
|
|
30739
|
-
"import",
|
|
30740
|
-
"null",
|
|
30741
|
-
"true",
|
|
30742
|
-
"false",
|
|
30743
|
-
"in",
|
|
30744
|
-
"instanceof",
|
|
30745
|
-
"typeof",
|
|
30746
|
-
"void",
|
|
30747
|
-
"delete"
|
|
30748
|
-
],
|
|
30749
|
-
strict: [
|
|
30750
|
-
"implements",
|
|
30751
|
-
"interface",
|
|
30752
|
-
"let",
|
|
30753
|
-
"package",
|
|
30754
|
-
"private",
|
|
30755
|
-
"protected",
|
|
30756
|
-
"public",
|
|
30757
|
-
"static",
|
|
30758
|
-
"yield"
|
|
30759
|
-
],
|
|
30760
|
-
strictBind: ["eval", "arguments"]
|
|
30761
|
-
};
|
|
30762
|
-
new Set(reservedWords.keyword);
|
|
30763
|
-
new Set(reservedWords.strict);
|
|
30764
|
-
new Set(reservedWords.strictBind);
|
|
30765
|
-
ParseErrorEnum`flow`({
|
|
30766
|
-
AmbiguousConditionalArrow: "Ambiguous expression: wrap the arrow functions in parentheses to disambiguate.",
|
|
30767
|
-
AmbiguousDeclareModuleKind: "Found both `declare module.exports` and `declare export` in the same module. Modules can only have 1 since they are either an ES module or they are a CommonJS module.",
|
|
30768
|
-
AssignReservedType: ({ reservedType }) => `Cannot overwrite reserved type ${reservedType}.`,
|
|
30769
|
-
DeclareClassElement: "The `declare` modifier can only appear on class fields.",
|
|
30770
|
-
DeclareClassFieldInitializer: "Initializers are not allowed in fields with the `declare` modifier.",
|
|
30771
|
-
DuplicateDeclareModuleExports: "Duplicate `declare module.exports` statement.",
|
|
30772
|
-
EnumBooleanMemberNotInitialized: ({ memberName, enumName }) => `Boolean enum members need to be initialized. Use either \`${memberName} = true,\` or \`${memberName} = false,\` in enum \`${enumName}\`.`,
|
|
30773
|
-
EnumDuplicateMemberName: ({ memberName, enumName }) => `Enum member names need to be unique, but the name \`${memberName}\` has already been used before in enum \`${enumName}\`.`,
|
|
30774
|
-
EnumInconsistentMemberValues: ({ enumName }) => `Enum \`${enumName}\` has inconsistent member initializers. Either use no initializers, or consistently use literals (either booleans, numbers, or strings) for all member initializers.`,
|
|
30775
|
-
EnumInvalidExplicitType: ({ invalidEnumType, enumName }) => `Enum type \`${invalidEnumType}\` is not valid. Use one of \`boolean\`, \`number\`, \`string\`, or \`symbol\` in enum \`${enumName}\`.`,
|
|
30776
|
-
EnumInvalidExplicitTypeUnknownSupplied: ({ enumName }) => `Supplied enum type is not valid. Use one of \`boolean\`, \`number\`, \`string\`, or \`symbol\` in enum \`${enumName}\`.`,
|
|
30777
|
-
EnumInvalidMemberInitializerPrimaryType: ({ enumName, memberName, explicitType }) => `Enum \`${enumName}\` has type \`${explicitType}\`, so the initializer of \`${memberName}\` needs to be a ${explicitType} literal.`,
|
|
30778
|
-
EnumInvalidMemberInitializerSymbolType: ({ enumName, memberName }) => `Symbol enum members cannot be initialized. Use \`${memberName},\` in enum \`${enumName}\`.`,
|
|
30779
|
-
EnumInvalidMemberInitializerUnknownType: ({ enumName, memberName }) => `The enum member initializer for \`${memberName}\` needs to be a literal (either a boolean, number, or string) in enum \`${enumName}\`.`,
|
|
30780
|
-
EnumInvalidMemberName: ({ enumName, memberName, suggestion }) => `Enum member names cannot start with lowercase 'a' through 'z'. Instead of using \`${memberName}\`, consider using \`${suggestion}\`, in enum \`${enumName}\`.`,
|
|
30781
|
-
EnumNumberMemberNotInitialized: ({ enumName, memberName }) => `Number enum members need to be initialized, e.g. \`${memberName} = 1\` in enum \`${enumName}\`.`,
|
|
30782
|
-
EnumStringMemberInconsistentlyInitialized: ({ enumName }) => `String enum members need to consistently either all use initializers, or use no initializers, in enum \`${enumName}\`.`,
|
|
30783
|
-
GetterMayNotHaveThisParam: "A getter cannot have a `this` parameter.",
|
|
30784
|
-
ImportTypeShorthandOnlyInPureImport: "The `type` and `typeof` keywords on named imports can only be used on regular `import` statements. It cannot be used with `import type` or `import typeof` statements.",
|
|
30785
|
-
InexactInsideExact: "Explicit inexact syntax cannot appear inside an explicit exact object type.",
|
|
30786
|
-
InexactInsideNonObject: "Explicit inexact syntax cannot appear in class or interface definitions.",
|
|
30787
|
-
InexactVariance: "Explicit inexact syntax cannot have variance.",
|
|
30788
|
-
InvalidNonTypeImportInDeclareModule: "Imports within a `declare module` body must always be `import type` or `import typeof`.",
|
|
30789
|
-
MissingTypeParamDefault: "Type parameter declaration needs a default, since a preceding type parameter declaration has a default.",
|
|
30790
|
-
NestedDeclareModule: "`declare module` cannot be used inside another `declare module`.",
|
|
30791
|
-
NestedFlowComment: "Cannot have a flow comment inside another flow comment.",
|
|
30792
|
-
PatternIsOptional: { message: "A binding pattern parameter cannot be optional in an implementation signature." },
|
|
30793
|
-
SetterMayNotHaveThisParam: "A setter cannot have a `this` parameter.",
|
|
30794
|
-
SpreadVariance: "Spread properties cannot have variance.",
|
|
30795
|
-
ThisParamAnnotationRequired: "A type annotation is required for the `this` parameter.",
|
|
30796
|
-
ThisParamBannedInConstructor: "Constructors cannot have a `this` parameter; constructors don't bind `this` like other functions.",
|
|
30797
|
-
ThisParamMayNotBeOptional: "The `this` parameter cannot be optional.",
|
|
30798
|
-
ThisParamMustBeFirst: "The `this` parameter must be the first function parameter.",
|
|
30799
|
-
ThisParamNoDefault: "The `this` parameter may not have a default value.",
|
|
30800
|
-
TypeBeforeInitializer: "Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`.",
|
|
30801
|
-
TypeCastInPattern: "The type cast expression is expected to be wrapped with parenthesis.",
|
|
30802
|
-
UnexpectedExplicitInexactInObject: "Explicit inexact syntax must appear at the end of an inexact object.",
|
|
30803
|
-
UnexpectedReservedType: ({ reservedType }) => `Unexpected reserved type ${reservedType}.`,
|
|
30804
|
-
UnexpectedReservedUnderscore: "`_` is only allowed as a type argument to call or new.",
|
|
30805
|
-
UnexpectedSpaceBetweenModuloChecks: "Spaces between `%` and `checks` are not allowed here.",
|
|
30806
|
-
UnexpectedSpreadType: "Spread operator cannot appear in class or interface definitions.",
|
|
30807
|
-
UnexpectedSubtractionOperand: "Unexpected token, expected \"number\" or \"bigint\".",
|
|
30808
|
-
UnexpectedTokenAfterTypeParameter: "Expected an arrow function after this type parameter declaration.",
|
|
30809
|
-
UnexpectedTypeParameterBeforeAsyncArrowFunction: "Type parameters must come after the async keyword, e.g. instead of `<T> async () => {}`, use `async <T>() => {}`.",
|
|
30810
|
-
UnsupportedDeclareExportKind: ({ unsupportedExportKind, suggestion }) => `\`declare export ${unsupportedExportKind}\` is not supported. Use \`${suggestion}\` instead.`,
|
|
30811
|
-
UnsupportedStatementInDeclareModule: "Only declares and type imports are allowed inside declare module.",
|
|
30812
|
-
UnterminatedFlowComment: "Unterminated flow-comment."
|
|
30813
|
-
});
|
|
30814
|
-
new RegExp(/\r\n|[\r\n\u2028\u2029]/.source, "g");
|
|
30815
|
-
ParseErrorEnum`jsx`({
|
|
30816
|
-
AttributeIsEmpty: "JSX attributes must only be assigned a non-empty expression.",
|
|
30817
|
-
MissingClosingTagElement: ({ openingTagName }) => `Expected corresponding JSX closing tag for <${openingTagName}>.`,
|
|
30818
|
-
MissingClosingTagFragment: "Expected corresponding JSX closing tag for <>.",
|
|
30819
|
-
UnexpectedSequenceExpression: "Sequence expressions cannot be directly nested inside JSX. Did you mean to wrap it in parentheses (...)?",
|
|
30820
|
-
UnexpectedToken: ({ unexpected, HTMLEntity }) => `Unexpected token \`${unexpected}\`. Did you mean \`${HTMLEntity}\` or \`{'${unexpected}'}\`?`,
|
|
30821
|
-
UnsupportedJsxValue: "JSX value should be either an expression or a quoted JSX text.",
|
|
30822
|
-
UnterminatedJsxContent: "Unterminated JSX contents.",
|
|
30823
|
-
UnwrappedAdjacentJSXElements: "Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>?"
|
|
30824
|
-
});
|
|
30825
|
-
var Node = class {
|
|
30826
|
-
constructor(optionFlags, filename, pos, loc) {
|
|
30827
|
-
this.start = pos;
|
|
30828
|
-
this.end = 0;
|
|
30829
|
-
if (loc !== void 0) this.loc = new SourceLocation(loc);
|
|
30830
|
-
if (optionFlags & 128) this.range = [pos, 0];
|
|
30831
|
-
if (loc !== void 0 && filename) this.loc.filename = filename;
|
|
30832
|
-
}
|
|
30833
|
-
type = "";
|
|
30834
|
-
};
|
|
30835
|
-
Node.prototype;
|
|
30836
|
-
ParseErrorEnum`typescript`({
|
|
30837
|
-
AbstractMethodHasImplementation: ({ methodName }) => `Method '${methodName}' cannot have an implementation because it is marked abstract.`,
|
|
30838
|
-
AbstractPropertyHasInitializer: ({ propertyName }) => `Property '${propertyName}' cannot have an initializer because it is marked abstract.`,
|
|
30839
|
-
AccessorCannotBeOptional: "An 'accessor' property cannot be declared optional.",
|
|
30840
|
-
AccessorCannotDeclareThisParameter: "'get' and 'set' accessors cannot declare 'this' parameters.",
|
|
30841
|
-
AccessorCannotHaveTypeParameters: "An accessor cannot have type parameters.",
|
|
30842
|
-
ClassMethodHasDeclare: "Class methods cannot have the 'declare' modifier.",
|
|
30843
|
-
ClassMethodHasReadonly: "Class methods cannot have the 'readonly' modifier.",
|
|
30844
|
-
ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference: "A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.",
|
|
30845
|
-
ConstructorHasTypeParameters: "Type parameters cannot appear on a constructor declaration.",
|
|
30846
|
-
DeclareAccessor: ({ kind }) => `'declare' is not allowed in ${kind}ters.`,
|
|
30847
|
-
DeclareClassFieldHasInitializer: "Initializers are not allowed in ambient contexts.",
|
|
30848
|
-
DeclareFunctionHasImplementation: "An implementation cannot be declared in ambient contexts.",
|
|
30849
|
-
DecoratorAbstractMethod: ({ kind }) => `Decorators can't be used with ${kind.startsWith("a") ? "an" : "a"} ${kind}.`,
|
|
30850
|
-
DuplicateAccessibilityModifier: ({ modifier }) => `Accessibility modifier already seen: '${modifier}'.`,
|
|
30851
|
-
DuplicateModifier: ({ modifier }) => `Duplicate modifier: '${modifier}'.`,
|
|
30852
|
-
EmptyHeritageClauseType: ({ token }) => `'${token}' list cannot be empty.`,
|
|
30853
|
-
EmptyTypeArguments: "Type argument list cannot be empty.",
|
|
30854
|
-
EmptyTypeParameters: "Type parameter list cannot be empty.",
|
|
30855
|
-
ExpectedAmbientAfterExportDeclare: "'export declare' must be followed by an ambient declaration.",
|
|
30856
|
-
ExportAssignmentInTSNamespace: "An export assignment cannot be used in a namespace.",
|
|
30857
|
-
ExportInTSNamespace: "Export declarations are not permitted in a namespace.",
|
|
30858
|
-
ImportAliasHasImportType: "An import alias can not use 'import type'.",
|
|
30859
|
-
ImportInTSNamespace: "Import declarations in a namespace cannot reference a module.",
|
|
30860
|
-
IncompatibleModifiers: ({ modifiers }) => `'${modifiers[0]}' modifier cannot be used with '${modifiers[1]}' modifier.`,
|
|
30861
|
-
IndexSignatureHasAbstract: "Index signatures cannot have the 'abstract' modifier.",
|
|
30862
|
-
IndexSignatureHasAccessibility: ({ modifier }) => `Index signatures cannot have an accessibility modifier ('${modifier}').`,
|
|
30863
|
-
IndexSignatureHasDeclare: "Index signatures cannot have the 'declare' modifier.",
|
|
30864
|
-
IndexSignatureHasOverride: "'override' modifier cannot appear on an index signature.",
|
|
30865
|
-
IndexSignatureHasStatic: "Index signatures cannot have the 'static' modifier.",
|
|
30866
|
-
InitializerNotAllowedInAmbientContext: "Initializers are not allowed in ambient contexts.",
|
|
30867
|
-
InlineModuleDeclarationMustUseString: "`module ... {}` declarations must have a string name. Use `namespace ... {}` instead.",
|
|
30868
|
-
InvalidHeritageClauseType: ({ token }) => `'${token}' list can only include identifiers or qualified-names with optional type arguments.`,
|
|
30869
|
-
InvalidModifierOnAwaitUsingDeclaration: (modifier) => `'${modifier}' modifier cannot appear on an await using declaration.`,
|
|
30870
|
-
InvalidModifierOnTypeMember: ({ modifier }) => `'${modifier}' modifier cannot appear on a type member.`,
|
|
30871
|
-
InvalidModifierOnTypeParameter: ({ modifier }) => `'${modifier}' modifier cannot appear on a type parameter.`,
|
|
30872
|
-
InvalidModifierOnTypeParameterPositions: ({ modifier }) => `'${modifier}' modifier can only appear on a type parameter of a class, interface or type alias.`,
|
|
30873
|
-
InvalidModifierOnUsingDeclaration: (modifier) => `'${modifier}' modifier cannot appear on a using declaration.`,
|
|
30874
|
-
InvalidModifiersOrder: ({ orderedModifiers }) => `'${orderedModifiers[0]}' modifier must precede '${orderedModifiers[1]}' modifier.`,
|
|
30875
|
-
InvalidPropertyAccessAfterInstantiationExpression: "Invalid property access after an instantiation expression. You can either wrap the instantiation expression in parentheses, or delete the type arguments.",
|
|
30876
|
-
InvalidTupleMemberLabel: "Tuple members must be labeled with a simple identifier.",
|
|
30877
|
-
MissingInterfaceName: "'interface' declarations must be followed by an identifier.",
|
|
30878
|
-
NamespaceExportInTSNamespace: "Global module exports may only appear at top level.",
|
|
30879
|
-
NonAbstractClassHasAbstractMethod: "Abstract methods can only appear within an abstract class.",
|
|
30880
|
-
NonClassMethodPropertyHasAbstractModifier: "'abstract' modifier can only appear on a class, method, or property declaration.",
|
|
30881
|
-
OptionalTypeBeforeRequired: "A required element cannot follow an optional element.",
|
|
30882
|
-
OverrideNotInSubClass: "This member cannot have an 'override' modifier because its containing class does not extend another class.",
|
|
30883
|
-
PatternIsOptional: "A binding pattern parameter cannot be optional in an implementation signature.",
|
|
30884
|
-
PrivateElementHasAbstract: "Private elements cannot have the 'abstract' modifier.",
|
|
30885
|
-
PrivateElementHasAccessibility: ({ modifier }) => `Private elements cannot have an accessibility modifier ('${modifier}').`,
|
|
30886
|
-
ReadonlyForMethodSignature: "'readonly' modifier can only appear on a property declaration or index signature.",
|
|
30887
|
-
ReservedArrowTypeParam: "This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma, as in `<T,>() => ...`.",
|
|
30888
|
-
ReservedTypeAssertion: "This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.",
|
|
30889
|
-
SetAccessorCannotHaveOptionalParameter: "A 'set' accessor cannot have an optional parameter.",
|
|
30890
|
-
SetAccessorCannotHaveRestParameter: "A 'set' accessor cannot have rest parameter.",
|
|
30891
|
-
SetAccessorCannotHaveReturnType: "A 'set' accessor cannot have a return type annotation.",
|
|
30892
|
-
SingleTypeParameterWithoutTrailingComma: ({ typeParameterName }) => `Single type parameter ${typeParameterName} should have a trailing comma. Example usage: <${typeParameterName},>.`,
|
|
30893
|
-
StaticBlockCannotHaveModifier: "Static class blocks cannot have any modifier.",
|
|
30894
|
-
TupleOptionalAfterType: "A labeled tuple optional element must be declared using a question mark after the name and before the colon (`name?: type`), rather than after the type (`name: type?`).",
|
|
30895
|
-
TypeAnnotationAfterAssign: "Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`.",
|
|
30896
|
-
TypeImportCannotSpecifyDefaultAndNamed: "A type-only import can specify a default import or named bindings, but not both.",
|
|
30897
|
-
TypeModifierIsUsedInTypeExports: "The 'type' modifier cannot be used on a named export when 'export type' is used on its export statement.",
|
|
30898
|
-
TypeModifierIsUsedInTypeImports: "The 'type' modifier cannot be used on a named import when 'import type' is used on its import statement.",
|
|
30899
|
-
UnexpectedParameterInitializer: "A parameter initializer is only allowed in a function or constructor implementation.",
|
|
30900
|
-
UnexpectedParameterModifier: "A parameter property is only allowed in a constructor implementation.",
|
|
30901
|
-
UnexpectedReadonly: "'readonly' type modifier is only permitted on array and tuple literal types.",
|
|
30902
|
-
UnexpectedTypeAnnotation: "Did not expect a type annotation here.",
|
|
30903
|
-
UnexpectedTypeCastInParameter: "Unexpected type cast in parameter position.",
|
|
30904
|
-
UnexpectedTypeDeclaration: (type) => `'${type}' declarations can only be declared inside a block.`,
|
|
30905
|
-
UnsupportedImportTypeArgument: "Argument in a type import must be a string literal.",
|
|
30906
|
-
UnsupportedParameterPropertyKind: "A parameter property may not be declared using a binding pattern.",
|
|
30907
|
-
UnsupportedSignatureParameterKind: ({ type }) => `Name in a signature must be an Identifier, ObjectPattern or ArrayPattern, instead got ${type}.`,
|
|
30908
|
-
UsingDeclarationInAmbientContext: (kind) => `'${kind}' declarations are not allowed in ambient contexts.`
|
|
30909
|
-
});
|
|
30910
|
-
ParseErrorEnum`placeholders`({
|
|
30911
|
-
ClassNameIsRequired: "A class name is required.",
|
|
30912
|
-
UnexpectedSpace: "Unexpected space in placeholder."
|
|
30913
|
-
});
|
|
30914
|
-
function generateExportedTokenTypes(internalTokenTypes) {
|
|
30915
|
-
const tokenTypes = {};
|
|
30916
|
-
for (const typeName of Object.keys(internalTokenTypes)) tokenTypes[typeName] = getExportedToken(internalTokenTypes[typeName]);
|
|
30917
|
-
return tokenTypes;
|
|
30918
|
-
}
|
|
30919
|
-
generateExportedTokenTypes(tt);
|
|
30920
|
-
//#endregion
|
|
30921
30124
|
//#region ../../node_modules/.pnpm/estree-walker@3.0.3/node_modules/estree-walker/src/walker.js
|
|
30922
30125
|
/**
|
|
30923
30126
|
* @typedef { import('estree').Node} Node
|
|
@@ -31522,7 +30725,7 @@ function ensureValue(value) {
|
|
|
31522
30725
|
return value && ALLOW_EXTENSIONS.has(extname(value)) ? value.replaceAll("\\", "/") : null;
|
|
31523
30726
|
}
|
|
31524
30727
|
//#endregion
|
|
31525
|
-
//#region ../../node_modules/.pnpm/rolldown-plugin-dts@0.25.
|
|
30728
|
+
//#region ../../node_modules/.pnpm/rolldown-plugin-dts@0.25.2_@typescript+native-preview@7.0.0-dev.20260122.2_oxc-resolver_8152cf0e534aee518f40abeb59f8494a/node_modules/rolldown-plugin-dts/dist/index.mjs
|
|
31526
30729
|
function createDtsInputPlugin({ sideEffects }) {
|
|
31527
30730
|
return {
|
|
31528
30731
|
name: "rolldown-plugin-dts:dts-input",
|
|
@@ -32068,7 +31271,8 @@ async function collectDependencies(context, node, importer, namespaceStmts, chil
|
|
|
32068
31271
|
"ObjectProperty",
|
|
32069
31272
|
"ClassProperty",
|
|
32070
31273
|
"TSPropertySignature",
|
|
32071
|
-
"TSDeclareMethod"
|
|
31274
|
+
"TSDeclareMethod",
|
|
31275
|
+
"TSMethodSignature"
|
|
32072
31276
|
])) {
|
|
32073
31277
|
if (node.computed && isReferenceId(node.key)) addDependency(node.key);
|
|
32074
31278
|
if ("value" in node && isReferenceId(node.value)) addDependency(node.value);
|
|
@@ -32468,7 +31672,7 @@ function createGeneratePlugin({ entry, tsconfig, tsconfigRaw, build, incremental
|
|
|
32468
31672
|
on: (fn) => childProcess.on("message", fn)
|
|
32469
31673
|
});
|
|
32470
31674
|
} else {
|
|
32471
|
-
tscModule = await import("./tsc-
|
|
31675
|
+
tscModule = await import("./tsc-WMktM0FW.js");
|
|
32472
31676
|
if (newContext) tscContext = createContext();
|
|
32473
31677
|
}
|
|
32474
31678
|
if (!Array.isArray(options.input)) for (const [name, id] of Object.entries(options.input)) {
|
|
@@ -32800,7 +32004,7 @@ function createDtsResolvePlugin({ cwd, tsconfig, tsconfigRaw, resolver, sideEffe
|
|
|
32800
32004
|
async function resolveDtsPath(id, importer, rolldownResolution) {
|
|
32801
32005
|
let dtsPath;
|
|
32802
32006
|
if (resolver === "tsc") {
|
|
32803
|
-
const { tscResolve } = await import("./resolver-
|
|
32007
|
+
const { tscResolve } = await import("./resolver-DtsKFXi2-QB-x8j3e.js");
|
|
32804
32008
|
dtsPath = tscResolve(id, importer, cwd, tsconfig, tsconfigRaw);
|
|
32805
32009
|
} else dtsPath = baseDtsResolver(id, importer);
|
|
32806
32010
|
debug$1("Using %s for dts import: %O -> %O", resolver, id, dtsPath);
|