From 7d62c762e657cdddf45c1a99c66285ae9cb07b5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Wed, 21 Feb 2024 19:20:02 +0900 Subject: [PATCH] feat(es/ast): Add alias to `EsVersion` (#8653) **Related issue:** - Closes #8516 --- .../fixture/issues-8xxx/8516/input/.swcrc | 5 + .../tests/fixture/issues-8xxx/8516/input/1.js | 2 + .../fixture/issues-8xxx/8516/output/1.js | 1 + ...bstractProperty(target=esnext).1.normal.js | 14 + ...tractProperty(target=esnext).2.minified.js | 1 + ...gDeclarations.1(target=esnext).1.normal.js | 289 +++++++++++ ...eclarations.1(target=esnext).2.minified.js | 155 ++++++ ...gDeclarations.2(target=esnext).1.normal.js | 18 + ...eclarations.2(target=esnext).2.minified.js | 15 + ...gDeclarations.3(target=esnext).1.normal.js | 18 + ...eclarations.3(target=esnext).2.minified.js | 15 + ...clarationsInFor(target=esnext).1.normal.js | 11 + ...arationsInFor(target=esnext).2.minified.js | 11 + ...onsInForAwaitOf(target=esnext).1.normal.js | 10 + ...sInForAwaitOf(target=esnext).2.minified.js | 10 + ...ationsInForOf.1(target=esnext).1.normal.js | 11 + ...ionsInForOf.1(target=esnext).2.minified.js | 11 + ...assStaticBlock1(target=esnext).1.normal.js | 8 + ...sStaticBlock1(target=esnext).2.minified.js | 1 + ...ssStaticBlock10(target=esnext).1.normal.js | 25 + ...StaticBlock10(target=esnext).2.minified.js | 1 + ...ssStaticBlock11(target=esnext).1.normal.js | 13 + ...StaticBlock11(target=esnext).2.minified.js | 1 + ...ssStaticBlock13(target=esnext).1.normal.js | 10 + ...StaticBlock13(target=esnext).2.minified.js | 10 + ...ssStaticBlock15(target=esnext).1.normal.js | 14 + ...StaticBlock15(target=esnext).2.minified.js | 8 + ...ssStaticBlock18(target=esnext).1.normal.js | 18 + ...StaticBlock18(target=esnext).2.minified.js | 1 + ...assStaticBlock2(target=esnext).1.normal.js | 15 + ...sStaticBlock2(target=esnext).2.minified.js | 1 + ...ssStaticBlock25(target=es2022).1.normal.js | 15 + ...StaticBlock25(target=es2022).2.minified.js | 1 + ...ssStaticBlock25(target=esnext).1.normal.js | 15 + ...StaticBlock25(target=esnext).2.minified.js | 1 + ...assStaticBlock3(target=es2022).1.normal.js | 19 + ...sStaticBlock3(target=es2022).2.minified.js | 18 + ...assStaticBlock3(target=esnext).1.normal.js | 19 + ...sStaticBlock3(target=esnext).2.minified.js | 18 + ...assStaticBlock4(target=es2022).1.normal.js | 18 + ...sStaticBlock4(target=es2022).2.minified.js | 15 + ...assStaticBlock4(target=esnext).1.normal.js | 18 + ...sStaticBlock4(target=esnext).2.minified.js | 15 + ...assStaticBlock5(target=esnext).1.normal.js | 22 + ...sStaticBlock5(target=esnext).2.minified.js | 20 + ...assStaticBlock9(target=esnext).1.normal.js | 12 + ...sStaticBlock9(target=esnext).2.minified.js | 12 + ...ckUseBeforeDef2(target=es2022).1.normal.js | 6 + ...UseBeforeDef2(target=es2022).2.minified.js | 6 + ...ckUseBeforeDef2(target=esnext).1.normal.js | 6 + ...UseBeforeDef2(target=esnext).2.minified.js | 6 + ...rBindingPattern(target=esnext).1.normal.js | 7 + ...indingPattern(target=esnext).2.minified.js | 1 + ...indingPattern.2(target=esnext).1.normal.js | 19 + ...dingPattern.2(target=esnext).2.minified.js | 1 + ...eterInitializer(target=esnext).1.normal.js | 7 + ...erInitializer(target=esnext).2.minified.js | 1 + ...erInitializer.2(target=esnext).1.normal.js | 19 + ...Initializer.2(target=esnext).2.minified.js | 1 + .../defineProperty(target=esnext).1.normal.js | 34 ++ ...efineProperty(target=esnext).2.minified.js | 1 + ...nAndAssignment6(target=esnext).1.normal.js | 10 + ...ndAssignment6(target=esnext).2.minified.js | 6 + ...nAndAssignment7(target=esnext).1.normal.js | 13 + ...ndAssignment7(target=esnext).2.minified.js | 8 + ...nAndAssignment8(target=esnext).1.normal.js | 12 + ...ndAssignment8(target=esnext).2.minified.js | 6 + ...ssors-nonStatic(target=esnext).1.normal.js | 13 + ...ors-nonStatic(target=esnext).2.minified.js | 13 + ...onStaticPrivate(target=esnext).1.normal.js | 12 + ...StaticPrivate(target=esnext).2.minified.js | 12 + ...ccessors-static(target=esnext).1.normal.js | 13 + ...essors-static(target=esnext).2.minified.js | 13 + ...s-staticPrivate(target=esnext).1.normal.js | 12 + ...staticPrivate(target=esnext).2.minified.js | 12 + ...ssThisReference(target=esnext).1.normal.js | 13 + ...ThisReference(target=esnext).2.minified.js | 13 + ...module=commonjs,target=esnext).1.normal.js | 40 ++ ...dule=commonjs,target=esnext).2.minified.js | 39 ++ ...tion(module=es6,target=esnext).1.normal.js | 39 ++ ...on(module=es6,target=esnext).2.minified.js | 39 ++ ...ields-nonStatic(target=esnext).1.normal.js | 13 + ...lds-nonStatic(target=esnext).2.minified.js | 13 + ...nStaticAccessor(target=esnext).1.normal.js | 13 + ...taticAccessor(target=esnext).2.minified.js | 13 + ...onStaticPrivate(target=esnext).1.normal.js | 11 + ...StaticPrivate(target=esnext).2.minified.js | 11 + ...PrivateAccessor(target=esnext).1.normal.js | 11 + ...ivateAccessor(target=esnext).2.minified.js | 11 + ...n-fields-static(target=esnext).1.normal.js | 13 + ...fields-static(target=esnext).2.minified.js | 13 + ...-staticAccessor(target=esnext).1.normal.js | 13 + ...taticAccessor(target=esnext).2.minified.js | 13 + ...s-staticPrivate(target=esnext).1.normal.js | 13 + ...staticPrivate(target=esnext).2.minified.js | 13 + ...PrivateAccessor(target=esnext).1.normal.js | 13 + ...ivateAccessor(target=esnext).2.minified.js | 13 + ...thods-nonStatic(target=esnext).1.normal.js | 13 + ...ods-nonStatic(target=esnext).2.minified.js | 13 + ...onStaticPrivate(target=esnext).1.normal.js | 11 + ...StaticPrivate(target=esnext).2.minified.js | 11 + ...-methods-static(target=esnext).1.normal.js | 13 + ...ethods-static(target=esnext).2.minified.js | 13 + ...s-staticPrivate(target=esnext).1.normal.js | 13 + ...staticPrivate(target=esnext).2.minified.js | 13 + ...tipleDecorators(target=esnext).1.normal.js | 13 + ...pleDecorators(target=esnext).2.minified.js | 13 + ...erThisReference(target=esnext).1.normal.js | 13 + ...ThisReference(target=esnext).2.minified.js | 13 + ...meterProperties(target=esnext).1.normal.js | 12 + ...terProperties(target=esnext).2.minified.js | 12 + ...setFunctionName(target=esnext).1.normal.js | 41 ++ ...tFunctionName(target=esnext).2.minified.js | 41 ++ ...eTransformation(target=esnext).1.normal.js | 12 + ...ransformation(target=esnext).2.minified.js | 12 + ...ation-sourceMap(target=esnext).1.normal.js | 13 + ...ion-sourceMap(target=esnext).2.minified.js | 13 + ...entPreservation(target=esnext).1.normal.js | 13 + ...tPreservation(target=esnext).2.minified.js | 13 + ...coratorMetadata(target=esnext).1.normal.js | 12 + ...ratorMetadata(target=esnext).2.minified.js | 12 + ...zationOrdering1(target=esnext).1.normal.js | 14 + ...tionOrdering1(target=esnext).2.minified.js | 11 + ...icalAssignment1(target=esnext).1.normal.js | 10 + ...alAssignment1(target=esnext).2.minified.js | 2 + ...calAssignment10(target=esnext).1.normal.js | 11 + ...lAssignment10(target=esnext).2.minified.js | 5 + ...calAssignment11(target=esnext).1.normal.js | 8 + ...lAssignment11(target=esnext).2.minified.js | 3 + ...icalAssignment2(target=esnext).1.normal.js | 10 + ...alAssignment2(target=esnext).2.minified.js | 2 + ...icalAssignment3(target=esnext).1.normal.js | 4 + ...alAssignment3(target=esnext).2.minified.js | 2 + ...icalAssignment4(target=esnext).1.normal.js | 37 ++ ...alAssignment4(target=esnext).2.minified.js | 1 + ...icalAssignment5(target=esnext).1.normal.js | 25 + ...alAssignment5(target=esnext).2.minified.js | 1 + ...icalAssignment6(target=esnext).1.normal.js | 10 + ...alAssignment6(target=esnext).2.minified.js | 1 + ...icalAssignment7(target=esnext).1.normal.js | 10 + ...alAssignment7(target=esnext).2.minified.js | 1 + ...icalAssignment8(target=esnext).1.normal.js | 10 + ...alAssignment8(target=esnext).2.minified.js | 1 + ...nAsyncGenerator(target=esnext).1.normal.js | 8 + ...syncGenerator(target=esnext).2.minified.js | 1 + ...rBindingPattern(target=esnext).1.normal.js | 4 + ...indingPattern(target=esnext).2.minified.js | 1 + ...indingPattern.2(target=esnext).1.normal.js | 10 + ...dingPattern.2(target=esnext).2.minified.js | 1 + ...eterInitializer(target=esnext).1.normal.js | 4 + ...erInitializer(target=esnext).2.minified.js | 1 + ...erInitializer.2(target=esnext).1.normal.js | 10 + ...Initializer.2(target=esnext).2.minified.js | 1 + ...rBindingPattern(target=esnext).1.normal.js | 4 + ...indingPattern(target=esnext).2.minified.js | 1 + ...indingPattern.2(target=esnext).1.normal.js | 10 + ...dingPattern.2(target=esnext).2.minified.js | 1 + ...eterInitializer(target=esnext).1.normal.js | 4 + ...erInitializer(target=esnext).2.minified.js | 1 + ...erInitializer.2(target=esnext).1.normal.js | 10 + ...Initializer.2(target=esnext).2.minified.js | 1 + ...nTypeAssertions(target=esnext).1.normal.js | 14 + ...ypeAssertions(target=esnext).2.minified.js | 5 + ...hodDeclarations(target=esnext).1.normal.js | 6 + ...dDeclarations(target=esnext).2.minified.js | 1 + .../override12(target=esnext).1.normal.js | 19 + .../override12(target=esnext).2.minified.js | 1 + .../override16(target=esnext).1.normal.js | 9 + .../override16(target=esnext).2.minified.js | 1 + .../override17(target=esnext).1.normal.js | 19 + .../override17(target=esnext).2.minified.js | 1 + .../override18(target=esnext).1.normal.js | 7 + .../override18(target=esnext).2.minified.js | 1 + ...wardReferencing(target=esnext).1.normal.js | 14 + ...rdReferencing(target=esnext).2.minified.js | 1 + ...rdReferencing.2(target=esnext).1.normal.js | 10 + ...Referencing.2(target=esnext).2.minified.js | 1 + ...aticInitializer(target=esnext).1.normal.js | 12 + ...icInitializer(target=esnext).2.minified.js | 11 + ...edPropertyName1(target=esnext).1.normal.js | 33 ++ ...PropertyName1(target=esnext).2.minified.js | 23 + ...edPropertyName2(target=esnext).1.normal.js | 10 + ...PropertyName2(target=esnext).2.minified.js | 10 + ...edPropertyName3(target=esnext).1.normal.js | 21 + ...PropertyName3(target=esnext).2.minified.js | 20 + ...edPropertyName4(target=esnext).1.normal.js | 14 + ...PropertyName4(target=esnext).2.minified.js | 13 + ...ructuredBinding(target=esnext).1.normal.js | 45 ++ ...cturedBinding(target=esnext).2.minified.js | 1 + ...ameFieldsESNext(target=es2022).1.normal.js | 23 + ...eFieldsESNext(target=es2022).2.minified.js | 1 + ...ameFieldsESNext(target=esnext).1.normal.js | 23 + ...eFieldsESNext(target=esnext).2.minified.js | 1 + ...xpressionUnused(target=es2022).1.normal.js | 9 + ...ressionUnused(target=es2022).2.minified.js | 1 + ...xpressionUnused(target=esnext).1.normal.js | 9 + ...ressionUnused(target=esnext).2.minified.js | 1 + ...eForClassFields(target=es2022).1.normal.js | 10 + ...orClassFields(target=es2022).2.minified.js | 1 + ...eForClassFields(target=esnext).1.normal.js | 10 + ...orClassFields(target=esnext).2.minified.js | 1 + ...aticInitializer(target=esnext).1.normal.js | 5 + ...icInitializer(target=esnext).2.minified.js | 1 + ...ructuredBinding(target=esnext).1.normal.js | 44 ++ ...cturedBinding(target=esnext).2.minified.js | 1 + ...ieldInitializer(target=esnext).1.normal.js | 5 + ...ldInitializer(target=esnext).2.minified.js | 1 + ...ldNoInitializer(target=esnext).1.normal.js | 7 + ...NoInitializer(target=esnext).2.minified.js | 1 + ...ndStaticMethods(target=es2022).1.normal.js | 29 ++ ...StaticMethods(target=es2022).2.minified.js | 1 + ...ndStaticMethods(target=esnext).1.normal.js | 29 ++ ...StaticMethods(target=esnext).2.minified.js | 1 + ...sFieldsInEsNext(target=esnext).1.normal.js | 75 +++ ...ieldsInEsNext(target=esnext).2.minified.js | 35 ++ ...NamesAndMethods(target=es2022).1.normal.js | 29 ++ ...mesAndMethods(target=es2022).2.minified.js | 1 + ...NamesAndMethods(target=esnext).1.normal.js | 29 ++ ...mesAndMethods(target=esnext).2.minified.js | 1 + ...ndStaticMethods(target=es2022).1.normal.js | 29 ++ ...StaticMethods(target=es2022).2.minified.js | 1 + ...ndStaticMethods(target=esnext).1.normal.js | 29 ++ ...StaticMethods(target=esnext).2.minified.js | 1 + ...eNamesAssertion(target=es2022).1.normal.js | 26 + ...amesAssertion(target=es2022).2.minified.js | 1 + ...eNamesAssertion(target=esnext).1.normal.js | 26 + ...amesAssertion(target=esnext).2.minified.js | 1 + ...nStaticMembers1(target=esnext).1.normal.js | 482 ++++++++++++++++++ ...taticMembers1(target=esnext).2.minified.js | 414 +++++++++++++++ ...nStaticMembers1(target=esnext).1.normal.js | 45 ++ ...taticMembers1(target=esnext).2.minified.js | 42 ++ ...nStaticMembers2(target=esnext).1.normal.js | 96 ++++ ...taticMembers2(target=esnext).2.minified.js | 90 ++++ ...StaticMembers10(target=esnext).1.normal.js | 80 +++ ...aticMembers10(target=esnext).2.minified.js | 80 +++ ...StaticMembers11(target=esnext).1.normal.js | 52 ++ ...aticMembers11(target=esnext).2.minified.js | 52 ++ ...nStaticMembers3(target=esnext).1.normal.js | 20 + ...taticMembers3(target=esnext).2.minified.js | 20 + ...nStaticMembers4(target=esnext).1.normal.js | 10 + ...taticMembers4(target=esnext).2.minified.js | 10 + ...nStaticMembers5(target=esnext).1.normal.js | 9 + ...taticMembers5(target=esnext).2.minified.js | 9 + ...nStaticMembers7(target=esnext).1.normal.js | 20 + ...taticMembers7(target=esnext).2.minified.js | 20 + ...nStaticMembers8(target=esnext).1.normal.js | 36 ++ ...taticMembers8(target=esnext).2.minified.js | 24 + ...nStaticMembers9(target=esnext).1.normal.js | 38 ++ ...taticMembers9(target=esnext).2.minified.js | 26 + ...gDeclarations.1(target=esnext).1.normal.js | 441 ++++++++++++++++ ...eclarations.1(target=esnext).2.minified.js | 277 ++++++++++ ...gDeclarations.2(target=esnext).1.normal.js | 18 + ...eclarations.2(target=esnext).2.minified.js | 15 + ...gDeclarations.3(target=esnext).1.normal.js | 18 + ...eclarations.3(target=esnext).2.minified.js | 15 + ...clarationsInFor(target=esnext).1.normal.js | 9 + ...arationsInFor(target=esnext).2.minified.js | 9 + ...onsInForAwaitOf(target=esnext).1.normal.js | 21 + ...sInForAwaitOf(target=esnext).2.minified.js | 2 + ...ationsInForOf.1(target=esnext).1.normal.js | 19 + ...ionsInForOf.1(target=esnext).2.minified.js | 15 + ...module=commonjs,target=esnext).1.normal.js | 12 + ...dule=commonjs,target=esnext).2.minified.js | 12 + ...rs.1(module=es6,target=esnext).1.normal.js | 12 + ....1(module=es6,target=esnext).2.minified.js | 12 + ...1(module=system,target=esnext).1.normal.js | 12 + ...module=system,target=esnext).2.minified.js | 12 + ...module=commonjs,target=esnext).1.normal.js | 12 + ...dule=commonjs,target=esnext).2.minified.js | 12 + ...s.10(module=es6,target=esnext).1.normal.js | 12 + ...10(module=es6,target=esnext).2.minified.js | 12 + ...0(module=system,target=esnext).1.normal.js | 12 + ...module=system,target=esnext).2.minified.js | 12 + ...module=commonjs,target=esnext).1.normal.js | 12 + ...dule=commonjs,target=esnext).2.minified.js | 12 + ...s.11(module=es6,target=esnext).1.normal.js | 12 + ...11(module=es6,target=esnext).2.minified.js | 12 + ...1(module=system,target=esnext).1.normal.js | 12 + ...module=system,target=esnext).2.minified.js | 12 + ...module=commonjs,target=esnext).1.normal.js | 12 + ...dule=commonjs,target=esnext).2.minified.js | 12 + ...s.12(module=es6,target=esnext).1.normal.js | 12 + ...12(module=es6,target=esnext).2.minified.js | 12 + ...2(module=system,target=esnext).1.normal.js | 12 + ...module=system,target=esnext).2.minified.js | 12 + ...module=commonjs,target=esnext).1.normal.js | 12 + ...dule=commonjs,target=esnext).2.minified.js | 12 + ...rs.2(module=es6,target=esnext).1.normal.js | 12 + ....2(module=es6,target=esnext).2.minified.js | 12 + ...2(module=system,target=esnext).1.normal.js | 12 + ...module=system,target=esnext).2.minified.js | 12 + ...module=commonjs,target=esnext).1.normal.js | 12 + ...dule=commonjs,target=esnext).2.minified.js | 12 + ...rs.3(module=es6,target=esnext).1.normal.js | 12 + ....3(module=es6,target=esnext).2.minified.js | 12 + ...3(module=system,target=esnext).1.normal.js | 12 + ...module=system,target=esnext).2.minified.js | 12 + ...module=commonjs,target=esnext).1.normal.js | 12 + ...dule=commonjs,target=esnext).2.minified.js | 12 + ...rs.4(module=es6,target=esnext).1.normal.js | 12 + ....4(module=es6,target=esnext).2.minified.js | 12 + ...4(module=system,target=esnext).1.normal.js | 12 + ...module=system,target=esnext).2.minified.js | 12 + ...module=commonjs,target=esnext).1.normal.js | 12 + ...dule=commonjs,target=esnext).2.minified.js | 12 + ...rs.5(module=es6,target=esnext).1.normal.js | 12 + ....5(module=es6,target=esnext).2.minified.js | 12 + ...5(module=system,target=esnext).1.normal.js | 12 + ...module=system,target=esnext).2.minified.js | 12 + ...module=commonjs,target=esnext).1.normal.js | 12 + ...dule=commonjs,target=esnext).2.minified.js | 12 + ...rs.6(module=es6,target=esnext).1.normal.js | 12 + ....6(module=es6,target=esnext).2.minified.js | 12 + ...6(module=system,target=esnext).1.normal.js | 12 + ...module=system,target=esnext).2.minified.js | 12 + ...module=commonjs,target=esnext).1.normal.js | 12 + ...dule=commonjs,target=esnext).2.minified.js | 12 + ...rs.7(module=es6,target=esnext).1.normal.js | 12 + ....7(module=es6,target=esnext).2.minified.js | 12 + ...7(module=system,target=esnext).1.normal.js | 12 + ...module=system,target=esnext).2.minified.js | 12 + ...module=commonjs,target=esnext).1.normal.js | 12 + ...dule=commonjs,target=esnext).2.minified.js | 12 + ...rs.8(module=es6,target=esnext).1.normal.js | 12 + ....8(module=es6,target=esnext).2.minified.js | 12 + ...8(module=system,target=esnext).1.normal.js | 12 + ...module=system,target=esnext).2.minified.js | 12 + ...module=commonjs,target=esnext).1.normal.js | 12 + ...dule=commonjs,target=esnext).2.minified.js | 12 + ...rs.9(module=es6,target=esnext).1.normal.js | 12 + ....9(module=es6,target=esnext).2.minified.js | 12 + ...9(module=system,target=esnext).1.normal.js | 12 + ...module=system,target=esnext).2.minified.js | 12 + ...module=commonjs,target=esnext).1.normal.js | 22 + ...dule=commonjs,target=esnext).2.minified.js | 18 + ...rs.1(module=es6,target=esnext).1.normal.js | 19 + ....1(module=es6,target=esnext).2.minified.js | 17 + ...1(module=system,target=esnext).1.normal.js | 38 ++ ...module=system,target=esnext).2.minified.js | 36 ++ ...module=commonjs,target=esnext).1.normal.js | 28 + ...dule=commonjs,target=esnext).2.minified.js | 21 + ...s.10(module=es6,target=esnext).1.normal.js | 19 + ...10(module=es6,target=esnext).2.minified.js | 16 + ...0(module=system,target=esnext).1.normal.js | 38 ++ ...module=system,target=esnext).2.minified.js | 34 ++ ...module=commonjs,target=esnext).1.normal.js | 28 + ...dule=commonjs,target=esnext).2.minified.js | 22 + ...s.11(module=es6,target=esnext).1.normal.js | 19 + ...11(module=es6,target=esnext).2.minified.js | 17 + ...1(module=system,target=esnext).1.normal.js | 38 ++ ...module=system,target=esnext).2.minified.js | 35 ++ ...module=commonjs,target=esnext).1.normal.js | 28 + ...dule=commonjs,target=esnext).2.minified.js | 22 + ...s.12(module=es6,target=esnext).1.normal.js | 19 + ...12(module=es6,target=esnext).2.minified.js | 17 + ...2(module=system,target=esnext).1.normal.js | 38 ++ ...module=system,target=esnext).2.minified.js | 35 ++ ...module=commonjs,target=esnext).1.normal.js | 28 + ...dule=commonjs,target=esnext).2.minified.js | 22 + ...rs.2(module=es6,target=esnext).1.normal.js | 18 + ....2(module=es6,target=esnext).2.minified.js | 16 + ...2(module=system,target=esnext).1.normal.js | 39 ++ ...module=system,target=esnext).2.minified.js | 35 ++ ...module=commonjs,target=esnext).1.normal.js | 28 + ...dule=commonjs,target=esnext).2.minified.js | 23 + ...rs.3(module=es6,target=esnext).1.normal.js | 19 + ....3(module=es6,target=esnext).2.minified.js | 18 + ...3(module=system,target=esnext).1.normal.js | 38 ++ ...module=system,target=esnext).2.minified.js | 36 ++ ...module=commonjs,target=esnext).1.normal.js | 28 + ...dule=commonjs,target=esnext).2.minified.js | 23 + ...rs.4(module=es6,target=esnext).1.normal.js | 19 + ....4(module=es6,target=esnext).2.minified.js | 18 + ...4(module=system,target=esnext).1.normal.js | 38 ++ ...module=system,target=esnext).2.minified.js | 36 ++ ...module=commonjs,target=esnext).1.normal.js | 28 + ...dule=commonjs,target=esnext).2.minified.js | 23 + ...rs.5(module=es6,target=esnext).1.normal.js | 19 + ....5(module=es6,target=esnext).2.minified.js | 18 + ...5(module=system,target=esnext).1.normal.js | 38 ++ ...module=system,target=esnext).2.minified.js | 36 ++ ...module=commonjs,target=esnext).1.normal.js | 28 + ...dule=commonjs,target=esnext).2.minified.js | 23 + ...rs.6(module=es6,target=esnext).1.normal.js | 19 + ....6(module=es6,target=esnext).2.minified.js | 18 + ...6(module=system,target=esnext).1.normal.js | 38 ++ ...module=system,target=esnext).2.minified.js | 36 ++ ...module=commonjs,target=esnext).1.normal.js | 22 + ...dule=commonjs,target=esnext).2.minified.js | 17 + ...rs.7(module=es6,target=esnext).1.normal.js | 19 + ....7(module=es6,target=esnext).2.minified.js | 16 + ...7(module=system,target=esnext).1.normal.js | 38 ++ ...module=system,target=esnext).2.minified.js | 35 ++ ...module=commonjs,target=esnext).1.normal.js | 28 + ...dule=commonjs,target=esnext).2.minified.js | 22 + ...rs.8(module=es6,target=esnext).1.normal.js | 18 + ....8(module=es6,target=esnext).2.minified.js | 16 + ...8(module=system,target=esnext).1.normal.js | 39 ++ ...module=system,target=esnext).2.minified.js | 35 ++ ...module=commonjs,target=esnext).1.normal.js | 28 + ...dule=commonjs,target=esnext).2.minified.js | 21 + ...rs.9(module=es6,target=esnext).1.normal.js | 19 + ....9(module=es6,target=esnext).2.minified.js | 16 + ...9(module=system,target=esnext).1.normal.js | 38 ++ ...module=system,target=esnext).2.minified.js | 34 ++ crates/swc_ecma_ast/src/lib.rs | 29 +- 406 files changed, 8350 insertions(+), 14 deletions(-) create mode 100644 crates/swc/tests/fixture/issues-8xxx/8516/input/.swcrc create mode 100644 crates/swc/tests/fixture/issues-8xxx/8516/input/1.js create mode 100644 crates/swc/tests/fixture/issues-8xxx/8516/output/1.js create mode 100644 crates/swc/tests/tsc-references/abstractProperty(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/abstractProperty(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/awaitUsingDeclarations.1(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/awaitUsingDeclarations.1(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/awaitUsingDeclarations.2(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/awaitUsingDeclarations.2(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/awaitUsingDeclarations.3(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/awaitUsingDeclarations.3(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/awaitUsingDeclarationsInFor(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/awaitUsingDeclarationsInFor(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/awaitUsingDeclarationsInForAwaitOf(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/awaitUsingDeclarationsInForAwaitOf(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/awaitUsingDeclarationsInForOf.1(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/awaitUsingDeclarationsInForOf.1(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/classStaticBlock1(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/classStaticBlock1(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/classStaticBlock10(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/classStaticBlock10(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/classStaticBlock11(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/classStaticBlock11(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/classStaticBlock13(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/classStaticBlock13(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/classStaticBlock15(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/classStaticBlock15(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/classStaticBlock18(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/classStaticBlock18(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/classStaticBlock2(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/classStaticBlock2(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/classStaticBlock25(target=es2022).1.normal.js create mode 100644 crates/swc/tests/tsc-references/classStaticBlock25(target=es2022).2.minified.js create mode 100644 crates/swc/tests/tsc-references/classStaticBlock25(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/classStaticBlock25(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/classStaticBlock3(target=es2022).1.normal.js create mode 100644 crates/swc/tests/tsc-references/classStaticBlock3(target=es2022).2.minified.js create mode 100644 crates/swc/tests/tsc-references/classStaticBlock3(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/classStaticBlock3(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/classStaticBlock4(target=es2022).1.normal.js create mode 100644 crates/swc/tests/tsc-references/classStaticBlock4(target=es2022).2.minified.js create mode 100644 crates/swc/tests/tsc-references/classStaticBlock4(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/classStaticBlock4(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/classStaticBlock5(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/classStaticBlock5(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/classStaticBlock9(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/classStaticBlock9(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/classStaticBlockUseBeforeDef2(target=es2022).1.normal.js create mode 100644 crates/swc/tests/tsc-references/classStaticBlockUseBeforeDef2(target=es2022).2.minified.js create mode 100644 crates/swc/tests/tsc-references/classStaticBlockUseBeforeDef2(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/classStaticBlockUseBeforeDef2(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/classWithStaticFieldInParameterBindingPattern(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/classWithStaticFieldInParameterBindingPattern(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/classWithStaticFieldInParameterBindingPattern.2(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/classWithStaticFieldInParameterBindingPattern.2(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/classWithStaticFieldInParameterInitializer(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/classWithStaticFieldInParameterInitializer(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/classWithStaticFieldInParameterInitializer.2(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/classWithStaticFieldInParameterInitializer.2(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/defineProperty(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/defineProperty(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment6(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment6(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment7(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment7(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment8(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment8(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/esDecorators-classDeclaration-accessors-nonStatic(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/esDecorators-classDeclaration-accessors-nonStatic(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/esDecorators-classDeclaration-accessors-nonStaticPrivate(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/esDecorators-classDeclaration-accessors-nonStaticPrivate(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/esDecorators-classDeclaration-accessors-static(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/esDecorators-classDeclaration-accessors-static(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/esDecorators-classDeclaration-accessors-staticPrivate(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/esDecorators-classDeclaration-accessors-staticPrivate(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/esDecorators-classDeclaration-classThisReference(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/esDecorators-classDeclaration-classThisReference(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/esDecorators-classDeclaration-commentPreservation(module=es6,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/esDecorators-classDeclaration-commentPreservation(module=es6,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-nonStatic(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-nonStatic(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-nonStaticAccessor(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-nonStaticAccessor(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-nonStaticPrivate(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-nonStaticPrivate(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-nonStaticPrivateAccessor(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-nonStaticPrivateAccessor(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-static(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-static(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-staticAccessor(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-staticAccessor(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-staticPrivate(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-staticPrivate(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/esDecorators-classDeclaration-methods-nonStatic(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/esDecorators-classDeclaration-methods-nonStatic(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/esDecorators-classDeclaration-methods-nonStaticPrivate(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/esDecorators-classDeclaration-methods-nonStaticPrivate(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/esDecorators-classDeclaration-methods-static(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/esDecorators-classDeclaration-methods-static(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/esDecorators-classDeclaration-methods-staticPrivate(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/esDecorators-classDeclaration-methods-staticPrivate(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/esDecorators-classDeclaration-multipleDecorators(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/esDecorators-classDeclaration-multipleDecorators(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/esDecorators-classDeclaration-outerThisReference(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/esDecorators-classDeclaration-outerThisReference(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/esDecorators-classDeclaration-parameterProperties(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/esDecorators-classDeclaration-parameterProperties(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/esDecorators-classDeclaration-setFunctionName(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/esDecorators-classDeclaration-setFunctionName(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/esDecorators-classDeclaration-simpleTransformation(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/esDecorators-classDeclaration-simpleTransformation(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/esDecorators-classDeclaration-sourceMap(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/esDecorators-classDeclaration-sourceMap(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/esDecorators-classExpression-commentPreservation(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/esDecorators-classExpression-commentPreservation(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/esDecorators-emitDecoratorMetadata(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/esDecorators-emitDecoratorMetadata(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/initializationOrdering1(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/initializationOrdering1(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/logicalAssignment1(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/logicalAssignment1(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/logicalAssignment10(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/logicalAssignment10(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/logicalAssignment11(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/logicalAssignment11(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/logicalAssignment2(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/logicalAssignment2(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/logicalAssignment3(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/logicalAssignment3(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/logicalAssignment4(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/logicalAssignment4(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/logicalAssignment5(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/logicalAssignment5(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/logicalAssignment6(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/logicalAssignment6(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/logicalAssignment7(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/logicalAssignment7(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/logicalAssignment8(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/logicalAssignment8(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/nullishCoalescingOperatorInAsyncGenerator(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/nullishCoalescingOperatorInAsyncGenerator(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterBindingPattern(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterBindingPattern(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterBindingPattern.2(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterBindingPattern.2(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterInitializer(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterInitializer(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterInitializer.2(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterInitializer.2(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern.2(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern.2(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/optionalChainingInParameterInitializer(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/optionalChainingInParameterInitializer(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/optionalChainingInParameterInitializer.2(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/optionalChainingInParameterInitializer.2(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/optionalChainingInTypeAssertions(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/optionalChainingInTypeAssertions(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/optionalMethodDeclarations(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/optionalMethodDeclarations(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/override12(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/override12(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/override16(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/override16(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/override17(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/override17(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/override18(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/override18(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/parameterInitializersBackwardReferencing(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/parameterInitializersBackwardReferencing(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/parameterInitializersForwardReferencing.2(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/parameterInitializersForwardReferencing.2(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/privateNameAndStaticInitializer(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/privateNameAndStaticInitializer(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/privateNameComputedPropertyName1(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/privateNameComputedPropertyName1(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/privateNameComputedPropertyName2(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/privateNameComputedPropertyName2(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/privateNameComputedPropertyName3(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/privateNameComputedPropertyName3(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/privateNameComputedPropertyName4(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/privateNameComputedPropertyName4(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/privateNameFieldDestructuredBinding(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/privateNameFieldDestructuredBinding(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/privateNameFieldsESNext(target=es2022).1.normal.js create mode 100644 crates/swc/tests/tsc-references/privateNameFieldsESNext(target=es2022).2.minified.js create mode 100644 crates/swc/tests/tsc-references/privateNameFieldsESNext(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/privateNameFieldsESNext(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/privateNameInInExpressionUnused(target=es2022).1.normal.js create mode 100644 crates/swc/tests/tsc-references/privateNameInInExpressionUnused(target=es2022).2.minified.js create mode 100644 crates/swc/tests/tsc-references/privateNameInInExpressionUnused(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/privateNameInInExpressionUnused(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/privateNameLateSuperUseDefineForClassFields(target=es2022).1.normal.js create mode 100644 crates/swc/tests/tsc-references/privateNameLateSuperUseDefineForClassFields(target=es2022).2.minified.js create mode 100644 crates/swc/tests/tsc-references/privateNameLateSuperUseDefineForClassFields(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/privateNameLateSuperUseDefineForClassFields(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/privateNameStaticAndStaticInitializer(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/privateNameStaticAndStaticInitializer(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/privateNameStaticFieldDestructuredBinding(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/privateNameStaticFieldDestructuredBinding(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/privateNameStaticFieldInitializer(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/privateNameStaticFieldInitializer(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/privateNameStaticFieldNoInitializer(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/privateNameStaticFieldNoInitializer(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/privateNameStaticsAndStaticMethods(target=es2022).1.normal.js create mode 100644 crates/swc/tests/tsc-references/privateNameStaticsAndStaticMethods(target=es2022).2.minified.js create mode 100644 crates/swc/tests/tsc-references/privateNameStaticsAndStaticMethods(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/privateNameStaticsAndStaticMethods(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/privateNameWhenNotUseDefineForClassFieldsInEsNext(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/privateNameWhenNotUseDefineForClassFieldsInEsNext(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/privateNamesAndMethods(target=es2022).1.normal.js create mode 100644 crates/swc/tests/tsc-references/privateNamesAndMethods(target=es2022).2.minified.js create mode 100644 crates/swc/tests/tsc-references/privateNamesAndMethods(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/privateNamesAndMethods(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/privateNamesAndStaticMethods(target=es2022).1.normal.js create mode 100644 crates/swc/tests/tsc-references/privateNamesAndStaticMethods(target=es2022).2.minified.js create mode 100644 crates/swc/tests/tsc-references/privateNamesAndStaticMethods(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/privateNamesAndStaticMethods(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/privateNamesAssertion(target=es2022).1.normal.js create mode 100644 crates/swc/tests/tsc-references/privateNamesAssertion(target=es2022).2.minified.js create mode 100644 crates/swc/tests/tsc-references/privateNamesAssertion(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/privateNamesAssertion(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/superInStaticMembers1(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/superInStaticMembers1(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/thisAndSuperInStaticMembers1(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/thisAndSuperInStaticMembers1(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/thisAndSuperInStaticMembers2(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/thisAndSuperInStaticMembers2(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/typeOfThisInStaticMembers10(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/typeOfThisInStaticMembers10(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/typeOfThisInStaticMembers11(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/typeOfThisInStaticMembers11(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/typeOfThisInStaticMembers3(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/typeOfThisInStaticMembers3(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/typeOfThisInStaticMembers4(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/typeOfThisInStaticMembers4(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/typeOfThisInStaticMembers5(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/typeOfThisInStaticMembers5(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/typeOfThisInStaticMembers7(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/typeOfThisInStaticMembers7(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/typeOfThisInStaticMembers8(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/typeOfThisInStaticMembers8(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/typeOfThisInStaticMembers9(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/typeOfThisInStaticMembers9(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarations.1(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarations.1(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarations.2(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarations.2(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarations.3(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarations.3(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsInFor(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsInFor(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsInForAwaitOf(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsInForAwaitOf(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsInForOf.1(target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsInForOf.1(target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.1(module=commonjs,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.1(module=commonjs,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.1(module=es6,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.1(module=es6,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.1(module=system,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.1(module=system,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.10(module=commonjs,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.10(module=commonjs,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.10(module=es6,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.10(module=es6,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.10(module=system,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.10(module=system,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.11(module=commonjs,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.11(module=commonjs,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.11(module=es6,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.11(module=es6,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.11(module=system,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.11(module=system,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.12(module=commonjs,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.12(module=commonjs,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.12(module=es6,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.12(module=es6,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.12(module=system,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.12(module=system,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.2(module=commonjs,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.2(module=commonjs,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.2(module=es6,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.2(module=es6,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.2(module=system,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.2(module=system,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.3(module=commonjs,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.3(module=commonjs,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.3(module=es6,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.3(module=es6,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.3(module=system,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.3(module=system,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.4(module=commonjs,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.4(module=commonjs,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.4(module=es6,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.4(module=es6,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.4(module=system,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.4(module=system,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.5(module=commonjs,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.5(module=commonjs,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.5(module=es6,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.5(module=es6,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.5(module=system,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.5(module=system,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.6(module=commonjs,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.6(module=commonjs,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.6(module=es6,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.6(module=es6,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.6(module=system,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.6(module=system,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.7(module=commonjs,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.7(module=commonjs,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.7(module=es6,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.7(module=es6,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.7(module=system,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.7(module=system,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.8(module=commonjs,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.8(module=commonjs,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.8(module=es6,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.8(module=es6,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.8(module=system,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.8(module=system,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.9(module=commonjs,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.9(module=commonjs,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.9(module=es6,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.9(module=es6,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.9(module=system,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.9(module=system,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.1(module=commonjs,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.1(module=commonjs,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.1(module=es6,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.1(module=es6,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.1(module=system,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.1(module=system,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.10(module=commonjs,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.10(module=commonjs,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.10(module=es6,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.10(module=es6,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.10(module=system,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.10(module=system,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.11(module=commonjs,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.11(module=commonjs,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.11(module=es6,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.11(module=es6,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.11(module=system,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.11(module=system,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.12(module=commonjs,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.12(module=commonjs,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.12(module=es6,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.12(module=es6,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.12(module=system,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.12(module=system,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=commonjs,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=commonjs,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=es6,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=es6,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=system,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=system,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.3(module=commonjs,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.3(module=commonjs,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.3(module=es6,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.3(module=es6,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.3(module=system,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.3(module=system,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.4(module=commonjs,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.4(module=commonjs,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.4(module=es6,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.4(module=es6,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.4(module=system,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.4(module=system,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.5(module=commonjs,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.5(module=commonjs,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.5(module=es6,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.5(module=es6,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.5(module=system,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.5(module=system,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.6(module=commonjs,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.6(module=commonjs,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.6(module=es6,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.6(module=es6,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.6(module=system,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.6(module=system,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.7(module=commonjs,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.7(module=commonjs,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.7(module=es6,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.7(module=es6,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.7(module=system,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.7(module=system,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=commonjs,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=commonjs,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=es6,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=es6,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=system,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=system,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.9(module=commonjs,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.9(module=commonjs,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.9(module=es6,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.9(module=es6,target=esnext).2.minified.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.9(module=system,target=esnext).1.normal.js create mode 100644 crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.9(module=system,target=esnext).2.minified.js diff --git a/crates/swc/tests/fixture/issues-8xxx/8516/input/.swcrc b/crates/swc/tests/fixture/issues-8xxx/8516/input/.swcrc new file mode 100644 index 000000000000..242c4af140b9 --- /dev/null +++ b/crates/swc/tests/fixture/issues-8xxx/8516/input/.swcrc @@ -0,0 +1,5 @@ +{ + "jsc": { + "target": "EsNext" + } +} \ No newline at end of file diff --git a/crates/swc/tests/fixture/issues-8xxx/8516/input/1.js b/crates/swc/tests/fixture/issues-8xxx/8516/input/1.js new file mode 100644 index 000000000000..feaa6625df05 --- /dev/null +++ b/crates/swc/tests/fixture/issues-8xxx/8516/input/1.js @@ -0,0 +1,2 @@ + +consoe.log('test') \ No newline at end of file diff --git a/crates/swc/tests/fixture/issues-8xxx/8516/output/1.js b/crates/swc/tests/fixture/issues-8xxx/8516/output/1.js new file mode 100644 index 000000000000..679bd7258107 --- /dev/null +++ b/crates/swc/tests/fixture/issues-8xxx/8516/output/1.js @@ -0,0 +1 @@ +consoe.log('test'); diff --git a/crates/swc/tests/tsc-references/abstractProperty(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/abstractProperty(target=esnext).1.normal.js new file mode 100644 index 000000000000..21f52b022db9 --- /dev/null +++ b/crates/swc/tests/tsc-references/abstractProperty(target=esnext).1.normal.js @@ -0,0 +1,14 @@ +//// [abstractProperty.ts] +class A { + foo() { + console.log(this.x); + } +} +class B extends A { + x = 'B.x'; +} +class C extends A { + get x() { + return 'C.x'; + } +} diff --git a/crates/swc/tests/tsc-references/abstractProperty(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/abstractProperty(target=esnext).2.minified.js new file mode 100644 index 000000000000..d6f133b3ca23 --- /dev/null +++ b/crates/swc/tests/tsc-references/abstractProperty(target=esnext).2.minified.js @@ -0,0 +1 @@ +//// [abstractProperty.ts] diff --git a/crates/swc/tests/tsc-references/awaitUsingDeclarations.1(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/awaitUsingDeclarations.1(target=esnext).1.normal.js new file mode 100644 index 000000000000..cd8f6d01da90 --- /dev/null +++ b/crates/swc/tests/tsc-references/awaitUsingDeclarations.1(target=esnext).1.normal.js @@ -0,0 +1,289 @@ +//// [awaitUsingDeclarations.1.ts] +import { _ as _dispose } from "@swc/helpers/_/_dispose"; +import { _ as _using } from "@swc/helpers/_/_using"; +async function af() { + try { + var _stack = []; + var d3 = _using(_stack, { + async [Symbol.asyncDispose] () {} + }, true); + await null; + } catch (_) { + var _error = _; + var _hasError = true; + } finally{ + await _dispose(_stack, _error, _hasError); + } +} +async function* ag() { + try { + var _stack = []; + var d5 = _using(_stack, { + async [Symbol.asyncDispose] () {} + }, true); + yield; + await null; + } catch (_) { + var _error = _; + var _hasError = true; + } finally{ + await _dispose(_stack, _error, _hasError); + } +} +try { + var _stack = []; + var d1 = _using(_stack, { + async [Symbol.asyncDispose] () {} + }, true); + var a = async ()=>{ + try { + var _stack = []; + var d6 = _using(_stack, { + async [Symbol.asyncDispose] () {} + }, true); + } catch (_) { + var _error = _; + var _hasError = true; + } finally{ + await _dispose(_stack, _error, _hasError); + } + }; + class C1 { + async am() { + try { + var _stack = []; + var d13 = _using(_stack, { + async [Symbol.asyncDispose] () {} + }, true); + await null; + } catch (_) { + var _error = _; + var _hasError = true; + } finally{ + await _dispose(_stack, _error, _hasError); + } + } + async *ag() { + try { + var _stack = []; + var d15 = _using(_stack, { + async [Symbol.asyncDispose] () {} + }, true); + yield; + await null; + } catch (_) { + var _error = _; + var _hasError = true; + } finally{ + await _dispose(_stack, _error, _hasError); + } + } + constructor(){ + this.a = async ()=>{ + try { + var _stack = []; + var d7 = _using(_stack, { + async [Symbol.asyncDispose] () {} + }, true); + } catch (_) { + var _error = _; + var _hasError = true; + } finally{ + await _dispose(_stack, _error, _hasError); + } + }; + } + } + { + try { + var _stack1 = []; + var d19 = _using(_stack1, { + async [Symbol.asyncDispose] () {} + }, true); + } catch (_) { + var _error = _; + var _hasError = true; + } finally{ + await _dispose(_stack1, _error, _hasError); + } + } + switch(Math.random()){ + case 0: + try { + var _stack2 = []; + var d20 = _using(_stack2, { + async [Symbol.asyncDispose] () {} + }, true); + break; + } catch (_) { + var _error1 = _; + var _hasError1 = true; + } finally{ + await _dispose(_stack2, _error1, _hasError1); + } + case 1: + try { + var _stack3 = []; + var d21 = _using(_stack3, { + async [Symbol.asyncDispose] () {} + }, true); + break; + } catch (_) { + var _error2 = _; + var _hasError2 = true; + } finally{ + await _dispose(_stack3, _error2, _hasError2); + } + } + if (true) switch(0){ + case 0: + try { + var _stack4 = []; + var d22 = _using(_stack4, { + async [Symbol.asyncDispose] () {} + }, true); + break; + } catch (_) { + var _error3 = _; + var _hasError3 = true; + } finally{ + await _dispose(_stack4, _error3, _hasError3); + } + } + try { + try { + var _stack5 = []; + var d23 = _using(_stack5, { + async [Symbol.asyncDispose] () {} + }, true); + } catch (_) { + var _error4 = _; + var _hasError4 = true; + } finally{ + await _dispose(_stack5, _error4, _hasError4); + } + } catch { + try { + var _stack6 = []; + var d24 = _using(_stack6, { + async [Symbol.asyncDispose] () {} + }, true); + } catch (_) { + var _error5 = _; + var _hasError5 = true; + } finally{ + await _dispose(_stack6, _error5, _hasError5); + } + } finally{ + try { + var _stack7 = []; + var d25 = _using(_stack7, { + async [Symbol.asyncDispose] () {} + }, true); + } catch (_) { + var _error6 = _; + var _hasError6 = true; + } finally{ + await _dispose(_stack7, _error6, _hasError6); + } + } + if (true) { + try { + var _stack8 = []; + var d26 = _using(_stack8, { + async [Symbol.asyncDispose] () {} + }, true); + } catch (_) { + var _error7 = _; + var _hasError7 = true; + } finally{ + await _dispose(_stack8, _error7, _hasError7); + } + } else { + try { + var _stack9 = []; + var d27 = _using(_stack9, { + async [Symbol.asyncDispose] () {} + }, true); + } catch (_) { + var _error8 = _; + var _hasError8 = true; + } finally{ + await _dispose(_stack9, _error8, _hasError8); + } + } + while(true){ + try { + var _stack10 = []; + var d28 = _using(_stack10, { + async [Symbol.asyncDispose] () {} + }, true); + break; + } catch (_) { + var _error9 = _; + var _hasError9 = true; + } finally{ + await _dispose(_stack10, _error9, _hasError9); + } + } + do { + try { + var _stack11 = []; + var d29 = _using(_stack11, { + async [Symbol.asyncDispose] () {} + }, true); + break; + } catch (_) { + var _error10 = _; + var _hasError10 = true; + } finally{ + await _dispose(_stack11, _error10, _hasError10); + } + }while (true) + for(;;){ + try { + var _stack12 = []; + var d30 = _using(_stack12, { + async [Symbol.asyncDispose] () {} + }, true); + break; + } catch (_) { + var _error11 = _; + var _hasError11 = true; + } finally{ + await _dispose(_stack12, _error11, _hasError11); + } + } + for(const x in {}){ + try { + var _stack13 = []; + var d31 = _using(_stack13, { + async [Symbol.asyncDispose] () {} + }, true); + } catch (_) { + var _error12 = _; + var _hasError12 = true; + } finally{ + await _dispose(_stack13, _error12, _hasError12); + } + } + for (const x of []){ + try { + var _stack14 = []; + var d32 = _using(_stack14, { + async [Symbol.asyncDispose] () {} + }, true); + } catch (_) { + var _error13 = _; + var _hasError13 = true; + } finally{ + await _dispose(_stack14, _error13, _hasError13); + } + } +} catch (_) { + var _error14 = _; + var _hasError14 = true; +} finally{ + await _dispose(_stack, _error14, _hasError14); +} +export { }; diff --git a/crates/swc/tests/tsc-references/awaitUsingDeclarations.1(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/awaitUsingDeclarations.1(target=esnext).2.minified.js new file mode 100644 index 000000000000..6f8a888b9f65 --- /dev/null +++ b/crates/swc/tests/tsc-references/awaitUsingDeclarations.1(target=esnext).2.minified.js @@ -0,0 +1,155 @@ +//// [awaitUsingDeclarations.1.ts] +import { _ as _dispose } from "@swc/helpers/_/_dispose"; +import { _ as _using } from "@swc/helpers/_/_using"; +try { + var _stack = []; + _using(_stack, { + async [Symbol.asyncDispose] () {} + }, !0); + try { + var _stack1 = []; + _using(_stack1, { + async [Symbol.asyncDispose] () {} + }, !0); + } catch (_) { + var _error = _, _hasError = !0; + } finally{ + await _dispose(_stack1, _error, _hasError); + } + switch(Math.random()){ + case 0: + try { + var _stack2 = []; + _using(_stack2, { + async [Symbol.asyncDispose] () {} + }, !0); + break; + } catch (_) { + var _error1 = _, _hasError1 = !0; + } finally{ + await _dispose(_stack2, _error1, _hasError1); + } + case 1: + try { + var _stack3 = []; + _using(_stack3, { + async [Symbol.asyncDispose] () {} + }, !0); + } catch (_) { + var _error2 = _, _hasError2 = !0; + } finally{ + await _dispose(_stack3, _error2, _hasError2); + } + } + try { + var _stack4 = []; + _using(_stack4, { + async [Symbol.asyncDispose] () {} + }, !0); + } catch (_) { + var _error3 = _, _hasError3 = !0; + } finally{ + await _dispose(_stack4, _error3, _hasError3); + } + try { + try { + var _stack5 = []; + _using(_stack5, { + async [Symbol.asyncDispose] () {} + }, !0); + } catch (_) { + var _error4 = _, _hasError4 = !0; + } finally{ + await _dispose(_stack5, _error4, _hasError4); + } + } catch { + try { + var _stack6 = []; + _using(_stack6, { + async [Symbol.asyncDispose] () {} + }, !0); + } catch (_) { + var _error5 = _, _hasError5 = !0; + } finally{ + await _dispose(_stack6, _error5, _hasError5); + } + } finally{ + try { + var _stack7 = []; + _using(_stack7, { + async [Symbol.asyncDispose] () {} + }, !0); + } catch (_) { + var _error6 = _, _hasError6 = !0; + } finally{ + await _dispose(_stack7, _error6, _hasError6); + } + } + try { + var _stack8 = []; + _using(_stack8, { + async [Symbol.asyncDispose] () {} + }, !0); + } catch (_) { + var _error7 = _, _hasError7 = !0; + } finally{ + await _dispose(_stack8, _error7, _hasError7); + } + for(;;)try { + var _stack10 = []; + _using(_stack10, { + async [Symbol.asyncDispose] () {} + }, !0); + break; + } catch (_) { + var _error9 = _, _hasError9 = !0; + } finally{ + await _dispose(_stack10, _error9, _hasError9); + } + for(;;)try { + var _stack11 = []; + _using(_stack11, { + async [Symbol.asyncDispose] () {} + }, !0); + break; + } catch (_) { + var _error10 = _, _hasError10 = !0; + } finally{ + await _dispose(_stack11, _error10, _hasError10); + } + for(;;)try { + var _stack12 = []; + _using(_stack12, { + async [Symbol.asyncDispose] () {} + }, !0); + break; + } catch (_) { + var _error11 = _, _hasError11 = !0; + } finally{ + await _dispose(_stack12, _error11, _hasError11); + } + for(let x in {})try { + var _stack13 = []; + _using(_stack13, { + async [Symbol.asyncDispose] () {} + }, !0); + } catch (_) { + var _error12 = _, _hasError12 = !0; + } finally{ + await _dispose(_stack13, _error12, _hasError12); + } + for (let x of [])try { + var _stack14 = []; + _using(_stack14, { + async [Symbol.asyncDispose] () {} + }, !0); + } catch (_) { + var _error13 = _, _hasError13 = !0; + } finally{ + await _dispose(_stack14, _error13, _hasError13); + } +} catch (_) { + var _error14 = _, _hasError14 = !0; +} finally{ + await _dispose(_stack, _error14, _hasError14); +} diff --git a/crates/swc/tests/tsc-references/awaitUsingDeclarations.2(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/awaitUsingDeclarations.2(target=esnext).1.normal.js new file mode 100644 index 000000000000..86ec3758f7b0 --- /dev/null +++ b/crates/swc/tests/tsc-references/awaitUsingDeclarations.2(target=esnext).1.normal.js @@ -0,0 +1,18 @@ +//// [awaitUsingDeclarations.2.ts] +import { _ as _dispose } from "@swc/helpers/_/_dispose"; +import { _ as _using } from "@swc/helpers/_/_using"; +{ + try { + var _stack = []; + var d1 = _using(_stack, { + async [Symbol.asyncDispose] () {} + }, true), d2 = _using(_stack, { + async [Symbol.asyncDispose] () {} + }, true); + } catch (_) { + var _error = _; + var _hasError = true; + } finally{ + await _dispose(_stack, _error, _hasError); + } +}export { }; diff --git a/crates/swc/tests/tsc-references/awaitUsingDeclarations.2(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/awaitUsingDeclarations.2(target=esnext).2.minified.js new file mode 100644 index 000000000000..fa24b4a3680c --- /dev/null +++ b/crates/swc/tests/tsc-references/awaitUsingDeclarations.2(target=esnext).2.minified.js @@ -0,0 +1,15 @@ +//// [awaitUsingDeclarations.2.ts] +import { _ as _dispose } from "@swc/helpers/_/_dispose"; +import { _ as _using } from "@swc/helpers/_/_using"; +try { + var _stack = []; + _using(_stack, { + async [Symbol.asyncDispose] () {} + }, !0), _using(_stack, { + async [Symbol.asyncDispose] () {} + }, !0); +} catch (_) { + var _error = _, _hasError = !0; +} finally{ + await _dispose(_stack, _error, _hasError); +} diff --git a/crates/swc/tests/tsc-references/awaitUsingDeclarations.3(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/awaitUsingDeclarations.3(target=esnext).1.normal.js new file mode 100644 index 000000000000..59a2e4d396e4 --- /dev/null +++ b/crates/swc/tests/tsc-references/awaitUsingDeclarations.3(target=esnext).1.normal.js @@ -0,0 +1,18 @@ +//// [awaitUsingDeclarations.3.ts] +import { _ as _dispose } from "@swc/helpers/_/_dispose"; +import { _ as _using } from "@swc/helpers/_/_using"; +{ + try { + var _stack = []; + var d1 = _using(_stack, { + async [Symbol.asyncDispose] () {} + }, true), d2 = _using(_stack, null, true), d3 = _using(_stack, undefined, true), d4 = _using(_stack, { + [Symbol.dispose] () {} + }, true); + } catch (_) { + var _error = _; + var _hasError = true; + } finally{ + await _dispose(_stack, _error, _hasError); + } +}export { }; diff --git a/crates/swc/tests/tsc-references/awaitUsingDeclarations.3(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/awaitUsingDeclarations.3(target=esnext).2.minified.js new file mode 100644 index 000000000000..69929682e705 --- /dev/null +++ b/crates/swc/tests/tsc-references/awaitUsingDeclarations.3(target=esnext).2.minified.js @@ -0,0 +1,15 @@ +//// [awaitUsingDeclarations.3.ts] +import { _ as _dispose } from "@swc/helpers/_/_dispose"; +import { _ as _using } from "@swc/helpers/_/_using"; +try { + var _stack = []; + _using(_stack, { + async [Symbol.asyncDispose] () {} + }, !0), _using(_stack, null, !0), _using(_stack, void 0, !0), _using(_stack, { + [Symbol.dispose] () {} + }, !0); +} catch (_) { + var _error = _, _hasError = !0; +} finally{ + await _dispose(_stack, _error, _hasError); +} diff --git a/crates/swc/tests/tsc-references/awaitUsingDeclarationsInFor(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/awaitUsingDeclarationsInFor(target=esnext).1.normal.js new file mode 100644 index 000000000000..aa5cda8b32f8 --- /dev/null +++ b/crates/swc/tests/tsc-references/awaitUsingDeclarationsInFor(target=esnext).1.normal.js @@ -0,0 +1,11 @@ +//// [awaitUsingDeclarationsInFor.ts] +//! +//! x Expected ';', got 'd1' +//! ,-[1:1] +//! 1 | async function main() { +//! 2 | for (await using d1 = { [Symbol.dispose]() {} }, +//! : ^^ +//! 3 | d2 = { async [Symbol.asyncDispose]() {} }, +//! 4 | d3 = null, +//! 5 | d4 = undefined;;) { +//! `---- diff --git a/crates/swc/tests/tsc-references/awaitUsingDeclarationsInFor(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/awaitUsingDeclarationsInFor(target=esnext).2.minified.js new file mode 100644 index 000000000000..aa5cda8b32f8 --- /dev/null +++ b/crates/swc/tests/tsc-references/awaitUsingDeclarationsInFor(target=esnext).2.minified.js @@ -0,0 +1,11 @@ +//// [awaitUsingDeclarationsInFor.ts] +//! +//! x Expected ';', got 'd1' +//! ,-[1:1] +//! 1 | async function main() { +//! 2 | for (await using d1 = { [Symbol.dispose]() {} }, +//! : ^^ +//! 3 | d2 = { async [Symbol.asyncDispose]() {} }, +//! 4 | d3 = null, +//! 5 | d4 = undefined;;) { +//! `---- diff --git a/crates/swc/tests/tsc-references/awaitUsingDeclarationsInForAwaitOf(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/awaitUsingDeclarationsInForAwaitOf(target=esnext).1.normal.js new file mode 100644 index 000000000000..dfc5e46c1048 --- /dev/null +++ b/crates/swc/tests/tsc-references/awaitUsingDeclarationsInForAwaitOf(target=esnext).1.normal.js @@ -0,0 +1,10 @@ +//// [awaitUsingDeclarationsInForAwaitOf.ts] +//! +//! x Expected ';', got 'd1' +//! ,-[1:1] +//! 1 | async function main() { +//! 2 | for await (await using d1 of [{ async [Symbol.asyncDispose]() {} }, { [Symbol.dispose]() {} }, null, undefined]) { +//! : ^^ +//! 3 | } +//! 4 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/awaitUsingDeclarationsInForAwaitOf(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/awaitUsingDeclarationsInForAwaitOf(target=esnext).2.minified.js new file mode 100644 index 000000000000..dfc5e46c1048 --- /dev/null +++ b/crates/swc/tests/tsc-references/awaitUsingDeclarationsInForAwaitOf(target=esnext).2.minified.js @@ -0,0 +1,10 @@ +//// [awaitUsingDeclarationsInForAwaitOf.ts] +//! +//! x Expected ';', got 'd1' +//! ,-[1:1] +//! 1 | async function main() { +//! 2 | for await (await using d1 of [{ async [Symbol.asyncDispose]() {} }, { [Symbol.dispose]() {} }, null, undefined]) { +//! : ^^ +//! 3 | } +//! 4 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/awaitUsingDeclarationsInForOf.1(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/awaitUsingDeclarationsInForOf.1(target=esnext).1.normal.js new file mode 100644 index 000000000000..6fef9708f9b9 --- /dev/null +++ b/crates/swc/tests/tsc-references/awaitUsingDeclarationsInForOf.1(target=esnext).1.normal.js @@ -0,0 +1,11 @@ +//// [awaitUsingDeclarationsInForOf.1.ts] +//! +//! x Expected ';', got 'd1' +//! ,-[1:1] +//! 1 | +//! 2 | async function main() { +//! 3 | for (await using d1 of [{ async [Symbol.asyncDispose]() {} }, { [Symbol.dispose]() {} }, null, undefined]) { +//! : ^^ +//! 4 | } +//! 5 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/awaitUsingDeclarationsInForOf.1(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/awaitUsingDeclarationsInForOf.1(target=esnext).2.minified.js new file mode 100644 index 000000000000..6fef9708f9b9 --- /dev/null +++ b/crates/swc/tests/tsc-references/awaitUsingDeclarationsInForOf.1(target=esnext).2.minified.js @@ -0,0 +1,11 @@ +//// [awaitUsingDeclarationsInForOf.1.ts] +//! +//! x Expected ';', got 'd1' +//! ,-[1:1] +//! 1 | +//! 2 | async function main() { +//! 3 | for (await using d1 of [{ async [Symbol.asyncDispose]() {} }, { [Symbol.dispose]() {} }, null, undefined]) { +//! : ^^ +//! 4 | } +//! 5 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/classStaticBlock1(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/classStaticBlock1(target=esnext).1.normal.js new file mode 100644 index 000000000000..a1665595ceff --- /dev/null +++ b/crates/swc/tests/tsc-references/classStaticBlock1(target=esnext).1.normal.js @@ -0,0 +1,8 @@ +//// [classStaticBlock1.ts] +const a = 2; +class C { + static{ + const a = 1; + a; + } +} diff --git a/crates/swc/tests/tsc-references/classStaticBlock1(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/classStaticBlock1(target=esnext).2.minified.js new file mode 100644 index 000000000000..f18a42bf3645 --- /dev/null +++ b/crates/swc/tests/tsc-references/classStaticBlock1(target=esnext).2.minified.js @@ -0,0 +1 @@ +//// [classStaticBlock1.ts] diff --git a/crates/swc/tests/tsc-references/classStaticBlock10(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/classStaticBlock10(target=esnext).1.normal.js new file mode 100644 index 000000000000..6a9379bf30d7 --- /dev/null +++ b/crates/swc/tests/tsc-references/classStaticBlock10(target=esnext).1.normal.js @@ -0,0 +1,25 @@ +//// [classStaticBlock10.ts] +var a1 = 1; +var a2 = 1; +const b1 = 2; +const b2 = 2; +function f() { + var a1 = 11; + const b1 = 22; + class C1 { + static{ + var a1 = 111; + var a2 = 111; + const b1 = 222; + const b2 = 222; + } + } +} +class C2 { + static{ + var a1 = 111; + var a2 = 111; + const b1 = 222; + const b2 = 222; + } +} diff --git a/crates/swc/tests/tsc-references/classStaticBlock10(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/classStaticBlock10(target=esnext).2.minified.js new file mode 100644 index 000000000000..e5a5debef35e --- /dev/null +++ b/crates/swc/tests/tsc-references/classStaticBlock10(target=esnext).2.minified.js @@ -0,0 +1 @@ +//// [classStaticBlock10.ts] diff --git a/crates/swc/tests/tsc-references/classStaticBlock11(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/classStaticBlock11(target=esnext).1.normal.js new file mode 100644 index 000000000000..25b5621362df --- /dev/null +++ b/crates/swc/tests/tsc-references/classStaticBlock11(target=esnext).1.normal.js @@ -0,0 +1,13 @@ +//// [classStaticBlock11.ts] +let getX; +class C { + #x; + constructor(x){ + this.#x = 1; + this.#x = x; + } + static{ + // getX has privileged access to #x + getX = (obj)=>obj.#x; + } +} diff --git a/crates/swc/tests/tsc-references/classStaticBlock11(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/classStaticBlock11(target=esnext).2.minified.js new file mode 100644 index 000000000000..252c8007d10c --- /dev/null +++ b/crates/swc/tests/tsc-references/classStaticBlock11(target=esnext).2.minified.js @@ -0,0 +1 @@ +//// [classStaticBlock11.ts] diff --git a/crates/swc/tests/tsc-references/classStaticBlock13(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/classStaticBlock13(target=esnext).1.normal.js new file mode 100644 index 000000000000..1abbd26d7d67 --- /dev/null +++ b/crates/swc/tests/tsc-references/classStaticBlock13(target=esnext).1.normal.js @@ -0,0 +1,10 @@ +//// [classStaticBlock13.ts] +class C { + static #x = 123; + static{ + console.log(C.#x); + } + foo() { + return C.#x; + } +} diff --git a/crates/swc/tests/tsc-references/classStaticBlock13(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/classStaticBlock13(target=esnext).2.minified.js new file mode 100644 index 000000000000..1abbd26d7d67 --- /dev/null +++ b/crates/swc/tests/tsc-references/classStaticBlock13(target=esnext).2.minified.js @@ -0,0 +1,10 @@ +//// [classStaticBlock13.ts] +class C { + static #x = 123; + static{ + console.log(C.#x); + } + foo() { + return C.#x; + } +} diff --git a/crates/swc/tests/tsc-references/classStaticBlock15(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/classStaticBlock15(target=esnext).1.normal.js new file mode 100644 index 000000000000..5d81bb8b8d10 --- /dev/null +++ b/crates/swc/tests/tsc-references/classStaticBlock15(target=esnext).1.normal.js @@ -0,0 +1,14 @@ +//// [classStaticBlock15.ts] +var _C__1; +class C { + static #_1 = 1; + static #_3 = 3; + static #_5 = 5; + static{} + static{} + static{} + static{} + static{} + static{} +} +console.log(_C__1); diff --git a/crates/swc/tests/tsc-references/classStaticBlock15(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/classStaticBlock15(target=esnext).2.minified.js new file mode 100644 index 000000000000..5547fe278b87 --- /dev/null +++ b/crates/swc/tests/tsc-references/classStaticBlock15(target=esnext).2.minified.js @@ -0,0 +1,8 @@ +//// [classStaticBlock15.ts] +var _C__1; +class C { + static #_1 = 1; + static #_3 = 3; + static #_5 = 5; +} +console.log(_C__1); diff --git a/crates/swc/tests/tsc-references/classStaticBlock18(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/classStaticBlock18(target=esnext).1.normal.js new file mode 100644 index 000000000000..164dabb1a9ad --- /dev/null +++ b/crates/swc/tests/tsc-references/classStaticBlock18(target=esnext).1.normal.js @@ -0,0 +1,18 @@ +//// [classStaticBlock18.ts] +function foo() { + return class { + static{ + this.foo = 1; + } + static{ + const c = class { + static{ + this.bar = 2; + } + static{ + // do + } + }; + } + }; +} diff --git a/crates/swc/tests/tsc-references/classStaticBlock18(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/classStaticBlock18(target=esnext).2.minified.js new file mode 100644 index 000000000000..4bca4c5253dc --- /dev/null +++ b/crates/swc/tests/tsc-references/classStaticBlock18(target=esnext).2.minified.js @@ -0,0 +1 @@ +//// [classStaticBlock18.ts] diff --git a/crates/swc/tests/tsc-references/classStaticBlock2(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/classStaticBlock2(target=esnext).1.normal.js new file mode 100644 index 000000000000..ec68f86277fa --- /dev/null +++ b/crates/swc/tests/tsc-references/classStaticBlock2(target=esnext).1.normal.js @@ -0,0 +1,15 @@ +//// [classStaticBlock2.ts] +const a = 1; +const b = 2; +class C { + static{ + const a = 11; + a; + b; + } + static{ + const a = 11; + a; + b; + } +} diff --git a/crates/swc/tests/tsc-references/classStaticBlock2(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/classStaticBlock2(target=esnext).2.minified.js new file mode 100644 index 000000000000..05524253ee46 --- /dev/null +++ b/crates/swc/tests/tsc-references/classStaticBlock2(target=esnext).2.minified.js @@ -0,0 +1 @@ +//// [classStaticBlock2.ts] diff --git a/crates/swc/tests/tsc-references/classStaticBlock25(target=es2022).1.normal.js b/crates/swc/tests/tsc-references/classStaticBlock25(target=es2022).1.normal.js new file mode 100644 index 000000000000..98c19f4ebafc --- /dev/null +++ b/crates/swc/tests/tsc-references/classStaticBlock25(target=es2022).1.normal.js @@ -0,0 +1,15 @@ +//// [classStaticBlock25.ts] +const a = 1; +const b = 2; +class C { + static{ + const a = 11; + a; + b; + } + static{ + const a = 11; + a; + b; + } +} diff --git a/crates/swc/tests/tsc-references/classStaticBlock25(target=es2022).2.minified.js b/crates/swc/tests/tsc-references/classStaticBlock25(target=es2022).2.minified.js new file mode 100644 index 000000000000..b9175fd007e2 --- /dev/null +++ b/crates/swc/tests/tsc-references/classStaticBlock25(target=es2022).2.minified.js @@ -0,0 +1 @@ +//// [classStaticBlock25.ts] diff --git a/crates/swc/tests/tsc-references/classStaticBlock25(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/classStaticBlock25(target=esnext).1.normal.js new file mode 100644 index 000000000000..98c19f4ebafc --- /dev/null +++ b/crates/swc/tests/tsc-references/classStaticBlock25(target=esnext).1.normal.js @@ -0,0 +1,15 @@ +//// [classStaticBlock25.ts] +const a = 1; +const b = 2; +class C { + static{ + const a = 11; + a; + b; + } + static{ + const a = 11; + a; + b; + } +} diff --git a/crates/swc/tests/tsc-references/classStaticBlock25(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/classStaticBlock25(target=esnext).2.minified.js new file mode 100644 index 000000000000..b9175fd007e2 --- /dev/null +++ b/crates/swc/tests/tsc-references/classStaticBlock25(target=esnext).2.minified.js @@ -0,0 +1 @@ +//// [classStaticBlock25.ts] diff --git a/crates/swc/tests/tsc-references/classStaticBlock3(target=es2022).1.normal.js b/crates/swc/tests/tsc-references/classStaticBlock3(target=es2022).1.normal.js new file mode 100644 index 000000000000..967cc1f1e769 --- /dev/null +++ b/crates/swc/tests/tsc-references/classStaticBlock3(target=es2022).1.normal.js @@ -0,0 +1,19 @@ +//// [classStaticBlock3.ts] +const a = 1; +class C { + static{ + this.f1 = 1; + } + static{ + console.log(C.f1, C.f2, C.f3); + } + static{ + this.f2 = 2; + } + static{ + console.log(C.f1, C.f2, C.f3); + } + static{ + this.f3 = 3; + } +} diff --git a/crates/swc/tests/tsc-references/classStaticBlock3(target=es2022).2.minified.js b/crates/swc/tests/tsc-references/classStaticBlock3(target=es2022).2.minified.js new file mode 100644 index 000000000000..ebfc0930eaa0 --- /dev/null +++ b/crates/swc/tests/tsc-references/classStaticBlock3(target=es2022).2.minified.js @@ -0,0 +1,18 @@ +//// [classStaticBlock3.ts] +class C { + static{ + this.f1 = 1; + } + static{ + console.log(C.f1, C.f2, C.f3); + } + static{ + this.f2 = 2; + } + static{ + console.log(C.f1, C.f2, C.f3); + } + static{ + this.f3 = 3; + } +} diff --git a/crates/swc/tests/tsc-references/classStaticBlock3(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/classStaticBlock3(target=esnext).1.normal.js new file mode 100644 index 000000000000..967cc1f1e769 --- /dev/null +++ b/crates/swc/tests/tsc-references/classStaticBlock3(target=esnext).1.normal.js @@ -0,0 +1,19 @@ +//// [classStaticBlock3.ts] +const a = 1; +class C { + static{ + this.f1 = 1; + } + static{ + console.log(C.f1, C.f2, C.f3); + } + static{ + this.f2 = 2; + } + static{ + console.log(C.f1, C.f2, C.f3); + } + static{ + this.f3 = 3; + } +} diff --git a/crates/swc/tests/tsc-references/classStaticBlock3(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/classStaticBlock3(target=esnext).2.minified.js new file mode 100644 index 000000000000..ebfc0930eaa0 --- /dev/null +++ b/crates/swc/tests/tsc-references/classStaticBlock3(target=esnext).2.minified.js @@ -0,0 +1,18 @@ +//// [classStaticBlock3.ts] +class C { + static{ + this.f1 = 1; + } + static{ + console.log(C.f1, C.f2, C.f3); + } + static{ + this.f2 = 2; + } + static{ + console.log(C.f1, C.f2, C.f3); + } + static{ + this.f3 = 3; + } +} diff --git a/crates/swc/tests/tsc-references/classStaticBlock4(target=es2022).1.normal.js b/crates/swc/tests/tsc-references/classStaticBlock4(target=es2022).1.normal.js new file mode 100644 index 000000000000..4073e3cf37ee --- /dev/null +++ b/crates/swc/tests/tsc-references/classStaticBlock4(target=es2022).1.normal.js @@ -0,0 +1,18 @@ +//// [classStaticBlock4.ts] +class C { + static{ + this.s1 = 1; + } + static{ + this.s1; + C.s1; + this.s2; + C.s2; + } + static{ + this.s2 = 2; + } + static{ + this.ss2 = this.s1; + } +} diff --git a/crates/swc/tests/tsc-references/classStaticBlock4(target=es2022).2.minified.js b/crates/swc/tests/tsc-references/classStaticBlock4(target=es2022).2.minified.js new file mode 100644 index 000000000000..8594da83dc55 --- /dev/null +++ b/crates/swc/tests/tsc-references/classStaticBlock4(target=es2022).2.minified.js @@ -0,0 +1,15 @@ +//// [classStaticBlock4.ts] +class C { + static{ + this.s1 = 1; + } + static{ + this.s1, C.s1, this.s2, C.s2; + } + static{ + this.s2 = 2; + } + static{ + this.ss2 = this.s1; + } +} diff --git a/crates/swc/tests/tsc-references/classStaticBlock4(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/classStaticBlock4(target=esnext).1.normal.js new file mode 100644 index 000000000000..4073e3cf37ee --- /dev/null +++ b/crates/swc/tests/tsc-references/classStaticBlock4(target=esnext).1.normal.js @@ -0,0 +1,18 @@ +//// [classStaticBlock4.ts] +class C { + static{ + this.s1 = 1; + } + static{ + this.s1; + C.s1; + this.s2; + C.s2; + } + static{ + this.s2 = 2; + } + static{ + this.ss2 = this.s1; + } +} diff --git a/crates/swc/tests/tsc-references/classStaticBlock4(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/classStaticBlock4(target=esnext).2.minified.js new file mode 100644 index 000000000000..8594da83dc55 --- /dev/null +++ b/crates/swc/tests/tsc-references/classStaticBlock4(target=esnext).2.minified.js @@ -0,0 +1,15 @@ +//// [classStaticBlock4.ts] +class C { + static{ + this.s1 = 1; + } + static{ + this.s1, C.s1, this.s2, C.s2; + } + static{ + this.s2 = 2; + } + static{ + this.ss2 = this.s1; + } +} diff --git a/crates/swc/tests/tsc-references/classStaticBlock5(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/classStaticBlock5(target=esnext).1.normal.js new file mode 100644 index 000000000000..9efba44ac3e0 --- /dev/null +++ b/crates/swc/tests/tsc-references/classStaticBlock5(target=esnext).1.normal.js @@ -0,0 +1,22 @@ +//// [classStaticBlock5.ts] +class B { + static{ + this.a = 1; + } + static{ + this.b = 2; + } +} +class C extends B { + static{ + this.b = 3; + } + static{ + this.c = super.a; + } + static{ + this.b; + super.b; + super.a; + } +} diff --git a/crates/swc/tests/tsc-references/classStaticBlock5(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/classStaticBlock5(target=esnext).2.minified.js new file mode 100644 index 000000000000..0bfcebbe1892 --- /dev/null +++ b/crates/swc/tests/tsc-references/classStaticBlock5(target=esnext).2.minified.js @@ -0,0 +1,20 @@ +//// [classStaticBlock5.ts] +class B { + static{ + this.a = 1; + } + static{ + this.b = 2; + } +} +class C extends B { + static{ + this.b = 3; + } + static{ + this.c = super.a; + } + static{ + this.b, super.b, super.a; + } +} diff --git a/crates/swc/tests/tsc-references/classStaticBlock9(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/classStaticBlock9(target=esnext).1.normal.js new file mode 100644 index 000000000000..9c22839c208d --- /dev/null +++ b/crates/swc/tests/tsc-references/classStaticBlock9(target=esnext).1.normal.js @@ -0,0 +1,12 @@ +//// [classStaticBlock9.ts] +class A { + static{ + this.bar = A.foo + 1; + } + static{ + A.foo + 2; + } + static{ + this.foo = 1; + } +} diff --git a/crates/swc/tests/tsc-references/classStaticBlock9(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/classStaticBlock9(target=esnext).2.minified.js new file mode 100644 index 000000000000..2be2113955bc --- /dev/null +++ b/crates/swc/tests/tsc-references/classStaticBlock9(target=esnext).2.minified.js @@ -0,0 +1,12 @@ +//// [classStaticBlock9.ts] +class A { + static{ + this.bar = A.foo + 1; + } + static{ + A.foo; + } + static{ + this.foo = 1; + } +} diff --git a/crates/swc/tests/tsc-references/classStaticBlockUseBeforeDef2(target=es2022).1.normal.js b/crates/swc/tests/tsc-references/classStaticBlockUseBeforeDef2(target=es2022).1.normal.js new file mode 100644 index 000000000000..6b8024701eb8 --- /dev/null +++ b/crates/swc/tests/tsc-references/classStaticBlockUseBeforeDef2(target=es2022).1.normal.js @@ -0,0 +1,6 @@ +//// [classStaticBlockUseBeforeDef2.ts] +class C { + static{ + this.x = 1; + } +} diff --git a/crates/swc/tests/tsc-references/classStaticBlockUseBeforeDef2(target=es2022).2.minified.js b/crates/swc/tests/tsc-references/classStaticBlockUseBeforeDef2(target=es2022).2.minified.js new file mode 100644 index 000000000000..6b8024701eb8 --- /dev/null +++ b/crates/swc/tests/tsc-references/classStaticBlockUseBeforeDef2(target=es2022).2.minified.js @@ -0,0 +1,6 @@ +//// [classStaticBlockUseBeforeDef2.ts] +class C { + static{ + this.x = 1; + } +} diff --git a/crates/swc/tests/tsc-references/classStaticBlockUseBeforeDef2(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/classStaticBlockUseBeforeDef2(target=esnext).1.normal.js new file mode 100644 index 000000000000..6b8024701eb8 --- /dev/null +++ b/crates/swc/tests/tsc-references/classStaticBlockUseBeforeDef2(target=esnext).1.normal.js @@ -0,0 +1,6 @@ +//// [classStaticBlockUseBeforeDef2.ts] +class C { + static{ + this.x = 1; + } +} diff --git a/crates/swc/tests/tsc-references/classStaticBlockUseBeforeDef2(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/classStaticBlockUseBeforeDef2(target=esnext).2.minified.js new file mode 100644 index 000000000000..6b8024701eb8 --- /dev/null +++ b/crates/swc/tests/tsc-references/classStaticBlockUseBeforeDef2(target=esnext).2.minified.js @@ -0,0 +1,6 @@ +//// [classStaticBlockUseBeforeDef2.ts] +class C { + static{ + this.x = 1; + } +} diff --git a/crates/swc/tests/tsc-references/classWithStaticFieldInParameterBindingPattern(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/classWithStaticFieldInParameterBindingPattern(target=esnext).1.normal.js new file mode 100644 index 000000000000..b714f2730ec1 --- /dev/null +++ b/crates/swc/tests/tsc-references/classWithStaticFieldInParameterBindingPattern(target=esnext).1.normal.js @@ -0,0 +1,7 @@ +//// [classWithStaticFieldInParameterBindingPattern.ts] +// https://github.com/microsoft/TypeScript/issues/36295 +(({ [(class { + static{ + this.x = 1; + } +}).x]: b = "" })=>{})(); diff --git a/crates/swc/tests/tsc-references/classWithStaticFieldInParameterBindingPattern(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/classWithStaticFieldInParameterBindingPattern(target=esnext).2.minified.js new file mode 100644 index 000000000000..d1948cb93946 --- /dev/null +++ b/crates/swc/tests/tsc-references/classWithStaticFieldInParameterBindingPattern(target=esnext).2.minified.js @@ -0,0 +1 @@ +//// [classWithStaticFieldInParameterBindingPattern.ts] diff --git a/crates/swc/tests/tsc-references/classWithStaticFieldInParameterBindingPattern.2(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/classWithStaticFieldInParameterBindingPattern.2(target=esnext).1.normal.js new file mode 100644 index 000000000000..3a4e18500d2a --- /dev/null +++ b/crates/swc/tests/tsc-references/classWithStaticFieldInParameterBindingPattern.2(target=esnext).1.normal.js @@ -0,0 +1,19 @@ +//// [classWithStaticFieldInParameterBindingPattern.2.ts] +// https://github.com/microsoft/TypeScript/issues/36295 +class C { +} +(({ [(class extends C { + static{ + this.x = 1; + } +}).x]: b = "" })=>{ + var C1; +})(); +const x = ""; +(({ [(class extends C { + static{ + this.x = 1; + } +}).x]: b = "" }, d = x)=>{ + var x1; +})(); diff --git a/crates/swc/tests/tsc-references/classWithStaticFieldInParameterBindingPattern.2(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/classWithStaticFieldInParameterBindingPattern.2(target=esnext).2.minified.js new file mode 100644 index 000000000000..f65da2c4fb80 --- /dev/null +++ b/crates/swc/tests/tsc-references/classWithStaticFieldInParameterBindingPattern.2(target=esnext).2.minified.js @@ -0,0 +1 @@ +//// [classWithStaticFieldInParameterBindingPattern.2.ts] diff --git a/crates/swc/tests/tsc-references/classWithStaticFieldInParameterInitializer(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/classWithStaticFieldInParameterInitializer(target=esnext).1.normal.js new file mode 100644 index 000000000000..69790e448fc0 --- /dev/null +++ b/crates/swc/tests/tsc-references/classWithStaticFieldInParameterInitializer(target=esnext).1.normal.js @@ -0,0 +1,7 @@ +//// [classWithStaticFieldInParameterInitializer.ts] +// https://github.com/microsoft/TypeScript/issues/36295 +((b = class { + static{ + this.x = 1; + } +})=>{})(); diff --git a/crates/swc/tests/tsc-references/classWithStaticFieldInParameterInitializer(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/classWithStaticFieldInParameterInitializer(target=esnext).2.minified.js new file mode 100644 index 000000000000..aa988471697c --- /dev/null +++ b/crates/swc/tests/tsc-references/classWithStaticFieldInParameterInitializer(target=esnext).2.minified.js @@ -0,0 +1 @@ +//// [classWithStaticFieldInParameterInitializer.ts] diff --git a/crates/swc/tests/tsc-references/classWithStaticFieldInParameterInitializer.2(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/classWithStaticFieldInParameterInitializer.2(target=esnext).1.normal.js new file mode 100644 index 000000000000..0d06bc33ab93 --- /dev/null +++ b/crates/swc/tests/tsc-references/classWithStaticFieldInParameterInitializer.2(target=esnext).1.normal.js @@ -0,0 +1,19 @@ +//// [classWithStaticFieldInParameterInitializer.2.ts] +// https://github.com/microsoft/TypeScript/issues/36295 +class C { +} +((b = class extends C { + static{ + this.x = 1; + } +})=>{ + var C1; +})(); +const x = ""; +((b = class extends C { + static{ + this.x = 1; + } +}, d = x)=>{ + var x1; +})(); diff --git a/crates/swc/tests/tsc-references/classWithStaticFieldInParameterInitializer.2(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/classWithStaticFieldInParameterInitializer.2(target=esnext).2.minified.js new file mode 100644 index 000000000000..5e2bd513bffc --- /dev/null +++ b/crates/swc/tests/tsc-references/classWithStaticFieldInParameterInitializer.2(target=esnext).2.minified.js @@ -0,0 +1 @@ +//// [classWithStaticFieldInParameterInitializer.2.ts] diff --git a/crates/swc/tests/tsc-references/defineProperty(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/defineProperty(target=esnext).1.normal.js new file mode 100644 index 000000000000..fd54e1597599 --- /dev/null +++ b/crates/swc/tests/tsc-references/defineProperty(target=esnext).1.normal.js @@ -0,0 +1,34 @@ +//// [defineProperty.ts] +var x = "p"; +let _x = x; +class A { + y; + a; + b; + c; + ["computed"]; + [_x]; + m() {} + constructor(y){ + this.y = y; + this.a = this.y; + this["computed"] = 13; + this[_x] = 14; + this.z = this.y; + } + z; +} +class B { + a; +} +class C extends B { + ka; + z; + constructor(ka){ + super(); + this.ka = ka; + this.z = this.ka; + this.ki = this.ka; + } + ki; +} diff --git a/crates/swc/tests/tsc-references/defineProperty(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/defineProperty(target=esnext).2.minified.js new file mode 100644 index 000000000000..a3636043739a --- /dev/null +++ b/crates/swc/tests/tsc-references/defineProperty(target=esnext).2.minified.js @@ -0,0 +1 @@ +//// [defineProperty.ts] diff --git a/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment6(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment6(target=esnext).1.normal.js new file mode 100644 index 000000000000..4a360a6d7585 --- /dev/null +++ b/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment6(target=esnext).1.normal.js @@ -0,0 +1,10 @@ +//// [destructuringObjectBindingPatternAndAssignment6.ts] +const a = "a"; +const b = "b"; +const { [a]: aVal, [b]: bVal } = (()=>{ + return { + [a]: 1, + [b]: 1 + }; +})(); +console.log(aVal, bVal); diff --git a/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment6(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment6(target=esnext).2.minified.js new file mode 100644 index 000000000000..fab1c60fb246 --- /dev/null +++ b/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment6(target=esnext).2.minified.js @@ -0,0 +1,6 @@ +//// [destructuringObjectBindingPatternAndAssignment6.ts] +const { a: aVal, b: bVal } = { + a: 1, + b: 1 +}; +console.log(aVal, bVal); diff --git a/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment7(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment7(target=esnext).1.normal.js new file mode 100644 index 000000000000..32f87e1602e2 --- /dev/null +++ b/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment7(target=esnext).1.normal.js @@ -0,0 +1,13 @@ +//// [destructuringObjectBindingPatternAndAssignment7.ts] +var K; +(function(K) { + K["a"] = "a"; + K["b"] = "b"; +})(K || (K = {})); +const { ["a"]: aVal, ["b"]: bVal } = (()=>{ + return { + ["a"]: 1, + ["b"]: 1 + }; +})(); +console.log(aVal, bVal); diff --git a/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment7(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment7(target=esnext).2.minified.js new file mode 100644 index 000000000000..70138587b574 --- /dev/null +++ b/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment7(target=esnext).2.minified.js @@ -0,0 +1,8 @@ +//// [destructuringObjectBindingPatternAndAssignment7.ts] +var K, K1; +(K1 = K || (K = {})).a = "a", K1.b = "b"; +const { a: aVal, b: bVal } = { + a: 1, + b: 1 +}; +console.log(aVal, bVal); diff --git a/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment8(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment8(target=esnext).1.normal.js new file mode 100644 index 000000000000..a1ad2e532234 --- /dev/null +++ b/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment8(target=esnext).1.normal.js @@ -0,0 +1,12 @@ +//// [destructuringObjectBindingPatternAndAssignment8.ts] +const K = { + a: "a", + b: "b" +}; +const { [K.a]: aVal, [K.b]: bVal } = (()=>{ + return { + [K.a]: 1, + [K.b]: 1 + }; +})(); +console.log(aVal, bVal); diff --git a/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment8(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment8(target=esnext).2.minified.js new file mode 100644 index 000000000000..55eb47b4046f --- /dev/null +++ b/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment8(target=esnext).2.minified.js @@ -0,0 +1,6 @@ +//// [destructuringObjectBindingPatternAndAssignment8.ts] +const { a: aVal, b: bVal } = { + a: 1, + b: 1 +}; +console.log(aVal, bVal); diff --git a/crates/swc/tests/tsc-references/esDecorators-classDeclaration-accessors-nonStatic(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-accessors-nonStatic(target=esnext).1.normal.js new file mode 100644 index 000000000000..24935b9b0612 --- /dev/null +++ b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-accessors-nonStatic(target=esnext).1.normal.js @@ -0,0 +1,13 @@ +//// [esDecorators-classDeclaration-accessors-nonStatic.ts] +//! +//! x Unexpected token `@`. Expected identifier, string literal, numeric literal or [ for the computed key +//! ,-[4:1] +//! 4 | const method3 = "method3"; +//! 5 | +//! 6 | class C { +//! 7 | @dec(11) get method1() { return 0; } +//! : ^ +//! 8 | @dec(12) set method1(value) {} +//! 9 | @dec(21) get ["method2"]() { return 0; } +//! 10 | @dec(22) set ["method2"](value) {} +//! `---- diff --git a/crates/swc/tests/tsc-references/esDecorators-classDeclaration-accessors-nonStatic(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-accessors-nonStatic(target=esnext).2.minified.js new file mode 100644 index 000000000000..24935b9b0612 --- /dev/null +++ b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-accessors-nonStatic(target=esnext).2.minified.js @@ -0,0 +1,13 @@ +//// [esDecorators-classDeclaration-accessors-nonStatic.ts] +//! +//! x Unexpected token `@`. Expected identifier, string literal, numeric literal or [ for the computed key +//! ,-[4:1] +//! 4 | const method3 = "method3"; +//! 5 | +//! 6 | class C { +//! 7 | @dec(11) get method1() { return 0; } +//! : ^ +//! 8 | @dec(12) set method1(value) {} +//! 9 | @dec(21) get ["method2"]() { return 0; } +//! 10 | @dec(22) set ["method2"](value) {} +//! `---- diff --git a/crates/swc/tests/tsc-references/esDecorators-classDeclaration-accessors-nonStaticPrivate(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-accessors-nonStaticPrivate(target=esnext).1.normal.js new file mode 100644 index 000000000000..23a440a6bbc7 --- /dev/null +++ b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-accessors-nonStaticPrivate(target=esnext).1.normal.js @@ -0,0 +1,12 @@ +//// [esDecorators-classDeclaration-accessors-nonStaticPrivate.ts] +//! +//! x Unexpected token `@`. Expected identifier, string literal, numeric literal or [ for the computed key +//! ,-[2:1] +//! 2 | declare let dec: any; +//! 3 | +//! 4 | class C { +//! 5 | @dec(1) get #method1() { return 0; } +//! : ^ +//! 6 | @dec(2) set #method1(value) {} +//! 7 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/esDecorators-classDeclaration-accessors-nonStaticPrivate(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-accessors-nonStaticPrivate(target=esnext).2.minified.js new file mode 100644 index 000000000000..23a440a6bbc7 --- /dev/null +++ b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-accessors-nonStaticPrivate(target=esnext).2.minified.js @@ -0,0 +1,12 @@ +//// [esDecorators-classDeclaration-accessors-nonStaticPrivate.ts] +//! +//! x Unexpected token `@`. Expected identifier, string literal, numeric literal or [ for the computed key +//! ,-[2:1] +//! 2 | declare let dec: any; +//! 3 | +//! 4 | class C { +//! 5 | @dec(1) get #method1() { return 0; } +//! : ^ +//! 6 | @dec(2) set #method1(value) {} +//! 7 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/esDecorators-classDeclaration-accessors-static(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-accessors-static(target=esnext).1.normal.js new file mode 100644 index 000000000000..be7b284e5093 --- /dev/null +++ b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-accessors-static(target=esnext).1.normal.js @@ -0,0 +1,13 @@ +//// [esDecorators-classDeclaration-accessors-static.ts] +//! +//! x Unexpected token `@`. Expected identifier, string literal, numeric literal or [ for the computed key +//! ,-[4:1] +//! 4 | const method3 = "method3"; +//! 5 | +//! 6 | class C { +//! 7 | @dec(11) static get method1() { return 0; } +//! : ^ +//! 8 | @dec(12) static set method1(value) {} +//! 9 | @dec(21) static get ["method2"]() { return 0; } +//! 10 | @dec(22) static set ["method2"](value) {} +//! `---- diff --git a/crates/swc/tests/tsc-references/esDecorators-classDeclaration-accessors-static(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-accessors-static(target=esnext).2.minified.js new file mode 100644 index 000000000000..be7b284e5093 --- /dev/null +++ b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-accessors-static(target=esnext).2.minified.js @@ -0,0 +1,13 @@ +//// [esDecorators-classDeclaration-accessors-static.ts] +//! +//! x Unexpected token `@`. Expected identifier, string literal, numeric literal or [ for the computed key +//! ,-[4:1] +//! 4 | const method3 = "method3"; +//! 5 | +//! 6 | class C { +//! 7 | @dec(11) static get method1() { return 0; } +//! : ^ +//! 8 | @dec(12) static set method1(value) {} +//! 9 | @dec(21) static get ["method2"]() { return 0; } +//! 10 | @dec(22) static set ["method2"](value) {} +//! `---- diff --git a/crates/swc/tests/tsc-references/esDecorators-classDeclaration-accessors-staticPrivate(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-accessors-staticPrivate(target=esnext).1.normal.js new file mode 100644 index 000000000000..7ab32ff88f92 --- /dev/null +++ b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-accessors-staticPrivate(target=esnext).1.normal.js @@ -0,0 +1,12 @@ +//// [esDecorators-classDeclaration-accessors-staticPrivate.ts] +//! +//! x Unexpected token `@`. Expected identifier, string literal, numeric literal or [ for the computed key +//! ,-[2:1] +//! 2 | declare let dec: any; +//! 3 | +//! 4 | class C { +//! 5 | @dec(1) static get #method1() { return 0; } +//! : ^ +//! 6 | @dec(2) static set #method1(value) {} +//! 7 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/esDecorators-classDeclaration-accessors-staticPrivate(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-accessors-staticPrivate(target=esnext).2.minified.js new file mode 100644 index 000000000000..7ab32ff88f92 --- /dev/null +++ b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-accessors-staticPrivate(target=esnext).2.minified.js @@ -0,0 +1,12 @@ +//// [esDecorators-classDeclaration-accessors-staticPrivate.ts] +//! +//! x Unexpected token `@`. Expected identifier, string literal, numeric literal or [ for the computed key +//! ,-[2:1] +//! 2 | declare let dec: any; +//! 3 | +//! 4 | class C { +//! 5 | @dec(1) static get #method1() { return 0; } +//! : ^ +//! 6 | @dec(2) static set #method1(value) {} +//! 7 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/esDecorators-classDeclaration-classThisReference(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-classThisReference(target=esnext).1.normal.js new file mode 100644 index 000000000000..6d9201e19bbc --- /dev/null +++ b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-classThisReference(target=esnext).1.normal.js @@ -0,0 +1,13 @@ +//// [esDecorators-classDeclaration-classThisReference.ts] +//! +//! x Expression expected +//! ,-[1:1] +//! 1 | +//! 2 | declare let dec: any; +//! 3 | +//! 4 | @dec +//! : ^ +//! 5 | class C { +//! 6 | static { this; } +//! 7 | static x: any = this; +//! `---- diff --git a/crates/swc/tests/tsc-references/esDecorators-classDeclaration-classThisReference(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-classThisReference(target=esnext).2.minified.js new file mode 100644 index 000000000000..6d9201e19bbc --- /dev/null +++ b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-classThisReference(target=esnext).2.minified.js @@ -0,0 +1,13 @@ +//// [esDecorators-classDeclaration-classThisReference.ts] +//! +//! x Expression expected +//! ,-[1:1] +//! 1 | +//! 2 | declare let dec: any; +//! 3 | +//! 4 | @dec +//! : ^ +//! 5 | class C { +//! 6 | static { this; } +//! 7 | static x: any = this; +//! `---- diff --git a/crates/swc/tests/tsc-references/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=esnext).1.normal.js new file mode 100644 index 000000000000..111864bfc9ed --- /dev/null +++ b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=esnext).1.normal.js @@ -0,0 +1,40 @@ +//// [esDecorators-classDeclaration-commentPreservation.ts] +"use strict"; +//// [file1.ts] +//! +//! x Expression expected +//! ,-[2:1] +//! 2 | declare var dec: any; +//! 3 | +//! 4 | /*1*/ +//! 5 | @dec +//! : ^ +//! 6 | /*2*/ +//! 7 | @dec +//! 8 | /*3*/ +//! `---- +//// [file2.ts] +//! +//! x Expression expected +//! ,-[1:1] +//! 1 | +//! 2 | /*34*/ +//! 3 | @dec +//! : ^ +//! 4 | /*35*/ +//! 5 | @dec +//! 6 | /*36*/ +//! `---- +//// [file3.ts] +//! +//! x Expected '{', got '@' +//! ,-[2:1] +//! 2 | /*40*/ +//! 3 | export +//! 4 | /*41*/ +//! 5 | @dec +//! : ^ +//! 6 | /*42*/ +//! 7 | @dec +//! 8 | /*43*/ +//! `---- diff --git a/crates/swc/tests/tsc-references/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=esnext).2.minified.js new file mode 100644 index 000000000000..52a65af62dd9 --- /dev/null +++ b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-commentPreservation(module=commonjs,target=esnext).2.minified.js @@ -0,0 +1,39 @@ +//// [esDecorators-classDeclaration-commentPreservation.ts] +//// [file1.ts] +//! +//! x Expression expected +//! ,-[2:1] +//! 2 | declare var dec: any; +//! 3 | +//! 4 | /*1*/ +//! 5 | @dec +//! : ^ +//! 6 | /*2*/ +//! 7 | @dec +//! 8 | /*3*/ +//! `---- +//// [file2.ts] +//! +//! x Expression expected +//! ,-[1:1] +//! 1 | +//! 2 | /*34*/ +//! 3 | @dec +//! : ^ +//! 4 | /*35*/ +//! 5 | @dec +//! 6 | /*36*/ +//! `---- +//// [file3.ts] +//! +//! x Expected '{', got '@' +//! ,-[2:1] +//! 2 | /*40*/ +//! 3 | export +//! 4 | /*41*/ +//! 5 | @dec +//! : ^ +//! 6 | /*42*/ +//! 7 | @dec +//! 8 | /*43*/ +//! `---- diff --git a/crates/swc/tests/tsc-references/esDecorators-classDeclaration-commentPreservation(module=es6,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-commentPreservation(module=es6,target=esnext).1.normal.js new file mode 100644 index 000000000000..52a65af62dd9 --- /dev/null +++ b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-commentPreservation(module=es6,target=esnext).1.normal.js @@ -0,0 +1,39 @@ +//// [esDecorators-classDeclaration-commentPreservation.ts] +//// [file1.ts] +//! +//! x Expression expected +//! ,-[2:1] +//! 2 | declare var dec: any; +//! 3 | +//! 4 | /*1*/ +//! 5 | @dec +//! : ^ +//! 6 | /*2*/ +//! 7 | @dec +//! 8 | /*3*/ +//! `---- +//// [file2.ts] +//! +//! x Expression expected +//! ,-[1:1] +//! 1 | +//! 2 | /*34*/ +//! 3 | @dec +//! : ^ +//! 4 | /*35*/ +//! 5 | @dec +//! 6 | /*36*/ +//! `---- +//// [file3.ts] +//! +//! x Expected '{', got '@' +//! ,-[2:1] +//! 2 | /*40*/ +//! 3 | export +//! 4 | /*41*/ +//! 5 | @dec +//! : ^ +//! 6 | /*42*/ +//! 7 | @dec +//! 8 | /*43*/ +//! `---- diff --git a/crates/swc/tests/tsc-references/esDecorators-classDeclaration-commentPreservation(module=es6,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-commentPreservation(module=es6,target=esnext).2.minified.js new file mode 100644 index 000000000000..52a65af62dd9 --- /dev/null +++ b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-commentPreservation(module=es6,target=esnext).2.minified.js @@ -0,0 +1,39 @@ +//// [esDecorators-classDeclaration-commentPreservation.ts] +//// [file1.ts] +//! +//! x Expression expected +//! ,-[2:1] +//! 2 | declare var dec: any; +//! 3 | +//! 4 | /*1*/ +//! 5 | @dec +//! : ^ +//! 6 | /*2*/ +//! 7 | @dec +//! 8 | /*3*/ +//! `---- +//// [file2.ts] +//! +//! x Expression expected +//! ,-[1:1] +//! 1 | +//! 2 | /*34*/ +//! 3 | @dec +//! : ^ +//! 4 | /*35*/ +//! 5 | @dec +//! 6 | /*36*/ +//! `---- +//// [file3.ts] +//! +//! x Expected '{', got '@' +//! ,-[2:1] +//! 2 | /*40*/ +//! 3 | export +//! 4 | /*41*/ +//! 5 | @dec +//! : ^ +//! 6 | /*42*/ +//! 7 | @dec +//! 8 | /*43*/ +//! `---- diff --git a/crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-nonStatic(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-nonStatic(target=esnext).1.normal.js new file mode 100644 index 000000000000..ba1401ba4acb --- /dev/null +++ b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-nonStatic(target=esnext).1.normal.js @@ -0,0 +1,13 @@ +//// [esDecorators-classDeclaration-fields-nonStatic.ts] +//! +//! x Unexpected token `@`. Expected identifier, string literal, numeric literal or [ for the computed key +//! ,-[4:1] +//! 4 | const field3 = "field3"; +//! 5 | +//! 6 | class C { +//! 7 | @dec(1) field1 = 1; +//! : ^ +//! 8 | @dec(2) ["field2"] = 2; +//! 9 | @dec(3) [field3] = 3; +//! 10 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-nonStatic(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-nonStatic(target=esnext).2.minified.js new file mode 100644 index 000000000000..ba1401ba4acb --- /dev/null +++ b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-nonStatic(target=esnext).2.minified.js @@ -0,0 +1,13 @@ +//// [esDecorators-classDeclaration-fields-nonStatic.ts] +//! +//! x Unexpected token `@`. Expected identifier, string literal, numeric literal or [ for the computed key +//! ,-[4:1] +//! 4 | const field3 = "field3"; +//! 5 | +//! 6 | class C { +//! 7 | @dec(1) field1 = 1; +//! : ^ +//! 8 | @dec(2) ["field2"] = 2; +//! 9 | @dec(3) [field3] = 3; +//! 10 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-nonStaticAccessor(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-nonStaticAccessor(target=esnext).1.normal.js new file mode 100644 index 000000000000..f73ef30aeda8 --- /dev/null +++ b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-nonStaticAccessor(target=esnext).1.normal.js @@ -0,0 +1,13 @@ +//// [esDecorators-classDeclaration-fields-nonStaticAccessor.ts] +//! +//! x Unexpected token `@`. Expected identifier, string literal, numeric literal or [ for the computed key +//! ,-[4:1] +//! 4 | const field3 = "field3"; +//! 5 | +//! 6 | class C { +//! 7 | @dec(1) accessor field1 = 1; +//! : ^ +//! 8 | @dec(2) accessor ["field2"] = 2; +//! 9 | @dec(3) accessor [field3] = 3; +//! 10 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-nonStaticAccessor(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-nonStaticAccessor(target=esnext).2.minified.js new file mode 100644 index 000000000000..f73ef30aeda8 --- /dev/null +++ b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-nonStaticAccessor(target=esnext).2.minified.js @@ -0,0 +1,13 @@ +//// [esDecorators-classDeclaration-fields-nonStaticAccessor.ts] +//! +//! x Unexpected token `@`. Expected identifier, string literal, numeric literal or [ for the computed key +//! ,-[4:1] +//! 4 | const field3 = "field3"; +//! 5 | +//! 6 | class C { +//! 7 | @dec(1) accessor field1 = 1; +//! : ^ +//! 8 | @dec(2) accessor ["field2"] = 2; +//! 9 | @dec(3) accessor [field3] = 3; +//! 10 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-nonStaticPrivate(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-nonStaticPrivate(target=esnext).1.normal.js new file mode 100644 index 000000000000..6458d91c0ab5 --- /dev/null +++ b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-nonStaticPrivate(target=esnext).1.normal.js @@ -0,0 +1,11 @@ +//// [esDecorators-classDeclaration-fields-nonStaticPrivate.ts] +//! +//! x Unexpected token `@`. Expected identifier, string literal, numeric literal or [ for the computed key +//! ,-[2:1] +//! 2 | declare let dec: any; +//! 3 | +//! 4 | class C { +//! 5 | @dec #field1 = 0; +//! : ^ +//! 6 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-nonStaticPrivate(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-nonStaticPrivate(target=esnext).2.minified.js new file mode 100644 index 000000000000..6458d91c0ab5 --- /dev/null +++ b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-nonStaticPrivate(target=esnext).2.minified.js @@ -0,0 +1,11 @@ +//// [esDecorators-classDeclaration-fields-nonStaticPrivate.ts] +//! +//! x Unexpected token `@`. Expected identifier, string literal, numeric literal or [ for the computed key +//! ,-[2:1] +//! 2 | declare let dec: any; +//! 3 | +//! 4 | class C { +//! 5 | @dec #field1 = 0; +//! : ^ +//! 6 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-nonStaticPrivateAccessor(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-nonStaticPrivateAccessor(target=esnext).1.normal.js new file mode 100644 index 000000000000..1b34bf060b58 --- /dev/null +++ b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-nonStaticPrivateAccessor(target=esnext).1.normal.js @@ -0,0 +1,11 @@ +//// [esDecorators-classDeclaration-fields-nonStaticPrivateAccessor.ts] +//! +//! x Unexpected token `@`. Expected identifier, string literal, numeric literal or [ for the computed key +//! ,-[2:1] +//! 2 | declare let dec: any; +//! 3 | +//! 4 | class C { +//! 5 | @dec accessor #field1 = 0; +//! : ^ +//! 6 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-nonStaticPrivateAccessor(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-nonStaticPrivateAccessor(target=esnext).2.minified.js new file mode 100644 index 000000000000..1b34bf060b58 --- /dev/null +++ b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-nonStaticPrivateAccessor(target=esnext).2.minified.js @@ -0,0 +1,11 @@ +//// [esDecorators-classDeclaration-fields-nonStaticPrivateAccessor.ts] +//! +//! x Unexpected token `@`. Expected identifier, string literal, numeric literal or [ for the computed key +//! ,-[2:1] +//! 2 | declare let dec: any; +//! 3 | +//! 4 | class C { +//! 5 | @dec accessor #field1 = 0; +//! : ^ +//! 6 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-static(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-static(target=esnext).1.normal.js new file mode 100644 index 000000000000..1ede500cd385 --- /dev/null +++ b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-static(target=esnext).1.normal.js @@ -0,0 +1,13 @@ +//// [esDecorators-classDeclaration-fields-static.ts] +//! +//! x Unexpected token `@`. Expected identifier, string literal, numeric literal or [ for the computed key +//! ,-[4:1] +//! 4 | const field3 = "field3"; +//! 5 | +//! 6 | class C { +//! 7 | @dec(1) static field1 = 1; +//! : ^ +//! 8 | @dec(2) static ["field2"] = 2; +//! 9 | @dec(3) static [field3] = 3; +//! 10 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-static(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-static(target=esnext).2.minified.js new file mode 100644 index 000000000000..1ede500cd385 --- /dev/null +++ b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-static(target=esnext).2.minified.js @@ -0,0 +1,13 @@ +//// [esDecorators-classDeclaration-fields-static.ts] +//! +//! x Unexpected token `@`. Expected identifier, string literal, numeric literal or [ for the computed key +//! ,-[4:1] +//! 4 | const field3 = "field3"; +//! 5 | +//! 6 | class C { +//! 7 | @dec(1) static field1 = 1; +//! : ^ +//! 8 | @dec(2) static ["field2"] = 2; +//! 9 | @dec(3) static [field3] = 3; +//! 10 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-staticAccessor(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-staticAccessor(target=esnext).1.normal.js new file mode 100644 index 000000000000..f15edf23c2bc --- /dev/null +++ b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-staticAccessor(target=esnext).1.normal.js @@ -0,0 +1,13 @@ +//// [esDecorators-classDeclaration-fields-staticAccessor.ts] +//! +//! x Unexpected token `@`. Expected identifier, string literal, numeric literal or [ for the computed key +//! ,-[4:1] +//! 4 | const field3 = "field3"; +//! 5 | +//! 6 | class C { +//! 7 | @dec(1) static accessor field1 = 1; +//! : ^ +//! 8 | @dec(2) static accessor ["field2"] = 2; +//! 9 | @dec(3) static accessor [field3] = 3; +//! 10 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-staticAccessor(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-staticAccessor(target=esnext).2.minified.js new file mode 100644 index 000000000000..f15edf23c2bc --- /dev/null +++ b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-staticAccessor(target=esnext).2.minified.js @@ -0,0 +1,13 @@ +//// [esDecorators-classDeclaration-fields-staticAccessor.ts] +//! +//! x Unexpected token `@`. Expected identifier, string literal, numeric literal or [ for the computed key +//! ,-[4:1] +//! 4 | const field3 = "field3"; +//! 5 | +//! 6 | class C { +//! 7 | @dec(1) static accessor field1 = 1; +//! : ^ +//! 8 | @dec(2) static accessor ["field2"] = 2; +//! 9 | @dec(3) static accessor [field3] = 3; +//! 10 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-staticPrivate(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-staticPrivate(target=esnext).1.normal.js new file mode 100644 index 000000000000..86107d4940f1 --- /dev/null +++ b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-staticPrivate(target=esnext).1.normal.js @@ -0,0 +1,13 @@ +//// [esDecorators-classDeclaration-fields-staticPrivate.ts] +//! +//! x Unexpected token `@`. Expected identifier, string literal, numeric literal or [ for the computed key +//! ,-[2:1] +//! 2 | declare let dec: any; +//! 3 | +//! 4 | class C { +//! 5 | @dec static #field1 = 0; +//! : ^ +//! 6 | } +//! 7 | +//! 8 | @dec +//! `---- diff --git a/crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-staticPrivate(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-staticPrivate(target=esnext).2.minified.js new file mode 100644 index 000000000000..86107d4940f1 --- /dev/null +++ b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-staticPrivate(target=esnext).2.minified.js @@ -0,0 +1,13 @@ +//// [esDecorators-classDeclaration-fields-staticPrivate.ts] +//! +//! x Unexpected token `@`. Expected identifier, string literal, numeric literal or [ for the computed key +//! ,-[2:1] +//! 2 | declare let dec: any; +//! 3 | +//! 4 | class C { +//! 5 | @dec static #field1 = 0; +//! : ^ +//! 6 | } +//! 7 | +//! 8 | @dec +//! `---- diff --git a/crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=esnext).1.normal.js new file mode 100644 index 000000000000..7d4a5f99567b --- /dev/null +++ b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=esnext).1.normal.js @@ -0,0 +1,13 @@ +//// [esDecorators-classDeclaration-fields-staticPrivateAccessor.ts] +//! +//! x Unexpected token `@`. Expected identifier, string literal, numeric literal or [ for the computed key +//! ,-[2:1] +//! 2 | declare let dec: any; +//! 3 | +//! 4 | class C { +//! 5 | @dec static accessor #field1 = 0; +//! : ^ +//! 6 | } +//! 7 | +//! 8 | @dec +//! `---- diff --git a/crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=esnext).2.minified.js new file mode 100644 index 000000000000..7d4a5f99567b --- /dev/null +++ b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-fields-staticPrivateAccessor(target=esnext).2.minified.js @@ -0,0 +1,13 @@ +//// [esDecorators-classDeclaration-fields-staticPrivateAccessor.ts] +//! +//! x Unexpected token `@`. Expected identifier, string literal, numeric literal or [ for the computed key +//! ,-[2:1] +//! 2 | declare let dec: any; +//! 3 | +//! 4 | class C { +//! 5 | @dec static accessor #field1 = 0; +//! : ^ +//! 6 | } +//! 7 | +//! 8 | @dec +//! `---- diff --git a/crates/swc/tests/tsc-references/esDecorators-classDeclaration-methods-nonStatic(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-methods-nonStatic(target=esnext).1.normal.js new file mode 100644 index 000000000000..977108aa2f02 --- /dev/null +++ b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-methods-nonStatic(target=esnext).1.normal.js @@ -0,0 +1,13 @@ +//// [esDecorators-classDeclaration-methods-nonStatic.ts] +//! +//! x Unexpected token `@`. Expected identifier, string literal, numeric literal or [ for the computed key +//! ,-[4:1] +//! 4 | const method3 = "method3"; +//! 5 | +//! 6 | class C { +//! 7 | @dec(1) method1() {} +//! : ^ +//! 8 | @dec(2) ["method2"]() {} +//! 9 | @dec(3) [method3]() {} +//! 10 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/esDecorators-classDeclaration-methods-nonStatic(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-methods-nonStatic(target=esnext).2.minified.js new file mode 100644 index 000000000000..977108aa2f02 --- /dev/null +++ b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-methods-nonStatic(target=esnext).2.minified.js @@ -0,0 +1,13 @@ +//// [esDecorators-classDeclaration-methods-nonStatic.ts] +//! +//! x Unexpected token `@`. Expected identifier, string literal, numeric literal or [ for the computed key +//! ,-[4:1] +//! 4 | const method3 = "method3"; +//! 5 | +//! 6 | class C { +//! 7 | @dec(1) method1() {} +//! : ^ +//! 8 | @dec(2) ["method2"]() {} +//! 9 | @dec(3) [method3]() {} +//! 10 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/esDecorators-classDeclaration-methods-nonStaticPrivate(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-methods-nonStaticPrivate(target=esnext).1.normal.js new file mode 100644 index 000000000000..5c73af9918f5 --- /dev/null +++ b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-methods-nonStaticPrivate(target=esnext).1.normal.js @@ -0,0 +1,11 @@ +//// [esDecorators-classDeclaration-methods-nonStaticPrivate.ts] +//! +//! x Unexpected token `@`. Expected identifier, string literal, numeric literal or [ for the computed key +//! ,-[2:1] +//! 2 | declare let dec: any; +//! 3 | +//! 4 | class C { +//! 5 | @dec #method1() {} +//! : ^ +//! 6 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/esDecorators-classDeclaration-methods-nonStaticPrivate(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-methods-nonStaticPrivate(target=esnext).2.minified.js new file mode 100644 index 000000000000..5c73af9918f5 --- /dev/null +++ b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-methods-nonStaticPrivate(target=esnext).2.minified.js @@ -0,0 +1,11 @@ +//// [esDecorators-classDeclaration-methods-nonStaticPrivate.ts] +//! +//! x Unexpected token `@`. Expected identifier, string literal, numeric literal or [ for the computed key +//! ,-[2:1] +//! 2 | declare let dec: any; +//! 3 | +//! 4 | class C { +//! 5 | @dec #method1() {} +//! : ^ +//! 6 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/esDecorators-classDeclaration-methods-static(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-methods-static(target=esnext).1.normal.js new file mode 100644 index 000000000000..ba661482669b --- /dev/null +++ b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-methods-static(target=esnext).1.normal.js @@ -0,0 +1,13 @@ +//// [esDecorators-classDeclaration-methods-static.ts] +//! +//! x Unexpected token `@`. Expected identifier, string literal, numeric literal or [ for the computed key +//! ,-[4:1] +//! 4 | const method3 = "method3"; +//! 5 | +//! 6 | class C { +//! 7 | @dec(1) static method1() {} +//! : ^ +//! 8 | @dec(2) static ["method2"]() {} +//! 9 | @dec(3) static [method3]() {} +//! 10 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/esDecorators-classDeclaration-methods-static(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-methods-static(target=esnext).2.minified.js new file mode 100644 index 000000000000..ba661482669b --- /dev/null +++ b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-methods-static(target=esnext).2.minified.js @@ -0,0 +1,13 @@ +//// [esDecorators-classDeclaration-methods-static.ts] +//! +//! x Unexpected token `@`. Expected identifier, string literal, numeric literal or [ for the computed key +//! ,-[4:1] +//! 4 | const method3 = "method3"; +//! 5 | +//! 6 | class C { +//! 7 | @dec(1) static method1() {} +//! : ^ +//! 8 | @dec(2) static ["method2"]() {} +//! 9 | @dec(3) static [method3]() {} +//! 10 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/esDecorators-classDeclaration-methods-staticPrivate(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-methods-staticPrivate(target=esnext).1.normal.js new file mode 100644 index 000000000000..0b3f4640d0ad --- /dev/null +++ b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-methods-staticPrivate(target=esnext).1.normal.js @@ -0,0 +1,13 @@ +//// [esDecorators-classDeclaration-methods-staticPrivate.ts] +//! +//! x Unexpected token `@`. Expected identifier, string literal, numeric literal or [ for the computed key +//! ,-[2:1] +//! 2 | declare let dec: any; +//! 3 | +//! 4 | class C { +//! 5 | @dec static #method1() {} +//! : ^ +//! 6 | } +//! 7 | +//! 8 | @dec +//! `---- diff --git a/crates/swc/tests/tsc-references/esDecorators-classDeclaration-methods-staticPrivate(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-methods-staticPrivate(target=esnext).2.minified.js new file mode 100644 index 000000000000..0b3f4640d0ad --- /dev/null +++ b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-methods-staticPrivate(target=esnext).2.minified.js @@ -0,0 +1,13 @@ +//// [esDecorators-classDeclaration-methods-staticPrivate.ts] +//! +//! x Unexpected token `@`. Expected identifier, string literal, numeric literal or [ for the computed key +//! ,-[2:1] +//! 2 | declare let dec: any; +//! 3 | +//! 4 | class C { +//! 5 | @dec static #method1() {} +//! : ^ +//! 6 | } +//! 7 | +//! 8 | @dec +//! `---- diff --git a/crates/swc/tests/tsc-references/esDecorators-classDeclaration-multipleDecorators(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-multipleDecorators(target=esnext).1.normal.js new file mode 100644 index 000000000000..ab264a7f17ea --- /dev/null +++ b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-multipleDecorators(target=esnext).1.normal.js @@ -0,0 +1,13 @@ +//// [esDecorators-classDeclaration-multipleDecorators.ts] +//! +//! x Expression expected +//! ,-[1:1] +//! 1 | +//! 2 | declare let dec1: any, dec2: any; +//! 3 | +//! 4 | @dec1 +//! : ^ +//! 5 | @dec2 +//! 6 | class C { +//! 7 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/esDecorators-classDeclaration-multipleDecorators(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-multipleDecorators(target=esnext).2.minified.js new file mode 100644 index 000000000000..ab264a7f17ea --- /dev/null +++ b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-multipleDecorators(target=esnext).2.minified.js @@ -0,0 +1,13 @@ +//// [esDecorators-classDeclaration-multipleDecorators.ts] +//! +//! x Expression expected +//! ,-[1:1] +//! 1 | +//! 2 | declare let dec1: any, dec2: any; +//! 3 | +//! 4 | @dec1 +//! : ^ +//! 5 | @dec2 +//! 6 | class C { +//! 7 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/esDecorators-classDeclaration-outerThisReference(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-outerThisReference(target=esnext).1.normal.js new file mode 100644 index 000000000000..ecf8063e57eb --- /dev/null +++ b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-outerThisReference(target=esnext).1.normal.js @@ -0,0 +1,13 @@ +//// [esDecorators-classDeclaration-outerThisReference.ts] +//! +//! x Expression expected +//! ,-[4:1] +//! 4 | declare let f: any; +//! 5 | +//! 6 | // `this` should point to the outer `this` in both cases. +//! 7 | @dec(this) +//! : ^ +//! 8 | class A { +//! 9 | @dec(this) +//! 10 | b = 2; +//! `---- diff --git a/crates/swc/tests/tsc-references/esDecorators-classDeclaration-outerThisReference(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-outerThisReference(target=esnext).2.minified.js new file mode 100644 index 000000000000..ecf8063e57eb --- /dev/null +++ b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-outerThisReference(target=esnext).2.minified.js @@ -0,0 +1,13 @@ +//// [esDecorators-classDeclaration-outerThisReference.ts] +//! +//! x Expression expected +//! ,-[4:1] +//! 4 | declare let f: any; +//! 5 | +//! 6 | // `this` should point to the outer `this` in both cases. +//! 7 | @dec(this) +//! : ^ +//! 8 | class A { +//! 9 | @dec(this) +//! 10 | b = 2; +//! `---- diff --git a/crates/swc/tests/tsc-references/esDecorators-classDeclaration-parameterProperties(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-parameterProperties(target=esnext).1.normal.js new file mode 100644 index 000000000000..32f80964cd02 --- /dev/null +++ b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-parameterProperties(target=esnext).1.normal.js @@ -0,0 +1,12 @@ +//// [esDecorators-classDeclaration-parameterProperties.ts] +//! +//! x Unexpected token `@`. Expected identifier, string literal, numeric literal or [ for the computed key +//! ,-[4:1] +//! 4 | class C { +//! 5 | constructor(private message: string) {} +//! 6 | +//! 7 | @bound speak() { +//! : ^ +//! 8 | } +//! 9 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/esDecorators-classDeclaration-parameterProperties(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-parameterProperties(target=esnext).2.minified.js new file mode 100644 index 000000000000..32f80964cd02 --- /dev/null +++ b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-parameterProperties(target=esnext).2.minified.js @@ -0,0 +1,12 @@ +//// [esDecorators-classDeclaration-parameterProperties.ts] +//! +//! x Unexpected token `@`. Expected identifier, string literal, numeric literal or [ for the computed key +//! ,-[4:1] +//! 4 | class C { +//! 5 | constructor(private message: string) {} +//! 6 | +//! 7 | @bound speak() { +//! : ^ +//! 8 | } +//! 9 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/esDecorators-classDeclaration-setFunctionName(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-setFunctionName(target=esnext).1.normal.js new file mode 100644 index 000000000000..368b5d477a0a --- /dev/null +++ b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-setFunctionName(target=esnext).1.normal.js @@ -0,0 +1,41 @@ +//// [esDecorators-classDeclaration-setFunctionName.ts] +//// [a.ts] +//! +//! x Expression expected +//! ,-[1:1] +//! 1 | declare let dec: any; +//! 2 | +//! 3 | @dec class C {} +//! : ^ +//! 4 | +//! 5 | export {} +//! `---- +//// [b.ts] +//! +//! x Expression expected +//! ,-[1:1] +//! 1 | declare let dec: any; +//! 2 | +//! 3 | @dec export class C {} +//! : ^ +//! 4 | +//! `---- +//// [c.ts] +//! +//! x Expression expected +//! ,-[1:1] +//! 1 | declare let dec: any; +//! 2 | +//! 3 | @dec export default class C {} +//! : ^ +//! 4 | +//! `---- +//// [c.ts] +//! +//! x Expression expected +//! ,-[1:1] +//! 1 | declare let dec: any; +//! 2 | +//! 3 | @dec export default class {} +//! : ^ +//! `---- diff --git a/crates/swc/tests/tsc-references/esDecorators-classDeclaration-setFunctionName(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-setFunctionName(target=esnext).2.minified.js new file mode 100644 index 000000000000..368b5d477a0a --- /dev/null +++ b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-setFunctionName(target=esnext).2.minified.js @@ -0,0 +1,41 @@ +//// [esDecorators-classDeclaration-setFunctionName.ts] +//// [a.ts] +//! +//! x Expression expected +//! ,-[1:1] +//! 1 | declare let dec: any; +//! 2 | +//! 3 | @dec class C {} +//! : ^ +//! 4 | +//! 5 | export {} +//! `---- +//// [b.ts] +//! +//! x Expression expected +//! ,-[1:1] +//! 1 | declare let dec: any; +//! 2 | +//! 3 | @dec export class C {} +//! : ^ +//! 4 | +//! `---- +//// [c.ts] +//! +//! x Expression expected +//! ,-[1:1] +//! 1 | declare let dec: any; +//! 2 | +//! 3 | @dec export default class C {} +//! : ^ +//! 4 | +//! `---- +//// [c.ts] +//! +//! x Expression expected +//! ,-[1:1] +//! 1 | declare let dec: any; +//! 2 | +//! 3 | @dec export default class {} +//! : ^ +//! `---- diff --git a/crates/swc/tests/tsc-references/esDecorators-classDeclaration-simpleTransformation(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-simpleTransformation(target=esnext).1.normal.js new file mode 100644 index 000000000000..0749d8d1ae39 --- /dev/null +++ b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-simpleTransformation(target=esnext).1.normal.js @@ -0,0 +1,12 @@ +//// [esDecorators-classDeclaration-simpleTransformation.ts] +//! +//! x Expression expected +//! ,-[1:1] +//! 1 | +//! 2 | declare let dec: any; +//! 3 | +//! 4 | @dec +//! : ^ +//! 5 | class C { +//! 6 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/esDecorators-classDeclaration-simpleTransformation(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-simpleTransformation(target=esnext).2.minified.js new file mode 100644 index 000000000000..0749d8d1ae39 --- /dev/null +++ b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-simpleTransformation(target=esnext).2.minified.js @@ -0,0 +1,12 @@ +//// [esDecorators-classDeclaration-simpleTransformation.ts] +//! +//! x Expression expected +//! ,-[1:1] +//! 1 | +//! 2 | declare let dec: any; +//! 3 | +//! 4 | @dec +//! : ^ +//! 5 | class C { +//! 6 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/esDecorators-classDeclaration-sourceMap(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-sourceMap(target=esnext).1.normal.js new file mode 100644 index 000000000000..2b80bb0fce66 --- /dev/null +++ b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-sourceMap(target=esnext).1.normal.js @@ -0,0 +1,13 @@ +//// [esDecorators-classDeclaration-sourceMap.ts] +//! +//! x Expression expected +//! ,-[1:1] +//! 1 | +//! 2 | declare var dec: any; +//! 3 | +//! 4 | @dec +//! : ^ +//! 5 | @dec +//! 6 | class C { +//! 7 | @dec +//! `---- diff --git a/crates/swc/tests/tsc-references/esDecorators-classDeclaration-sourceMap(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-sourceMap(target=esnext).2.minified.js new file mode 100644 index 000000000000..2b80bb0fce66 --- /dev/null +++ b/crates/swc/tests/tsc-references/esDecorators-classDeclaration-sourceMap(target=esnext).2.minified.js @@ -0,0 +1,13 @@ +//// [esDecorators-classDeclaration-sourceMap.ts] +//! +//! x Expression expected +//! ,-[1:1] +//! 1 | +//! 2 | declare var dec: any; +//! 3 | +//! 4 | @dec +//! : ^ +//! 5 | @dec +//! 6 | class C { +//! 7 | @dec +//! `---- diff --git a/crates/swc/tests/tsc-references/esDecorators-classExpression-commentPreservation(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/esDecorators-classExpression-commentPreservation(target=esnext).1.normal.js new file mode 100644 index 000000000000..e764e33a938b --- /dev/null +++ b/crates/swc/tests/tsc-references/esDecorators-classExpression-commentPreservation(target=esnext).1.normal.js @@ -0,0 +1,13 @@ +//// [esDecorators-classExpression-commentPreservation.ts] +//! +//! x Expression expected +//! ,-[4:1] +//! 4 | /*1*/ +//! 5 | ( +//! 6 | /*2*/ +//! 7 | @dec +//! : ^ +//! 8 | /*3*/ +//! 9 | @dec +//! 10 | /*4*/ +//! `---- diff --git a/crates/swc/tests/tsc-references/esDecorators-classExpression-commentPreservation(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/esDecorators-classExpression-commentPreservation(target=esnext).2.minified.js new file mode 100644 index 000000000000..e764e33a938b --- /dev/null +++ b/crates/swc/tests/tsc-references/esDecorators-classExpression-commentPreservation(target=esnext).2.minified.js @@ -0,0 +1,13 @@ +//// [esDecorators-classExpression-commentPreservation.ts] +//! +//! x Expression expected +//! ,-[4:1] +//! 4 | /*1*/ +//! 5 | ( +//! 6 | /*2*/ +//! 7 | @dec +//! : ^ +//! 8 | /*3*/ +//! 9 | @dec +//! 10 | /*4*/ +//! `---- diff --git a/crates/swc/tests/tsc-references/esDecorators-emitDecoratorMetadata(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/esDecorators-emitDecoratorMetadata(target=esnext).1.normal.js new file mode 100644 index 000000000000..42e45d0a0251 --- /dev/null +++ b/crates/swc/tests/tsc-references/esDecorators-emitDecoratorMetadata(target=esnext).1.normal.js @@ -0,0 +1,12 @@ +//// [esDecorators-emitDecoratorMetadata.ts] +//! +//! x Expression expected +//! ,-[1:1] +//! 1 | +//! 2 | declare let dec: any; +//! 3 | +//! 4 | @dec +//! : ^ +//! 5 | class C { +//! 6 | constructor(x: number) {} +//! `---- diff --git a/crates/swc/tests/tsc-references/esDecorators-emitDecoratorMetadata(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/esDecorators-emitDecoratorMetadata(target=esnext).2.minified.js new file mode 100644 index 000000000000..42e45d0a0251 --- /dev/null +++ b/crates/swc/tests/tsc-references/esDecorators-emitDecoratorMetadata(target=esnext).2.minified.js @@ -0,0 +1,12 @@ +//// [esDecorators-emitDecoratorMetadata.ts] +//! +//! x Expression expected +//! ,-[1:1] +//! 1 | +//! 2 | declare let dec: any; +//! 3 | +//! 4 | @dec +//! : ^ +//! 5 | class C { +//! 6 | constructor(x: number) {} +//! `---- diff --git a/crates/swc/tests/tsc-references/initializationOrdering1(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/initializationOrdering1(target=esnext).1.normal.js new file mode 100644 index 000000000000..24b2722de649 --- /dev/null +++ b/crates/swc/tests/tsc-references/initializationOrdering1(target=esnext).1.normal.js @@ -0,0 +1,14 @@ +//// [initializationOrdering1.ts] +class Helper { + create() { + return true; + } +} +export class Broken { + constructor(facade){ + this.facade = facade; + this.bug = this.facade.create(); + console.log(this.bug); + } +} +new Broken(new Helper); diff --git a/crates/swc/tests/tsc-references/initializationOrdering1(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/initializationOrdering1(target=esnext).2.minified.js new file mode 100644 index 000000000000..a47cdb9fba88 --- /dev/null +++ b/crates/swc/tests/tsc-references/initializationOrdering1(target=esnext).2.minified.js @@ -0,0 +1,11 @@ +//// [initializationOrdering1.ts] +export class Broken { + constructor(facade){ + this.facade = facade, this.bug = this.facade.create(), console.log(this.bug); + } +} +new Broken(new class { + create() { + return !0; + } +}); diff --git a/crates/swc/tests/tsc-references/logicalAssignment1(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/logicalAssignment1(target=esnext).1.normal.js new file mode 100644 index 000000000000..6a203141472f --- /dev/null +++ b/crates/swc/tests/tsc-references/logicalAssignment1(target=esnext).1.normal.js @@ -0,0 +1,10 @@ +//// [logicalAssignment1.ts] +a &&= "foo"; +b ||= "foo"; +c ??= "foo"; +d &&= 42; +e ||= 42; +f ??= 42; +g &&= 42; +h ||= 42; +i ??= 42; diff --git a/crates/swc/tests/tsc-references/logicalAssignment1(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/logicalAssignment1(target=esnext).2.minified.js new file mode 100644 index 000000000000..85b47d6a6d94 --- /dev/null +++ b/crates/swc/tests/tsc-references/logicalAssignment1(target=esnext).2.minified.js @@ -0,0 +1,2 @@ +//// [logicalAssignment1.ts] +a &&= "foo", b ||= "foo", c ??= "foo", d &&= 42, e ||= 42, f ??= 42, g &&= 42, h ||= 42, i ??= 42; diff --git a/crates/swc/tests/tsc-references/logicalAssignment10(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/logicalAssignment10(target=esnext).1.normal.js new file mode 100644 index 000000000000..0f029263ec67 --- /dev/null +++ b/crates/swc/tests/tsc-references/logicalAssignment10(target=esnext).1.normal.js @@ -0,0 +1,11 @@ +//// [logicalAssignment10.ts] +var count = 0; +var obj = {}; +function incr() { + return ++count; +} +const oobj = { + obj +}; +obj[incr()] ??= incr(); +oobj["obj"][incr()] ??= incr(); diff --git a/crates/swc/tests/tsc-references/logicalAssignment10(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/logicalAssignment10(target=esnext).2.minified.js new file mode 100644 index 000000000000..8be067e42a73 --- /dev/null +++ b/crates/swc/tests/tsc-references/logicalAssignment10(target=esnext).2.minified.js @@ -0,0 +1,5 @@ +//// [logicalAssignment10.ts] +var count = 0, obj = {}; +obj[++count] ??= ++count, ({ + obj +}).obj[++count] ??= ++count; diff --git a/crates/swc/tests/tsc-references/logicalAssignment11(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/logicalAssignment11(target=esnext).1.normal.js new file mode 100644 index 000000000000..3ad5a13a3f1b --- /dev/null +++ b/crates/swc/tests/tsc-references/logicalAssignment11(target=esnext).1.normal.js @@ -0,0 +1,8 @@ +//// [logicalAssignment11.ts] +let x; +let d; +d ?? (d = x ?? "x"); +d.length; +let e; +e ??= x ?? "x"; +e.length; diff --git a/crates/swc/tests/tsc-references/logicalAssignment11(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/logicalAssignment11(target=esnext).2.minified.js new file mode 100644 index 000000000000..5f9626e7b173 --- /dev/null +++ b/crates/swc/tests/tsc-references/logicalAssignment11(target=esnext).2.minified.js @@ -0,0 +1,3 @@ +//// [logicalAssignment11.ts] +let x, d, e; +d ?? (d = x ?? "x"), d.length, (e ??= x ?? "x").length; diff --git a/crates/swc/tests/tsc-references/logicalAssignment2(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/logicalAssignment2(target=esnext).1.normal.js new file mode 100644 index 000000000000..7274444994ad --- /dev/null +++ b/crates/swc/tests/tsc-references/logicalAssignment2(target=esnext).1.normal.js @@ -0,0 +1,10 @@ +//// [logicalAssignment2.ts] +a.baz &&= result.baz; +b.baz ||= result.baz; +c.baz ??= result.baz; +a.foo["baz"] &&= result.foo.baz; +b.foo["baz"] ||= result.foo.baz; +c.foo["baz"] ??= result.foo.baz; +a.foo.bar().baz &&= result.foo.bar().baz; +b.foo.bar().baz ||= result.foo.bar().baz; +c.foo.bar().baz ??= result.foo.bar().baz; diff --git a/crates/swc/tests/tsc-references/logicalAssignment2(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/logicalAssignment2(target=esnext).2.minified.js new file mode 100644 index 000000000000..f4066288082e --- /dev/null +++ b/crates/swc/tests/tsc-references/logicalAssignment2(target=esnext).2.minified.js @@ -0,0 +1,2 @@ +//// [logicalAssignment2.ts] +a.baz &&= result.baz, b.baz ||= result.baz, c.baz ??= result.baz, a.foo.baz &&= result.foo.baz, b.foo.baz ||= result.foo.baz, c.foo.baz ??= result.foo.baz, a.foo.bar().baz &&= result.foo.bar().baz, b.foo.bar().baz ||= result.foo.bar().baz, c.foo.bar().baz ??= result.foo.bar().baz; diff --git a/crates/swc/tests/tsc-references/logicalAssignment3(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/logicalAssignment3(target=esnext).1.normal.js new file mode 100644 index 000000000000..327aa269c57c --- /dev/null +++ b/crates/swc/tests/tsc-references/logicalAssignment3(target=esnext).1.normal.js @@ -0,0 +1,4 @@ +//// [logicalAssignment3.ts] +a.baz &&= result.baz; +b.baz ||= result.baz; +c.baz ??= result.baz; diff --git a/crates/swc/tests/tsc-references/logicalAssignment3(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/logicalAssignment3(target=esnext).2.minified.js new file mode 100644 index 000000000000..e902fc937dd4 --- /dev/null +++ b/crates/swc/tests/tsc-references/logicalAssignment3(target=esnext).2.minified.js @@ -0,0 +1,2 @@ +//// [logicalAssignment3.ts] +a.baz &&= result.baz, b.baz ||= result.baz, c.baz ??= result.baz; diff --git a/crates/swc/tests/tsc-references/logicalAssignment4(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/logicalAssignment4(target=esnext).1.normal.js new file mode 100644 index 000000000000..76fd39977eb8 --- /dev/null +++ b/crates/swc/tests/tsc-references/logicalAssignment4(target=esnext).1.normal.js @@ -0,0 +1,37 @@ +//// [logicalAssignment4.ts] +function foo1(results) { + (results ||= []).push(100); +} +function foo2(results) { + (results ??= []).push(100); +} +function foo3(results) { + results ||= []; + results.push(100); +} +function foo4(results) { + results ??= []; + results.push(100); +} +function doSomethingWithAlias(thing, defaultValue) { + if (v === 1) { + if (thing &&= thing.original) { + thing.name; + } + } else if (v === 2) { + if (thing &&= defaultValue) { + thing.name; + defaultValue.name; + } + } else if (v === 3) { + if (thing ||= defaultValue) { + thing.name; + defaultValue.name; + } + } else { + if (thing ??= defaultValue) { + thing.name; + defaultValue.name; + } + } +} diff --git a/crates/swc/tests/tsc-references/logicalAssignment4(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/logicalAssignment4(target=esnext).2.minified.js new file mode 100644 index 000000000000..e650f1625556 --- /dev/null +++ b/crates/swc/tests/tsc-references/logicalAssignment4(target=esnext).2.minified.js @@ -0,0 +1 @@ +//// [logicalAssignment4.ts] diff --git a/crates/swc/tests/tsc-references/logicalAssignment5(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/logicalAssignment5(target=esnext).1.normal.js new file mode 100644 index 000000000000..ef8e62757949 --- /dev/null +++ b/crates/swc/tests/tsc-references/logicalAssignment5(target=esnext).1.normal.js @@ -0,0 +1,25 @@ +//// [logicalAssignment5.ts] +function foo1(f) { + f ??= (a)=>a; + f(42); +} +function foo2(f) { + f ||= (a)=>a; + f(42); +} +function foo3(f) { + f &&= (a)=>a; + f(42); +} +function bar1(f) { + f ??= (f.toString(), (a)=>a); + f(42); +} +function bar2(f) { + f ||= (f.toString(), (a)=>a); + f(42); +} +function bar3(f) { + f &&= (f.toString(), (a)=>a); + f(42); +} diff --git a/crates/swc/tests/tsc-references/logicalAssignment5(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/logicalAssignment5(target=esnext).2.minified.js new file mode 100644 index 000000000000..ad0c83810e2d --- /dev/null +++ b/crates/swc/tests/tsc-references/logicalAssignment5(target=esnext).2.minified.js @@ -0,0 +1 @@ +//// [logicalAssignment5.ts] diff --git a/crates/swc/tests/tsc-references/logicalAssignment6(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/logicalAssignment6(target=esnext).1.normal.js new file mode 100644 index 000000000000..d5e878e3e7d0 --- /dev/null +++ b/crates/swc/tests/tsc-references/logicalAssignment6(target=esnext).1.normal.js @@ -0,0 +1,10 @@ +//// [logicalAssignment6.ts] +function foo1(results, results1) { + (results ||= results1 ||= []).push(100); +} +function foo2(results, results1) { + (results ??= results1 ??= []).push(100); +} +function foo3(results, results1) { + (results &&= results1 &&= []).push(100); +} diff --git a/crates/swc/tests/tsc-references/logicalAssignment6(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/logicalAssignment6(target=esnext).2.minified.js new file mode 100644 index 000000000000..e94575f4f8c4 --- /dev/null +++ b/crates/swc/tests/tsc-references/logicalAssignment6(target=esnext).2.minified.js @@ -0,0 +1 @@ +//// [logicalAssignment6.ts] diff --git a/crates/swc/tests/tsc-references/logicalAssignment7(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/logicalAssignment7(target=esnext).1.normal.js new file mode 100644 index 000000000000..8430aac7690a --- /dev/null +++ b/crates/swc/tests/tsc-references/logicalAssignment7(target=esnext).1.normal.js @@ -0,0 +1,10 @@ +//// [logicalAssignment7.ts] +function foo1(results, results1) { + (results ||= results1 ||= []).push(100); +} +function foo2(results, results1) { + (results ??= results1 ??= []).push(100); +} +function foo3(results, results1) { + (results &&= results1 &&= []).push(100); +} diff --git a/crates/swc/tests/tsc-references/logicalAssignment7(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/logicalAssignment7(target=esnext).2.minified.js new file mode 100644 index 000000000000..814f87c2957c --- /dev/null +++ b/crates/swc/tests/tsc-references/logicalAssignment7(target=esnext).2.minified.js @@ -0,0 +1 @@ +//// [logicalAssignment7.ts] diff --git a/crates/swc/tests/tsc-references/logicalAssignment8(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/logicalAssignment8(target=esnext).1.normal.js new file mode 100644 index 000000000000..562cb3779a56 --- /dev/null +++ b/crates/swc/tests/tsc-references/logicalAssignment8(target=esnext).1.normal.js @@ -0,0 +1,10 @@ +//// [logicalAssignment8.ts] +function foo1(results) { + (results ||= bar?.value ?? []).push(100); +} +function foo2(results) { + (results ??= bar?.value ?? []).push(100); +} +function foo3(results) { + (results &&= bar?.value ?? []).push(100); +} diff --git a/crates/swc/tests/tsc-references/logicalAssignment8(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/logicalAssignment8(target=esnext).2.minified.js new file mode 100644 index 000000000000..7bebaa9a0471 --- /dev/null +++ b/crates/swc/tests/tsc-references/logicalAssignment8(target=esnext).2.minified.js @@ -0,0 +1 @@ +//// [logicalAssignment8.ts] diff --git a/crates/swc/tests/tsc-references/nullishCoalescingOperatorInAsyncGenerator(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/nullishCoalescingOperatorInAsyncGenerator(target=esnext).1.normal.js new file mode 100644 index 000000000000..bd9c9ed01c6f --- /dev/null +++ b/crates/swc/tests/tsc-references/nullishCoalescingOperatorInAsyncGenerator(target=esnext).1.normal.js @@ -0,0 +1,8 @@ +//// [nullishCoalescingOperatorInAsyncGenerator.ts] +// https://github.com/microsoft/TypeScript/issues/37686 +async function* f(a) { + let c = a.b ?? 10; + while(c){ + yield c--; + } +} diff --git a/crates/swc/tests/tsc-references/nullishCoalescingOperatorInAsyncGenerator(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/nullishCoalescingOperatorInAsyncGenerator(target=esnext).2.minified.js new file mode 100644 index 000000000000..f53c2d740da0 --- /dev/null +++ b/crates/swc/tests/tsc-references/nullishCoalescingOperatorInAsyncGenerator(target=esnext).2.minified.js @@ -0,0 +1 @@ +//// [nullishCoalescingOperatorInAsyncGenerator.ts] diff --git a/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterBindingPattern(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterBindingPattern(target=esnext).1.normal.js new file mode 100644 index 000000000000..9dcb27e2bdf9 --- /dev/null +++ b/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterBindingPattern(target=esnext).1.normal.js @@ -0,0 +1,4 @@ +//// [nullishCoalescingOperatorInParameterBindingPattern.ts] +// https://github.com/microsoft/TypeScript/issues/36295 +const a = ()=>undefined; +(({ [a() ?? "d"]: c = "" })=>{})(); diff --git a/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterBindingPattern(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterBindingPattern(target=esnext).2.minified.js new file mode 100644 index 000000000000..f776083a1f76 --- /dev/null +++ b/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterBindingPattern(target=esnext).2.minified.js @@ -0,0 +1 @@ +//// [nullishCoalescingOperatorInParameterBindingPattern.ts] diff --git a/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterBindingPattern.2(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterBindingPattern.2(target=esnext).1.normal.js new file mode 100644 index 000000000000..2269efe39007 --- /dev/null +++ b/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterBindingPattern.2(target=esnext).1.normal.js @@ -0,0 +1,10 @@ +//// [nullishCoalescingOperatorInParameterBindingPattern.2.ts] +// https://github.com/microsoft/TypeScript/issues/36295 +const a = ()=>undefined; +(({ [a() ?? "d"]: c = "" })=>{ + var a1; +})(); +const x = ""; +(({ [a() ?? "d"]: c = "", d = x })=>{ + var x1; +})(); diff --git a/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterBindingPattern.2(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterBindingPattern.2(target=esnext).2.minified.js new file mode 100644 index 000000000000..50408436229d --- /dev/null +++ b/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterBindingPattern.2(target=esnext).2.minified.js @@ -0,0 +1 @@ +//// [nullishCoalescingOperatorInParameterBindingPattern.2.ts] diff --git a/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterInitializer(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterInitializer(target=esnext).1.normal.js new file mode 100644 index 000000000000..5da97d69576f --- /dev/null +++ b/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterInitializer(target=esnext).1.normal.js @@ -0,0 +1,4 @@ +//// [nullishCoalescingOperatorInParameterInitializer.ts] +// https://github.com/microsoft/TypeScript/issues/36295 +const a = ()=>undefined; +((b = a() ?? "d")=>{})(); diff --git a/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterInitializer(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterInitializer(target=esnext).2.minified.js new file mode 100644 index 000000000000..4b4af4ab2063 --- /dev/null +++ b/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterInitializer(target=esnext).2.minified.js @@ -0,0 +1 @@ +//// [nullishCoalescingOperatorInParameterInitializer.ts] diff --git a/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterInitializer.2(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterInitializer.2(target=esnext).1.normal.js new file mode 100644 index 000000000000..320b1d6ee0f8 --- /dev/null +++ b/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterInitializer.2(target=esnext).1.normal.js @@ -0,0 +1,10 @@ +//// [nullishCoalescingOperatorInParameterInitializer.2.ts] +// https://github.com/microsoft/TypeScript/issues/36295 +const a = ()=>undefined; +((b = a() ?? "d")=>{ + var a1; +})(); +const x = ""; +((b = a() ?? "d", d = x)=>{ + var x1; +})(); diff --git a/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterInitializer.2(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterInitializer.2(target=esnext).2.minified.js new file mode 100644 index 000000000000..d7904a55fb8a --- /dev/null +++ b/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterInitializer.2(target=esnext).2.minified.js @@ -0,0 +1 @@ +//// [nullishCoalescingOperatorInParameterInitializer.2.ts] diff --git a/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern(target=esnext).1.normal.js new file mode 100644 index 000000000000..85aa63786bf5 --- /dev/null +++ b/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern(target=esnext).1.normal.js @@ -0,0 +1,4 @@ +//// [optionalChainingInParameterBindingPattern.ts] +// https://github.com/microsoft/TypeScript/issues/36295 +const a = ()=>undefined; +(({ [a()?.d]: c = "" })=>{})(); diff --git a/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern(target=esnext).2.minified.js new file mode 100644 index 000000000000..08adb3db23f1 --- /dev/null +++ b/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern(target=esnext).2.minified.js @@ -0,0 +1 @@ +//// [optionalChainingInParameterBindingPattern.ts] diff --git a/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern.2(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern.2(target=esnext).1.normal.js new file mode 100644 index 000000000000..bb6891936ae3 --- /dev/null +++ b/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern.2(target=esnext).1.normal.js @@ -0,0 +1,10 @@ +//// [optionalChainingInParameterBindingPattern.2.ts] +// https://github.com/microsoft/TypeScript/issues/36295 +const a = ()=>undefined; +(({ [a()?.d]: c = "" })=>{ + var a1; +})(); +const x = ""; +(({ [a()?.d]: c }, d = x)=>{ + var x1; +})(); diff --git a/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern.2(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern.2(target=esnext).2.minified.js new file mode 100644 index 000000000000..72d9d3f754f3 --- /dev/null +++ b/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern.2(target=esnext).2.minified.js @@ -0,0 +1 @@ +//// [optionalChainingInParameterBindingPattern.2.ts] diff --git a/crates/swc/tests/tsc-references/optionalChainingInParameterInitializer(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/optionalChainingInParameterInitializer(target=esnext).1.normal.js new file mode 100644 index 000000000000..e0d0704d8e9d --- /dev/null +++ b/crates/swc/tests/tsc-references/optionalChainingInParameterInitializer(target=esnext).1.normal.js @@ -0,0 +1,4 @@ +//// [optionalChainingInParameterInitializer.ts] +// https://github.com/microsoft/TypeScript/issues/36295 +const a = ()=>undefined; +((b = a()?.d)=>{})(); diff --git a/crates/swc/tests/tsc-references/optionalChainingInParameterInitializer(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/optionalChainingInParameterInitializer(target=esnext).2.minified.js new file mode 100644 index 000000000000..aa27fc047ae7 --- /dev/null +++ b/crates/swc/tests/tsc-references/optionalChainingInParameterInitializer(target=esnext).2.minified.js @@ -0,0 +1 @@ +//// [optionalChainingInParameterInitializer.ts] diff --git a/crates/swc/tests/tsc-references/optionalChainingInParameterInitializer.2(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/optionalChainingInParameterInitializer.2(target=esnext).1.normal.js new file mode 100644 index 000000000000..691357d771c5 --- /dev/null +++ b/crates/swc/tests/tsc-references/optionalChainingInParameterInitializer.2(target=esnext).1.normal.js @@ -0,0 +1,10 @@ +//// [optionalChainingInParameterInitializer.2.ts] +// https://github.com/microsoft/TypeScript/issues/36295 +const a = ()=>undefined; +((b = a()?.d)=>{ + var a1; +})(); +const x = ""; +((b = a()?.d, d = x)=>{ + var x1; +})(); diff --git a/crates/swc/tests/tsc-references/optionalChainingInParameterInitializer.2(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/optionalChainingInParameterInitializer.2(target=esnext).2.minified.js new file mode 100644 index 000000000000..c9920a3e5c12 --- /dev/null +++ b/crates/swc/tests/tsc-references/optionalChainingInParameterInitializer.2(target=esnext).2.minified.js @@ -0,0 +1 @@ +//// [optionalChainingInParameterInitializer.2.ts] diff --git a/crates/swc/tests/tsc-references/optionalChainingInTypeAssertions(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/optionalChainingInTypeAssertions(target=esnext).1.normal.js new file mode 100644 index 000000000000..2b4ae8926041 --- /dev/null +++ b/crates/swc/tests/tsc-references/optionalChainingInTypeAssertions(target=esnext).1.normal.js @@ -0,0 +1,14 @@ +//// [optionalChainingInTypeAssertions.ts] +class Foo { + m() {} +} +const foo = new Foo(); +foo.m?.(); +foo.m?.(); +/*a1*/ /*a2*/ foo.m?.(); +/*b1*/ foo.m /*b3*/ ?.(); +// https://github.com/microsoft/TypeScript/issues/50148 +(foo?.m).length; +(foo?.m).length; +(foo?.["m"]).length; +(foo?.["m"]).length; diff --git a/crates/swc/tests/tsc-references/optionalChainingInTypeAssertions(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/optionalChainingInTypeAssertions(target=esnext).2.minified.js new file mode 100644 index 000000000000..cada48ed1268 --- /dev/null +++ b/crates/swc/tests/tsc-references/optionalChainingInTypeAssertions(target=esnext).2.minified.js @@ -0,0 +1,5 @@ +//// [optionalChainingInTypeAssertions.ts] +const foo = new class { + m() {} +}(); +foo.m?.(), foo.m?.(), foo.m?.(), foo.m?.(), (foo?.m).length, (foo?.m).length, (foo?.m).length, (foo?.m).length; diff --git a/crates/swc/tests/tsc-references/optionalMethodDeclarations(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/optionalMethodDeclarations(target=esnext).1.normal.js new file mode 100644 index 000000000000..7d32ad791129 --- /dev/null +++ b/crates/swc/tests/tsc-references/optionalMethodDeclarations(target=esnext).1.normal.js @@ -0,0 +1,6 @@ +//// [optionalMethodDeclarations.ts] +// https://github.com/microsoft/TypeScript/issues/34952#issuecomment-552025027 +class C { + // ? should be removed in emit + method() {} +} diff --git a/crates/swc/tests/tsc-references/optionalMethodDeclarations(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/optionalMethodDeclarations(target=esnext).2.minified.js new file mode 100644 index 000000000000..0abb1e231cc4 --- /dev/null +++ b/crates/swc/tests/tsc-references/optionalMethodDeclarations(target=esnext).2.minified.js @@ -0,0 +1 @@ +//// [optionalMethodDeclarations.ts] diff --git a/crates/swc/tests/tsc-references/override12(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/override12(target=esnext).1.normal.js new file mode 100644 index 000000000000..117c93cb68e4 --- /dev/null +++ b/crates/swc/tests/tsc-references/override12(target=esnext).1.normal.js @@ -0,0 +1,19 @@ +//// [override12.ts] +class A { + m1() { + return 0; + } + m2() { + return 0; + } + m3() {} +} +class B extends A { + m1() { + return 10; + } + m2() { + return 30; + } + m3() {} +} diff --git a/crates/swc/tests/tsc-references/override12(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/override12(target=esnext).2.minified.js new file mode 100644 index 000000000000..32a7de2edb9c --- /dev/null +++ b/crates/swc/tests/tsc-references/override12(target=esnext).2.minified.js @@ -0,0 +1 @@ +//// [override12.ts] diff --git a/crates/swc/tests/tsc-references/override16(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/override16(target=esnext).1.normal.js new file mode 100644 index 000000000000..087936933588 --- /dev/null +++ b/crates/swc/tests/tsc-references/override16(target=esnext).1.normal.js @@ -0,0 +1,9 @@ +//// [override16.ts] +class A { +} +class B extends A { + constructor(...args){ + super(...args); + this.foo = "string"; + } +} diff --git a/crates/swc/tests/tsc-references/override16(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/override16(target=esnext).2.minified.js new file mode 100644 index 000000000000..aabc2ce77844 --- /dev/null +++ b/crates/swc/tests/tsc-references/override16(target=esnext).2.minified.js @@ -0,0 +1 @@ +//// [override16.ts] diff --git a/crates/swc/tests/tsc-references/override17(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/override17(target=esnext).1.normal.js new file mode 100644 index 000000000000..b5f335d75e76 --- /dev/null +++ b/crates/swc/tests/tsc-references/override17(target=esnext).1.normal.js @@ -0,0 +1,19 @@ +//// [override17.ts] +class A { + m1() { + return 0; + } + m2() { + return 0; + } + m3() {} +} +class B extends A { + m1() { + return 10; + } + m2() { + return 30; + } + m3() {} +} diff --git a/crates/swc/tests/tsc-references/override17(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/override17(target=esnext).2.minified.js new file mode 100644 index 000000000000..e7b535d02dff --- /dev/null +++ b/crates/swc/tests/tsc-references/override17(target=esnext).2.minified.js @@ -0,0 +1 @@ +//// [override17.ts] diff --git a/crates/swc/tests/tsc-references/override18(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/override18(target=esnext).1.normal.js new file mode 100644 index 000000000000..51da3f42d0cb --- /dev/null +++ b/crates/swc/tests/tsc-references/override18(target=esnext).1.normal.js @@ -0,0 +1,7 @@ +//// [override18.ts] +class A { + foo; +} +class B extends A { + foo = "string"; +} diff --git a/crates/swc/tests/tsc-references/override18(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/override18(target=esnext).2.minified.js new file mode 100644 index 000000000000..e6099d3e15ec --- /dev/null +++ b/crates/swc/tests/tsc-references/override18(target=esnext).2.minified.js @@ -0,0 +1 @@ +//// [override18.ts] diff --git a/crates/swc/tests/tsc-references/parameterInitializersBackwardReferencing(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/parameterInitializersBackwardReferencing(target=esnext).1.normal.js new file mode 100644 index 000000000000..50ef424206b9 --- /dev/null +++ b/crates/swc/tests/tsc-references/parameterInitializersBackwardReferencing(target=esnext).1.normal.js @@ -0,0 +1,14 @@ +//// [parameterInitializersBackwardReferencing.ts] +// https://github.com/microsoft/TypeScript/issues/38243 +function test0({ a = 0, b = a } = {}) { + return { + a, + b + }; +} +function test1({ c: { a = 0, b = a } = {} } = {}) { + return { + a, + b + }; +} diff --git a/crates/swc/tests/tsc-references/parameterInitializersBackwardReferencing(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/parameterInitializersBackwardReferencing(target=esnext).2.minified.js new file mode 100644 index 000000000000..c57ddca64b44 --- /dev/null +++ b/crates/swc/tests/tsc-references/parameterInitializersBackwardReferencing(target=esnext).2.minified.js @@ -0,0 +1 @@ +//// [parameterInitializersBackwardReferencing.ts] diff --git a/crates/swc/tests/tsc-references/parameterInitializersForwardReferencing.2(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/parameterInitializersForwardReferencing.2(target=esnext).1.normal.js new file mode 100644 index 000000000000..ca6a5a52a09d --- /dev/null +++ b/crates/swc/tests/tsc-references/parameterInitializersForwardReferencing.2(target=esnext).1.normal.js @@ -0,0 +1,10 @@ +//// [parameterInitializersForwardReferencing.2.ts] +// https://github.com/microsoft/TypeScript/issues/36295 +function a() {} +function b({ b = a(), ...x } = a()) { + var a1; +} +const x = ""; +function c({ b, ...c } = a(), d = x) { + var x1; +} diff --git a/crates/swc/tests/tsc-references/parameterInitializersForwardReferencing.2(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/parameterInitializersForwardReferencing.2(target=esnext).2.minified.js new file mode 100644 index 000000000000..2b900ea175a5 --- /dev/null +++ b/crates/swc/tests/tsc-references/parameterInitializersForwardReferencing.2(target=esnext).2.minified.js @@ -0,0 +1 @@ +//// [parameterInitializersForwardReferencing.2.ts] diff --git a/crates/swc/tests/tsc-references/privateNameAndStaticInitializer(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/privateNameAndStaticInitializer(target=esnext).1.normal.js new file mode 100644 index 000000000000..5fd0913a509d --- /dev/null +++ b/crates/swc/tests/tsc-references/privateNameAndStaticInitializer(target=esnext).1.normal.js @@ -0,0 +1,12 @@ +//// [privateNameAndStaticInitializer.ts] +class A { + #foo; + static{ + this.inst = new A(); + } + #prop; + constructor(){ + this.#foo = 1; + this.#prop = 2; + } +} diff --git a/crates/swc/tests/tsc-references/privateNameAndStaticInitializer(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/privateNameAndStaticInitializer(target=esnext).2.minified.js new file mode 100644 index 000000000000..319a6f513d3b --- /dev/null +++ b/crates/swc/tests/tsc-references/privateNameAndStaticInitializer(target=esnext).2.minified.js @@ -0,0 +1,11 @@ +//// [privateNameAndStaticInitializer.ts] +class A { + #foo; + static{ + this.inst = new A(); + } + #prop; + constructor(){ + this.#foo = 1, this.#prop = 2; + } +} diff --git a/crates/swc/tests/tsc-references/privateNameComputedPropertyName1(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/privateNameComputedPropertyName1(target=esnext).1.normal.js new file mode 100644 index 000000000000..dddf07c23296 --- /dev/null +++ b/crates/swc/tests/tsc-references/privateNameComputedPropertyName1(target=esnext).1.normal.js @@ -0,0 +1,33 @@ +//// [privateNameComputedPropertyName1.ts] +class A { + #a; + #b; + #c; + #d; + #e; + constructor(){ + this.#a = 'a'; + this.#c = 'c'; + this.#e = ''; + this.#b = 'b'; + this.#d = 'd'; + } + test() { + const data = { + a: 'a', + b: 'b', + c: 'c', + d: 'd', + e: 'e' + }; + const { [this.#a]: a, [this.#b]: b, [this.#c]: c, [this.#d]: d, [this.#e = 'e']: e } = data; + console.log(a, b, c, d, e); + const a1 = data[this.#a]; + const b1 = data[this.#b]; + const c1 = data[this.#c]; + const d1 = data[this.#d]; + const e1 = data[this.#e]; + console.log(a1, b1, c1, d1); + } +} +new A().test(); diff --git a/crates/swc/tests/tsc-references/privateNameComputedPropertyName1(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/privateNameComputedPropertyName1(target=esnext).2.minified.js new file mode 100644 index 000000000000..7ffd75623e5c --- /dev/null +++ b/crates/swc/tests/tsc-references/privateNameComputedPropertyName1(target=esnext).2.minified.js @@ -0,0 +1,23 @@ +//// [privateNameComputedPropertyName1.ts] +new class { + #a; + #b; + #c; + #d; + #e; + constructor(){ + this.#a = 'a', this.#c = 'c', this.#e = '', this.#b = 'b', this.#d = 'd'; + } + test() { + let data = { + a: 'a', + b: 'b', + c: 'c', + d: 'd', + e: 'e' + }, { [this.#a]: a, [this.#b]: b, [this.#c]: c, [this.#d]: d, [this.#e = 'e']: e } = data; + console.log(a, b, c, d, e); + let a1 = data[this.#a], b1 = data[this.#b], c1 = data[this.#c], d1 = data[this.#d]; + data[this.#e], console.log(a1, b1, c1, d1); + } +}().test(); diff --git a/crates/swc/tests/tsc-references/privateNameComputedPropertyName2(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/privateNameComputedPropertyName2(target=esnext).1.normal.js new file mode 100644 index 000000000000..d45daae5a075 --- /dev/null +++ b/crates/swc/tests/tsc-references/privateNameComputedPropertyName2(target=esnext).1.normal.js @@ -0,0 +1,10 @@ +//// [privateNameComputedPropertyName2.ts] +let getX; +class A { + #x; + [(getX = (a)=>a.#x, "_")]() {} + constructor(){ + this.#x = 100; + } +} +console.log(getX(new A)); diff --git a/crates/swc/tests/tsc-references/privateNameComputedPropertyName2(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/privateNameComputedPropertyName2(target=esnext).2.minified.js new file mode 100644 index 000000000000..d45daae5a075 --- /dev/null +++ b/crates/swc/tests/tsc-references/privateNameComputedPropertyName2(target=esnext).2.minified.js @@ -0,0 +1,10 @@ +//// [privateNameComputedPropertyName2.ts] +let getX; +class A { + #x; + [(getX = (a)=>a.#x, "_")]() {} + constructor(){ + this.#x = 100; + } +} +console.log(getX(new A)); diff --git a/crates/swc/tests/tsc-references/privateNameComputedPropertyName3(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/privateNameComputedPropertyName3(target=esnext).1.normal.js new file mode 100644 index 000000000000..15cd298e7ed6 --- /dev/null +++ b/crates/swc/tests/tsc-references/privateNameComputedPropertyName3(target=esnext).1.normal.js @@ -0,0 +1,21 @@ +//// [privateNameComputedPropertyName3.ts] +class Foo { + #name; + constructor(name){ + this.#name = name; + } + getValue(x) { + const obj = this; + class Bar { + #y; + [obj.#name]() { + return x + this.#y; + } + constructor(){ + this.#y = 100; + } + } + return new Bar()[obj.#name](); + } +} +console.log(new Foo("NAME").getValue(100)); diff --git a/crates/swc/tests/tsc-references/privateNameComputedPropertyName3(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/privateNameComputedPropertyName3(target=esnext).2.minified.js new file mode 100644 index 000000000000..e7472b20dd14 --- /dev/null +++ b/crates/swc/tests/tsc-references/privateNameComputedPropertyName3(target=esnext).2.minified.js @@ -0,0 +1,20 @@ +//// [privateNameComputedPropertyName3.ts] +console.log(new class { + #name; + constructor(name){ + this.#name = name; + } + getValue(x) { + let obj = this; + class Bar { + #y; + [obj.#name]() { + return x + this.#y; + } + constructor(){ + this.#y = 100; + } + } + return new Bar()[obj.#name](); + } +}("NAME").getValue(100)); diff --git a/crates/swc/tests/tsc-references/privateNameComputedPropertyName4(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/privateNameComputedPropertyName4(target=esnext).1.normal.js new file mode 100644 index 000000000000..598ceb9a674f --- /dev/null +++ b/crates/swc/tests/tsc-references/privateNameComputedPropertyName4(target=esnext).1.normal.js @@ -0,0 +1,14 @@ +//// [privateNameComputedPropertyName4.ts] +// https://github.com/microsoft/TypeScript/issues/44113 +class C1 { + static #qux = 42; + ["bar"]() {} +} +class C2 { + static #qux = 42; + static ["bar"]() {} +} +class C3 { + static #qux = 42; + static ["bar"] = "test"; +} diff --git a/crates/swc/tests/tsc-references/privateNameComputedPropertyName4(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/privateNameComputedPropertyName4(target=esnext).2.minified.js new file mode 100644 index 000000000000..334fb01fafb0 --- /dev/null +++ b/crates/swc/tests/tsc-references/privateNameComputedPropertyName4(target=esnext).2.minified.js @@ -0,0 +1,13 @@ +//// [privateNameComputedPropertyName4.ts] +class C1 { + static #qux = 42; + bar() {} +} +class C2 { + static #qux = 42; + static bar() {} +} +class C3 { + static #qux = 42; + static bar = "test"; +} diff --git a/crates/swc/tests/tsc-references/privateNameFieldDestructuredBinding(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/privateNameFieldDestructuredBinding(target=esnext).1.normal.js new file mode 100644 index 000000000000..770d0c7a27e3 --- /dev/null +++ b/crates/swc/tests/tsc-references/privateNameFieldDestructuredBinding(target=esnext).1.normal.js @@ -0,0 +1,45 @@ +//// [privateNameFieldDestructuredBinding.ts] +class A { + #field; + testObject() { + return { + x: 10, + y: 6 + }; + } + testArray() { + return [ + 10, + 11 + ]; + } + constructor(){ + this.#field = 1; + this.otherObject = new A(); + let y; + ({ x: this.#field, y } = this.testObject()); + [this.#field, y] = this.testArray(); + ({ a: this.#field, b: [this.#field] } = { + a: 1, + b: [ + 2 + ] + }); + [this.#field, [this.#field]] = [ + 1, + [ + 2 + ] + ]; + ({ a: this.#field = 1, b: [this.#field = 1] } = { + b: [] + }); + [this.#field = 2] = []; + [this.otherObject.#field = 2] = []; + } + static test(_a) { + [_a.#field] = [ + 2 + ]; + } +} diff --git a/crates/swc/tests/tsc-references/privateNameFieldDestructuredBinding(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/privateNameFieldDestructuredBinding(target=esnext).2.minified.js new file mode 100644 index 000000000000..13c2e7932a2e --- /dev/null +++ b/crates/swc/tests/tsc-references/privateNameFieldDestructuredBinding(target=esnext).2.minified.js @@ -0,0 +1 @@ +//// [privateNameFieldDestructuredBinding.ts] diff --git a/crates/swc/tests/tsc-references/privateNameFieldsESNext(target=es2022).1.normal.js b/crates/swc/tests/tsc-references/privateNameFieldsESNext(target=es2022).1.normal.js new file mode 100644 index 000000000000..a3d280b7f456 --- /dev/null +++ b/crates/swc/tests/tsc-references/privateNameFieldsESNext(target=es2022).1.normal.js @@ -0,0 +1,23 @@ +//// [privateNameFieldsESNext.ts] +class C { + #a; + #b; + method() { + console.log(this.#a); + this.#a = "hello"; + console.log(this.#b); + } + static #m = "test"; + static #x; + static test() { + console.log(this.#m); + console.log(this.#x = "test"); + } + #something; + constructor(){ + this.a = 123; + this.#a = 10; + this.c = "hello"; + this.#something = ()=>1234; + } +} diff --git a/crates/swc/tests/tsc-references/privateNameFieldsESNext(target=es2022).2.minified.js b/crates/swc/tests/tsc-references/privateNameFieldsESNext(target=es2022).2.minified.js new file mode 100644 index 000000000000..b59a2f38544e --- /dev/null +++ b/crates/swc/tests/tsc-references/privateNameFieldsESNext(target=es2022).2.minified.js @@ -0,0 +1 @@ +//// [privateNameFieldsESNext.ts] diff --git a/crates/swc/tests/tsc-references/privateNameFieldsESNext(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/privateNameFieldsESNext(target=esnext).1.normal.js new file mode 100644 index 000000000000..a3d280b7f456 --- /dev/null +++ b/crates/swc/tests/tsc-references/privateNameFieldsESNext(target=esnext).1.normal.js @@ -0,0 +1,23 @@ +//// [privateNameFieldsESNext.ts] +class C { + #a; + #b; + method() { + console.log(this.#a); + this.#a = "hello"; + console.log(this.#b); + } + static #m = "test"; + static #x; + static test() { + console.log(this.#m); + console.log(this.#x = "test"); + } + #something; + constructor(){ + this.a = 123; + this.#a = 10; + this.c = "hello"; + this.#something = ()=>1234; + } +} diff --git a/crates/swc/tests/tsc-references/privateNameFieldsESNext(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/privateNameFieldsESNext(target=esnext).2.minified.js new file mode 100644 index 000000000000..b59a2f38544e --- /dev/null +++ b/crates/swc/tests/tsc-references/privateNameFieldsESNext(target=esnext).2.minified.js @@ -0,0 +1 @@ +//// [privateNameFieldsESNext.ts] diff --git a/crates/swc/tests/tsc-references/privateNameInInExpressionUnused(target=es2022).1.normal.js b/crates/swc/tests/tsc-references/privateNameInInExpressionUnused(target=es2022).1.normal.js new file mode 100644 index 000000000000..54cebaf32e76 --- /dev/null +++ b/crates/swc/tests/tsc-references/privateNameInInExpressionUnused(target=es2022).1.normal.js @@ -0,0 +1,9 @@ +//// [privateNameInInExpressionUnused.ts] +class Foo { + #unused; + #brand; + isFoo(v) { + // This should count as using/reading '#brand' + return #brand in v; + } +} diff --git a/crates/swc/tests/tsc-references/privateNameInInExpressionUnused(target=es2022).2.minified.js b/crates/swc/tests/tsc-references/privateNameInInExpressionUnused(target=es2022).2.minified.js new file mode 100644 index 000000000000..62c9d362c257 --- /dev/null +++ b/crates/swc/tests/tsc-references/privateNameInInExpressionUnused(target=es2022).2.minified.js @@ -0,0 +1 @@ +//// [privateNameInInExpressionUnused.ts] diff --git a/crates/swc/tests/tsc-references/privateNameInInExpressionUnused(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/privateNameInInExpressionUnused(target=esnext).1.normal.js new file mode 100644 index 000000000000..54cebaf32e76 --- /dev/null +++ b/crates/swc/tests/tsc-references/privateNameInInExpressionUnused(target=esnext).1.normal.js @@ -0,0 +1,9 @@ +//// [privateNameInInExpressionUnused.ts] +class Foo { + #unused; + #brand; + isFoo(v) { + // This should count as using/reading '#brand' + return #brand in v; + } +} diff --git a/crates/swc/tests/tsc-references/privateNameInInExpressionUnused(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/privateNameInInExpressionUnused(target=esnext).2.minified.js new file mode 100644 index 000000000000..62c9d362c257 --- /dev/null +++ b/crates/swc/tests/tsc-references/privateNameInInExpressionUnused(target=esnext).2.minified.js @@ -0,0 +1 @@ +//// [privateNameInInExpressionUnused.ts] diff --git a/crates/swc/tests/tsc-references/privateNameLateSuperUseDefineForClassFields(target=es2022).1.normal.js b/crates/swc/tests/tsc-references/privateNameLateSuperUseDefineForClassFields(target=es2022).1.normal.js new file mode 100644 index 000000000000..4b6f95186322 --- /dev/null +++ b/crates/swc/tests/tsc-references/privateNameLateSuperUseDefineForClassFields(target=es2022).1.normal.js @@ -0,0 +1,10 @@ +//// [privateNameLateSuperUseDefineForClassFields.ts] +class B { +} +class A extends B { + #x; + constructor(){ + void 0; + super(); + } +} diff --git a/crates/swc/tests/tsc-references/privateNameLateSuperUseDefineForClassFields(target=es2022).2.minified.js b/crates/swc/tests/tsc-references/privateNameLateSuperUseDefineForClassFields(target=es2022).2.minified.js new file mode 100644 index 000000000000..ec33ea961a9a --- /dev/null +++ b/crates/swc/tests/tsc-references/privateNameLateSuperUseDefineForClassFields(target=es2022).2.minified.js @@ -0,0 +1 @@ +//// [privateNameLateSuperUseDefineForClassFields.ts] diff --git a/crates/swc/tests/tsc-references/privateNameLateSuperUseDefineForClassFields(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/privateNameLateSuperUseDefineForClassFields(target=esnext).1.normal.js new file mode 100644 index 000000000000..4b6f95186322 --- /dev/null +++ b/crates/swc/tests/tsc-references/privateNameLateSuperUseDefineForClassFields(target=esnext).1.normal.js @@ -0,0 +1,10 @@ +//// [privateNameLateSuperUseDefineForClassFields.ts] +class B { +} +class A extends B { + #x; + constructor(){ + void 0; + super(); + } +} diff --git a/crates/swc/tests/tsc-references/privateNameLateSuperUseDefineForClassFields(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/privateNameLateSuperUseDefineForClassFields(target=esnext).2.minified.js new file mode 100644 index 000000000000..ec33ea961a9a --- /dev/null +++ b/crates/swc/tests/tsc-references/privateNameLateSuperUseDefineForClassFields(target=esnext).2.minified.js @@ -0,0 +1 @@ +//// [privateNameLateSuperUseDefineForClassFields.ts] diff --git a/crates/swc/tests/tsc-references/privateNameStaticAndStaticInitializer(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/privateNameStaticAndStaticInitializer(target=esnext).1.normal.js new file mode 100644 index 000000000000..434bb044f847 --- /dev/null +++ b/crates/swc/tests/tsc-references/privateNameStaticAndStaticInitializer(target=esnext).1.normal.js @@ -0,0 +1,5 @@ +//// [privateNameStaticAndStaticInitializer.ts] +class A { + static #foo = 1; + static #prop = 2; +} diff --git a/crates/swc/tests/tsc-references/privateNameStaticAndStaticInitializer(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/privateNameStaticAndStaticInitializer(target=esnext).2.minified.js new file mode 100644 index 000000000000..b59855d72020 --- /dev/null +++ b/crates/swc/tests/tsc-references/privateNameStaticAndStaticInitializer(target=esnext).2.minified.js @@ -0,0 +1 @@ +//// [privateNameStaticAndStaticInitializer.ts] diff --git a/crates/swc/tests/tsc-references/privateNameStaticFieldDestructuredBinding(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/privateNameStaticFieldDestructuredBinding(target=esnext).1.normal.js new file mode 100644 index 000000000000..17221beea7f7 --- /dev/null +++ b/crates/swc/tests/tsc-references/privateNameStaticFieldDestructuredBinding(target=esnext).1.normal.js @@ -0,0 +1,44 @@ +//// [privateNameStaticFieldDestructuredBinding.ts] +class A { + static #field = 1; + testObject() { + return { + x: 10, + y: 6 + }; + } + testArray() { + return [ + 10, + 11 + ]; + } + constructor(){ + this.otherClass = A; + let y; + ({ x: A.#field, y } = this.testObject()); + [A.#field, y] = this.testArray(); + ({ a: A.#field, b: [A.#field] } = { + a: 1, + b: [ + 2 + ] + }); + [A.#field, [A.#field]] = [ + 1, + [ + 2 + ] + ]; + ({ a: A.#field = 1, b: [A.#field = 1] } = { + b: [] + }); + [A.#field = 2] = []; + [this.otherClass.#field = 2] = []; + } + static test(_a) { + [_a.#field] = [ + 2 + ]; + } +} diff --git a/crates/swc/tests/tsc-references/privateNameStaticFieldDestructuredBinding(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/privateNameStaticFieldDestructuredBinding(target=esnext).2.minified.js new file mode 100644 index 000000000000..113e7ead7cd4 --- /dev/null +++ b/crates/swc/tests/tsc-references/privateNameStaticFieldDestructuredBinding(target=esnext).2.minified.js @@ -0,0 +1 @@ +//// [privateNameStaticFieldDestructuredBinding.ts] diff --git a/crates/swc/tests/tsc-references/privateNameStaticFieldInitializer(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/privateNameStaticFieldInitializer(target=esnext).1.normal.js new file mode 100644 index 000000000000..7ac578c389b6 --- /dev/null +++ b/crates/swc/tests/tsc-references/privateNameStaticFieldInitializer(target=esnext).1.normal.js @@ -0,0 +1,5 @@ +//// [privateNameStaticFieldInitializer.ts] +class A { + static #field = 10; + static #uninitialized; +} diff --git a/crates/swc/tests/tsc-references/privateNameStaticFieldInitializer(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/privateNameStaticFieldInitializer(target=esnext).2.minified.js new file mode 100644 index 000000000000..1939ffc1f64f --- /dev/null +++ b/crates/swc/tests/tsc-references/privateNameStaticFieldInitializer(target=esnext).2.minified.js @@ -0,0 +1 @@ +//// [privateNameStaticFieldInitializer.ts] diff --git a/crates/swc/tests/tsc-references/privateNameStaticFieldNoInitializer(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/privateNameStaticFieldNoInitializer(target=esnext).1.normal.js new file mode 100644 index 000000000000..fd2314f1fa16 --- /dev/null +++ b/crates/swc/tests/tsc-references/privateNameStaticFieldNoInitializer(target=esnext).1.normal.js @@ -0,0 +1,7 @@ +//// [privateNameStaticFieldNoInitializer.ts] +const C = class { + static #x; +}; +class C2 { + static #x; +} diff --git a/crates/swc/tests/tsc-references/privateNameStaticFieldNoInitializer(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/privateNameStaticFieldNoInitializer(target=esnext).2.minified.js new file mode 100644 index 000000000000..d22d917768fc --- /dev/null +++ b/crates/swc/tests/tsc-references/privateNameStaticFieldNoInitializer(target=esnext).2.minified.js @@ -0,0 +1 @@ +//// [privateNameStaticFieldNoInitializer.ts] diff --git a/crates/swc/tests/tsc-references/privateNameStaticsAndStaticMethods(target=es2022).1.normal.js b/crates/swc/tests/tsc-references/privateNameStaticsAndStaticMethods(target=es2022).1.normal.js new file mode 100644 index 000000000000..c0fc3f9926df --- /dev/null +++ b/crates/swc/tests/tsc-references/privateNameStaticsAndStaticMethods(target=es2022).1.normal.js @@ -0,0 +1,29 @@ +//// [privateNameStaticsAndStaticMethods.ts] +class A { + static #foo(a) {} + static async #bar(a) {} + static async *#baz(a) { + return 3; + } + static #_quux; + static get #quux() { + return this.#_quux; + } + static set #quux(val) { + this.#_quux = val; + } + constructor(){ + A.#foo(30); + A.#bar(30); + A.#bar(30); + A.#quux = A.#quux + 1; + A.#quux++; + } +} +class B extends A { + static #foo(a) {} + constructor(){ + super(); + B.#foo("str"); + } +} diff --git a/crates/swc/tests/tsc-references/privateNameStaticsAndStaticMethods(target=es2022).2.minified.js b/crates/swc/tests/tsc-references/privateNameStaticsAndStaticMethods(target=es2022).2.minified.js new file mode 100644 index 000000000000..2c1d2742e561 --- /dev/null +++ b/crates/swc/tests/tsc-references/privateNameStaticsAndStaticMethods(target=es2022).2.minified.js @@ -0,0 +1 @@ +//// [privateNameStaticsAndStaticMethods.ts] diff --git a/crates/swc/tests/tsc-references/privateNameStaticsAndStaticMethods(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/privateNameStaticsAndStaticMethods(target=esnext).1.normal.js new file mode 100644 index 000000000000..c0fc3f9926df --- /dev/null +++ b/crates/swc/tests/tsc-references/privateNameStaticsAndStaticMethods(target=esnext).1.normal.js @@ -0,0 +1,29 @@ +//// [privateNameStaticsAndStaticMethods.ts] +class A { + static #foo(a) {} + static async #bar(a) {} + static async *#baz(a) { + return 3; + } + static #_quux; + static get #quux() { + return this.#_quux; + } + static set #quux(val) { + this.#_quux = val; + } + constructor(){ + A.#foo(30); + A.#bar(30); + A.#bar(30); + A.#quux = A.#quux + 1; + A.#quux++; + } +} +class B extends A { + static #foo(a) {} + constructor(){ + super(); + B.#foo("str"); + } +} diff --git a/crates/swc/tests/tsc-references/privateNameStaticsAndStaticMethods(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/privateNameStaticsAndStaticMethods(target=esnext).2.minified.js new file mode 100644 index 000000000000..2c1d2742e561 --- /dev/null +++ b/crates/swc/tests/tsc-references/privateNameStaticsAndStaticMethods(target=esnext).2.minified.js @@ -0,0 +1 @@ +//// [privateNameStaticsAndStaticMethods.ts] diff --git a/crates/swc/tests/tsc-references/privateNameWhenNotUseDefineForClassFieldsInEsNext(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/privateNameWhenNotUseDefineForClassFieldsInEsNext(target=esnext).1.normal.js new file mode 100644 index 000000000000..0263ed9ebb6e --- /dev/null +++ b/crates/swc/tests/tsc-references/privateNameWhenNotUseDefineForClassFieldsInEsNext(target=esnext).1.normal.js @@ -0,0 +1,75 @@ +//// [privateNameWhenNotUseDefineForClassFieldsInEsNext.ts] +class TestWithStatics { + #prop; + static{ + this.dd = new TestWithStatics().#prop // OK + ; + } + static{ + this["X_ z_ zz"] = class Inner { + #foo; + m() { + new TestWithStatics().#prop // OK + ; + } + static{ + this.C = class InnerInner { + m() { + new TestWithStatics().#prop // OK + ; + new Inner().#foo; // OK + } + }; + } + static M() { + return class { + m() { + new TestWithStatics().#prop // OK + ; + new Inner().#foo; // OK + } + }; + } + constructor(){ + this.#foo = 10; + } + }; + } + constructor(){ + this.#prop = 0; + } +} +class TestNonStatics { + #prop; + constructor(){ + this.#prop = 0; + this.dd = new TestNonStatics().#prop // OK + ; + this["X_ z_ zz"] = class Inner { + #foo; + m() { + new TestNonStatics().#prop // Ok + ; + } + static M() { + return class { + m() { + new TestNonStatics().#prop // OK + ; + new Inner().#foo; // OK + } + }; + } + constructor(){ + this.#foo = 10; + this.C = class InnerInner { + m() { + new TestNonStatics().#prop // Ok + ; + new Inner().#foo; // Ok + } + }; + } + }; + } +} diff --git a/crates/swc/tests/tsc-references/privateNameWhenNotUseDefineForClassFieldsInEsNext(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/privateNameWhenNotUseDefineForClassFieldsInEsNext(target=esnext).2.minified.js new file mode 100644 index 000000000000..ed621b00894b --- /dev/null +++ b/crates/swc/tests/tsc-references/privateNameWhenNotUseDefineForClassFieldsInEsNext(target=esnext).2.minified.js @@ -0,0 +1,35 @@ +//// [privateNameWhenNotUseDefineForClassFieldsInEsNext.ts] +class TestWithStatics { + #prop; + static{ + this.dd = new TestWithStatics().#prop; + } + static{ + this["X_ z_ zz"] = class Inner { + #foo; + m() { + new TestWithStatics().#prop; + } + static{ + this.C = class { + m() { + new TestWithStatics().#prop, new Inner().#foo; + } + }; + } + static M() { + return class { + m() { + new TestWithStatics().#prop, new Inner().#foo; + } + }; + } + constructor(){ + this.#foo = 10; + } + }; + } + constructor(){ + this.#prop = 0; + } +} diff --git a/crates/swc/tests/tsc-references/privateNamesAndMethods(target=es2022).1.normal.js b/crates/swc/tests/tsc-references/privateNamesAndMethods(target=es2022).1.normal.js new file mode 100644 index 000000000000..41438d1cf983 --- /dev/null +++ b/crates/swc/tests/tsc-references/privateNamesAndMethods(target=es2022).1.normal.js @@ -0,0 +1,29 @@ +//// [privateNamesAndMethods.ts] +class A { + #foo(a) {} + async #bar(a) {} + async *#baz(a) { + return 3; + } + #_quux; + get #quux() { + return this.#_quux; + } + set #quux(val) { + this.#_quux = val; + } + constructor(){ + this.#foo(30); + this.#bar(30); + this.#baz(30); + this.#quux = this.#quux + 1; + this.#quux++; + } +} +class B extends A { + #foo(a) {} + constructor(){ + super(); + this.#foo("str"); + } +} diff --git a/crates/swc/tests/tsc-references/privateNamesAndMethods(target=es2022).2.minified.js b/crates/swc/tests/tsc-references/privateNamesAndMethods(target=es2022).2.minified.js new file mode 100644 index 000000000000..9244b187b6ec --- /dev/null +++ b/crates/swc/tests/tsc-references/privateNamesAndMethods(target=es2022).2.minified.js @@ -0,0 +1 @@ +//// [privateNamesAndMethods.ts] diff --git a/crates/swc/tests/tsc-references/privateNamesAndMethods(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/privateNamesAndMethods(target=esnext).1.normal.js new file mode 100644 index 000000000000..41438d1cf983 --- /dev/null +++ b/crates/swc/tests/tsc-references/privateNamesAndMethods(target=esnext).1.normal.js @@ -0,0 +1,29 @@ +//// [privateNamesAndMethods.ts] +class A { + #foo(a) {} + async #bar(a) {} + async *#baz(a) { + return 3; + } + #_quux; + get #quux() { + return this.#_quux; + } + set #quux(val) { + this.#_quux = val; + } + constructor(){ + this.#foo(30); + this.#bar(30); + this.#baz(30); + this.#quux = this.#quux + 1; + this.#quux++; + } +} +class B extends A { + #foo(a) {} + constructor(){ + super(); + this.#foo("str"); + } +} diff --git a/crates/swc/tests/tsc-references/privateNamesAndMethods(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/privateNamesAndMethods(target=esnext).2.minified.js new file mode 100644 index 000000000000..9244b187b6ec --- /dev/null +++ b/crates/swc/tests/tsc-references/privateNamesAndMethods(target=esnext).2.minified.js @@ -0,0 +1 @@ +//// [privateNamesAndMethods.ts] diff --git a/crates/swc/tests/tsc-references/privateNamesAndStaticMethods(target=es2022).1.normal.js b/crates/swc/tests/tsc-references/privateNamesAndStaticMethods(target=es2022).1.normal.js new file mode 100644 index 000000000000..be9e83b723a3 --- /dev/null +++ b/crates/swc/tests/tsc-references/privateNamesAndStaticMethods(target=es2022).1.normal.js @@ -0,0 +1,29 @@ +//// [privateNamesAndStaticMethods.ts] +class A { + static #foo(a) {} + static async #bar(a) {} + static async *#baz(a) { + return 3; + } + static #_quux; + static get #quux() { + return this.#_quux; + } + static set #quux(val) { + this.#_quux = val; + } + constructor(){ + A.#foo(30); + A.#bar(30); + A.#bar(30); + A.#quux = A.#quux + 1; + A.#quux++; + } +} +class B extends A { + static #foo(a) {} + constructor(){ + super(); + B.#foo("str"); + } +} diff --git a/crates/swc/tests/tsc-references/privateNamesAndStaticMethods(target=es2022).2.minified.js b/crates/swc/tests/tsc-references/privateNamesAndStaticMethods(target=es2022).2.minified.js new file mode 100644 index 000000000000..0b8775a1f650 --- /dev/null +++ b/crates/swc/tests/tsc-references/privateNamesAndStaticMethods(target=es2022).2.minified.js @@ -0,0 +1 @@ +//// [privateNamesAndStaticMethods.ts] diff --git a/crates/swc/tests/tsc-references/privateNamesAndStaticMethods(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/privateNamesAndStaticMethods(target=esnext).1.normal.js new file mode 100644 index 000000000000..be9e83b723a3 --- /dev/null +++ b/crates/swc/tests/tsc-references/privateNamesAndStaticMethods(target=esnext).1.normal.js @@ -0,0 +1,29 @@ +//// [privateNamesAndStaticMethods.ts] +class A { + static #foo(a) {} + static async #bar(a) {} + static async *#baz(a) { + return 3; + } + static #_quux; + static get #quux() { + return this.#_quux; + } + static set #quux(val) { + this.#_quux = val; + } + constructor(){ + A.#foo(30); + A.#bar(30); + A.#bar(30); + A.#quux = A.#quux + 1; + A.#quux++; + } +} +class B extends A { + static #foo(a) {} + constructor(){ + super(); + B.#foo("str"); + } +} diff --git a/crates/swc/tests/tsc-references/privateNamesAndStaticMethods(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/privateNamesAndStaticMethods(target=esnext).2.minified.js new file mode 100644 index 000000000000..0b8775a1f650 --- /dev/null +++ b/crates/swc/tests/tsc-references/privateNamesAndStaticMethods(target=esnext).2.minified.js @@ -0,0 +1 @@ +//// [privateNamesAndStaticMethods.ts] diff --git a/crates/swc/tests/tsc-references/privateNamesAssertion(target=es2022).1.normal.js b/crates/swc/tests/tsc-references/privateNamesAssertion(target=es2022).1.normal.js new file mode 100644 index 000000000000..d30b6d790658 --- /dev/null +++ b/crates/swc/tests/tsc-references/privateNamesAssertion(target=es2022).1.normal.js @@ -0,0 +1,26 @@ +//// [privateNamesAssertion.ts] +class Foo { + #p1; + m1(v) { + this.#p1(v); + v; + } + constructor(){ + this.#p1 = (v)=>{ + if (typeof v !== "string") { + throw new Error(); + } + }; + } +} +class Foo2 { + #p1(v) { + if (typeof v !== "string") { + throw new Error(); + } + } + m1(v) { + this.#p1(v); + v; + } +} diff --git a/crates/swc/tests/tsc-references/privateNamesAssertion(target=es2022).2.minified.js b/crates/swc/tests/tsc-references/privateNamesAssertion(target=es2022).2.minified.js new file mode 100644 index 000000000000..bcb198b06717 --- /dev/null +++ b/crates/swc/tests/tsc-references/privateNamesAssertion(target=es2022).2.minified.js @@ -0,0 +1 @@ +//// [privateNamesAssertion.ts] diff --git a/crates/swc/tests/tsc-references/privateNamesAssertion(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/privateNamesAssertion(target=esnext).1.normal.js new file mode 100644 index 000000000000..d30b6d790658 --- /dev/null +++ b/crates/swc/tests/tsc-references/privateNamesAssertion(target=esnext).1.normal.js @@ -0,0 +1,26 @@ +//// [privateNamesAssertion.ts] +class Foo { + #p1; + m1(v) { + this.#p1(v); + v; + } + constructor(){ + this.#p1 = (v)=>{ + if (typeof v !== "string") { + throw new Error(); + } + }; + } +} +class Foo2 { + #p1(v) { + if (typeof v !== "string") { + throw new Error(); + } + } + m1(v) { + this.#p1(v); + v; + } +} diff --git a/crates/swc/tests/tsc-references/privateNamesAssertion(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/privateNamesAssertion(target=esnext).2.minified.js new file mode 100644 index 000000000000..bcb198b06717 --- /dev/null +++ b/crates/swc/tests/tsc-references/privateNamesAssertion(target=esnext).2.minified.js @@ -0,0 +1 @@ +//// [privateNamesAssertion.ts] diff --git a/crates/swc/tests/tsc-references/superInStaticMembers1(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/superInStaticMembers1(target=esnext).1.normal.js new file mode 100644 index 000000000000..0303766a7790 --- /dev/null +++ b/crates/swc/tests/tsc-references/superInStaticMembers1(target=esnext).1.normal.js @@ -0,0 +1,482 @@ +//// [superInStaticMembers1.ts] +//// [external.ts] +export class Reflect { +} +export var Baz; +(function(Baz) {})(Baz || (Baz = {})); +export default class { +} +//// [locals.ts] +class C extends B { + static{ + this._ = [ + (()=>{ + var Reflect; // collision (es2015-es2021 only) + super.w(); + })(), + (()=>{ + var { Reflect } = { + Reflect: null + }; // collision (es2015-es2021 only) + super.w(); + })(), + (()=>{ + var [Reflect] = [ + null + ]; // collision (es2015-es2021 only) + super.w(); + })(), + (()=>{ + class Reflect { + } // collision (es2015-es2021 only) + super.w(); + })(), + (()=>{ + function Reflect() {} // collision (es2015-es2021 only) + super.w(); + })(), + (()=>{ + let Reflect; + (function(Reflect) {})(Reflect || (Reflect = {})); // collision (es2015-es2021 only) + super.w(); + })(), + (()=>{ + let Reflect; + super.w(); + })(), + (()=>{ + super.w(); + })(), + (()=>{ + super.w(); + })(), + (()=>{ + (class Reflect { + }); // no collision + super.w(); + })(), + (()=>{ + (function Reflect() {}); // no collision + super.w(); + })() + ]; + } + static{ + var { Reflect } = { + Reflect: null + }; // collision (es2015-es2021 only) + super.w(); + } + static{ + var [Reflect] = [ + null + ]; // collision (es2015-es2021 only) + super.w(); + } + static{ + var Reflect; // collision (es2015-es2021 only) + super.w(); + } + static{ + class Reflect { + } // collision (es2015-es2021 only) + super.w(); + } + static{ + function Reflect() {} // collision (es2015-es2021 only) + super.w(); + } + static{ + let Reflect; + (function(Reflect) {})(Reflect || (Reflect = {})); // collision (es2015-es2021 only) + super.w(); + } + static{ + let Reflect; + super.w(); + } + static{ + super.w(); + } + static{ + super.w(); + } + static{ + (class Reflect { + } // no collision + ); + super.w(); + } + static{ + (function Reflect() {} // no collision + ); + super.w(); + } +} +export { }; +//// [varInContainingScopeStaticField1.ts] +var Reflect = null; // collision (es2015-es2021 only) +class C extends B { + static{ + this._ = super.w(); + } +} +export { }; +//// [varInContainingScopeStaticField2.ts] +var { Reflect } = { + Reflect: null +}; // collision (es2015-es2021 only) +class C extends B { + static{ + this._ = super.w(); + } +} +export { }; +//// [varInContainingScopeStaticField3.ts] +var [Reflect] = [ + null +]; // collision (es2015-es2021 only) +class C extends B { + static{ + this._ = super.w(); + } +} +export { }; +//// [varInContainingScopeStaticBlock1.ts] +var Reflect = null; // collision (es2015-es2021 only) +class C extends B { + static{ + super.w(); + } +} +export { }; +//// [varInContainingScopeStaticBlock2.ts] +var { Reflect } = { + Reflect: null +}; // collision (es2015-es2021 only) +class C extends B { + static{ + super.w(); + } +} +export { }; +//// [varInContainingScopeStaticBlock3.ts] +var [Reflect] = [ + null +]; // collision (es2015-es2021 only) +class C extends B { + static{ + super.w(); + } +} +export { }; +//// [classDeclInContainingScopeStaticField.ts] +class Reflect { +} // collision (es2015-es2021 only) +class C extends B { + static{ + this._ = super.w(); + } +} +export { }; +//// [classDeclInContainingScopeStaticBlock.ts] +class Reflect { +} // collision (es2015-es2021 only) +class C extends B { + static{ + super.w(); + } +} +export { }; +//// [funcDeclInContainingScopeStaticField.ts] +function Reflect() {} // collision (es2015-es2021 only) +class C extends B { + static{ + this._ = super.w(); + } +} +export { }; +//// [funcDeclInContainingScopeStaticBlock.ts] +function Reflect() {} // collision (es2015-es2021 only) +class C extends B { + static{ + super.w(); + } +} +export { }; +//// [valueNamespaceInContainingScopeStaticField.ts] +class C extends B { + static{ + this._ = super.w(); + } +} +export { }; +//// [valueNamespaceInContainingScopeStaticBlock.ts] +class C extends B { + static{ + super.w(); + } +} +export { }; +//// [enumInContainingScopeStaticField.ts] +var Reflect; +(function(Reflect) {})(Reflect || (Reflect = {})); // collision (es2015-es2021 only) +class C extends B { + static{ + this._ = super.w(); + } +} +export { }; +//// [enumInContainingScopeStaticBlock.ts] +var Reflect; +(function(Reflect) {})(Reflect || (Reflect = {})); // collision (es2015-es2021 only) +class C extends B { + static{ + super.w(); + } +} +export { }; +//// [constEnumInContainingScopeStaticField.ts] +var Reflect; +class C extends B { + static{ + this._ = super.w(); + } +} +export { }; +//// [constEnumInContainingScopeStaticBlock.ts] +var Reflect; +class C extends B { + static{ + super.w(); + } +} +export { }; +//// [namespaceImportInContainingScopeStaticField.ts] +class C extends B { + static{ + this._ = super.w(); + } +} +export { }; // collision (es2015-es2021 only) +//// [namespaceImportInContainingScopeStaticBlock.ts] +class C extends B { + static{ + super.w(); + } +} +export { }; // collision (es2015-es2021 only) +//// [namedImportInContainingScopeStaticField.ts] +class C extends B { + static{ + this._ = super.w(); + } +} +export { }; // collision (es2015-es2021 only) +//// [namedImportInContainingScopeStaticBlock.ts] +class C extends B { + static{ + super.w(); + } +} +export { }; // collision (es2015-es2021 only) +//// [namedImportOfInterfaceInContainingScopeStaticField.ts] +class C extends B { + static{ + this._ = super.w(); + } +} +export { }; // collision (es2015-es2021 only, not a type-only import) +//// [namedImportOfInterfaceInContainingScopeStaticBlock.ts] +class C extends B { + static{ + super.w(); + } +} +export { }; // collision (es2015-es2021 only, not a type-only import) +//// [namedImportOfUninstantiatedNamespaceInContainingScopeStaticField.ts] +class C extends B { + static{ + this._ = super.w(); + } +} +export { }; // collision (es2015-es2021 only, not a type-only import) +//// [namedImportOfUninstantiatedNamespaceInContainingScopeStaticBlock.ts] +class C extends B { + static{ + super.w(); + } +} +export { }; // collision (es2015-es2021 only, not a type-only import) +//// [namedImportOfConstEnumInContainingScopeStaticField.ts] +class C extends B { + static{ + this._ = super.w(); + } +} +export { }; // collision (es2015-es2021 only) +//// [namedImportOfConstEnumInContainingScopeStaticBlock.ts] +class C extends B { + static{ + super.w(); + } +} +export { }; // collision (es2015-es2021 only) +//// [typeOnlyNamedImportInContainingScopeStaticField.ts] +class C extends B { + static{ + this._ = super.w(); + } +} +export { }; // no collision +//// [typeOnlyNamedImportInContainingScopeStaticBlock.ts] +class C extends B { + static{ + super.w(); + } +} +export { }; // no collision +//// [defaultImportInContainingScopeStaticField.ts] +class C extends B { + static{ + this._ = super.w(); + } +} +export { }; // collision (es2015-es2021 only) +//// [defaultImportInContainingScopeStaticBlock.ts] +class C extends B { + static{ + super.w(); + } +} +export { }; // collision (es2015-es2021 only) +//// [typeOnlyDefaultImportInContainingScopeStaticField.ts] +class C extends B { + static{ + this._ = super.w(); + } +} +export { }; // no collision +//// [typeOnlyDefaultImportInContainingScopeStaticBlock.ts] +class C extends B { + static{ + super.w(); + } +} +export { }; // no collision +//// [typeInContainingScopeStaticField.ts] +class C extends B { + static{ + this._ = super.w(); + } +} +export { }; +//// [typeInContainingScopeStaticBlock.ts] +class C extends B { + static{ + super.w(); + } +} +export { }; +//// [interfaceInContainingScopeStaticField.ts] +class C extends B { + static{ + this._ = super.w(); + } +} +export { }; +//// [interfaceInContainingScopeStaticBlock.ts] +class C extends B { + static{ + super.w(); + } +} +export { }; +//// [uninstantiatedNamespaceInContainingScopeStaticField.ts] +class C extends B { + static{ + this._ = super.w(); + } +} +export { }; +//// [uninstantiatedNamespaceInContainingScopeStaticBlock.ts] +class C extends B { + static{ + super.w(); + } +} +export { }; +//// [classExprInContainingScopeStaticField.ts] +(class Reflect { +}); // no collision +class C extends B { + static{ + this._ = super.w(); + } +} +export { }; +//// [classExprInContainingScopeStaticBlock.ts] +(class Reflect { +}); // no collision +class C extends B { + static{ + super.w(); + } +} +export { }; +//// [inContainingClassExprStaticField.ts] +(class Reflect { + static{ + class C extends B { + static{ + this._ = super.w(); + } + } + } +}); +export { }; +//// [inContainingClassExprStaticBlock.ts] +(class Reflect { + static{ + class C extends B { + static{ + super.w(); + } + } + } +}); +export { }; +//// [funcExprInContainingScopeStaticField.ts] +(function Reflect() {}); // no collision +class C extends B { + static{ + this._ = super.w(); + } +} +export { }; +//// [funcExprInContainingScopeStaticBlock.ts] +(function Reflect() {}); // no collision +class C extends B { + static{ + super.w(); + } +} +export { }; +//// [inContainingFuncExprStaticField.ts] +(function Reflect() { + class C extends B { + static{ + this._ = super.w(); + } + } +}); +export { }; +//// [inContainingFuncExprStaticBlock.ts] +(function Reflect() { + class C extends B { + static{ + super.w(); + } + } +}); +export { }; diff --git a/crates/swc/tests/tsc-references/superInStaticMembers1(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/superInStaticMembers1(target=esnext).2.minified.js new file mode 100644 index 000000000000..a56d6182ef52 --- /dev/null +++ b/crates/swc/tests/tsc-references/superInStaticMembers1(target=esnext).2.minified.js @@ -0,0 +1,414 @@ +//// [superInStaticMembers1.ts] +//// [external.ts] +export class Reflect { +} +export var Baz; +Baz || (Baz = {}); +export default class { +} +//// [locals.ts] +class C extends B { + static{ + let Reflect; + this._ = [ + void super.w(), + (()=>{ + var { Reflect } = { + Reflect: null + }; + super.w(); + })(), + (()=>{ + var [Reflect] = [ + null + ]; + super.w(); + })(), + void super.w(), + void super.w(), + void (Reflect || (Reflect = {}), super.w()), + void super.w(), + void super.w(), + void super.w(), + void super.w(), + void super.w() + ]; + } + static{ + var { Reflect } = { + Reflect: null + }; + super.w(); + } + static{ + var [Reflect] = [ + null + ]; + super.w(); + } + static{ + super.w(); + } + static{ + super.w(); + } + static{ + super.w(); + } + static{ + let Reflect; + Reflect || (Reflect = {}), super.w(); + } + static{ + super.w(); + } + static{ + super.w(); + } + static{ + super.w(); + } + static{ + super.w(); + } + static{ + super.w(); + } +} +export { }; +//// [varInContainingScopeStaticField1.ts] +class C extends B { + static{ + this._ = super.w(); + } +} +export { }; +//// [varInContainingScopeStaticField2.ts] +var { Reflect } = { + Reflect: null +}; +class C extends B { + static{ + this._ = super.w(); + } +} +export { }; +//// [varInContainingScopeStaticField3.ts] +var [Reflect] = [ + null +]; +class C extends B { + static{ + this._ = super.w(); + } +} +export { }; +//// [varInContainingScopeStaticBlock1.ts] +class C extends B { + static{ + super.w(); + } +} +export { }; +//// [varInContainingScopeStaticBlock2.ts] +var { Reflect } = { + Reflect: null +}; +class C extends B { + static{ + super.w(); + } +} +export { }; +//// [varInContainingScopeStaticBlock3.ts] +var [Reflect] = [ + null +]; +class C extends B { + static{ + super.w(); + } +} +export { }; +//// [classDeclInContainingScopeStaticField.ts] +class C extends B { + static{ + this._ = super.w(); + } +} +export { }; +//// [classDeclInContainingScopeStaticBlock.ts] +class C extends B { + static{ + super.w(); + } +} +export { }; +//// [funcDeclInContainingScopeStaticField.ts] +class C extends B { + static{ + this._ = super.w(); + } +} +export { }; +//// [funcDeclInContainingScopeStaticBlock.ts] +class C extends B { + static{ + super.w(); + } +} +export { }; +//// [valueNamespaceInContainingScopeStaticField.ts] +class C extends B { + static{ + this._ = super.w(); + } +} +export { }; +//// [valueNamespaceInContainingScopeStaticBlock.ts] +class C extends B { + static{ + super.w(); + } +} +export { }; +//// [enumInContainingScopeStaticField.ts] +var Reflect; +Reflect || (Reflect = {}); +class C extends B { + static{ + this._ = super.w(); + } +} +export { }; +//// [enumInContainingScopeStaticBlock.ts] +var Reflect; +Reflect || (Reflect = {}); +class C extends B { + static{ + super.w(); + } +} +export { }; +//// [constEnumInContainingScopeStaticField.ts] +class C extends B { + static{ + this._ = super.w(); + } +} +export { }; +//// [constEnumInContainingScopeStaticBlock.ts] +class C extends B { + static{ + super.w(); + } +} +export { }; +//// [namespaceImportInContainingScopeStaticField.ts] +class C extends B { + static{ + this._ = super.w(); + } +} +export { }; +//// [namespaceImportInContainingScopeStaticBlock.ts] +class C extends B { + static{ + super.w(); + } +} +export { }; +//// [namedImportInContainingScopeStaticField.ts] +class C extends B { + static{ + this._ = super.w(); + } +} +export { }; +//// [namedImportInContainingScopeStaticBlock.ts] +class C extends B { + static{ + super.w(); + } +} +export { }; +//// [namedImportOfInterfaceInContainingScopeStaticField.ts] +class C extends B { + static{ + this._ = super.w(); + } +} +export { }; +//// [namedImportOfInterfaceInContainingScopeStaticBlock.ts] +class C extends B { + static{ + super.w(); + } +} +export { }; +//// [namedImportOfUninstantiatedNamespaceInContainingScopeStaticField.ts] +class C extends B { + static{ + this._ = super.w(); + } +} +export { }; +//// [namedImportOfUninstantiatedNamespaceInContainingScopeStaticBlock.ts] +class C extends B { + static{ + super.w(); + } +} +export { }; +//// [namedImportOfConstEnumInContainingScopeStaticField.ts] +class C extends B { + static{ + this._ = super.w(); + } +} +export { }; +//// [namedImportOfConstEnumInContainingScopeStaticBlock.ts] +class C extends B { + static{ + super.w(); + } +} +export { }; +//// [typeOnlyNamedImportInContainingScopeStaticField.ts] +class C extends B { + static{ + this._ = super.w(); + } +} +export { }; +//// [typeOnlyNamedImportInContainingScopeStaticBlock.ts] +class C extends B { + static{ + super.w(); + } +} +export { }; +//// [defaultImportInContainingScopeStaticField.ts] +class C extends B { + static{ + this._ = super.w(); + } +} +export { }; +//// [defaultImportInContainingScopeStaticBlock.ts] +class C extends B { + static{ + super.w(); + } +} +export { }; +//// [typeOnlyDefaultImportInContainingScopeStaticField.ts] +class C extends B { + static{ + this._ = super.w(); + } +} +export { }; +//// [typeOnlyDefaultImportInContainingScopeStaticBlock.ts] +class C extends B { + static{ + super.w(); + } +} +export { }; +//// [typeInContainingScopeStaticField.ts] +class C extends B { + static{ + this._ = super.w(); + } +} +export { }; +//// [typeInContainingScopeStaticBlock.ts] +class C extends B { + static{ + super.w(); + } +} +export { }; +//// [interfaceInContainingScopeStaticField.ts] +class C extends B { + static{ + this._ = super.w(); + } +} +export { }; +//// [interfaceInContainingScopeStaticBlock.ts] +class C extends B { + static{ + super.w(); + } +} +export { }; +//// [uninstantiatedNamespaceInContainingScopeStaticField.ts] +class C extends B { + static{ + this._ = super.w(); + } +} +export { }; +//// [uninstantiatedNamespaceInContainingScopeStaticBlock.ts] +class C extends B { + static{ + super.w(); + } +} +export { }; +//// [classExprInContainingScopeStaticField.ts] +class C extends B { + static{ + this._ = super.w(); + } +} +export { }; +//// [classExprInContainingScopeStaticBlock.ts] +class C extends B { + static{ + super.w(); + } +} +export { }; +//// [inContainingClassExprStaticField.ts] +(class { + static{ + class C extends B { + static{ + this._ = super.w(); + } + } + } +}); +export { }; +//// [inContainingClassExprStaticBlock.ts] +(class { + static{ + class C extends B { + static{ + super.w(); + } + } + } +}); +export { }; +//// [funcExprInContainingScopeStaticField.ts] +class C extends B { + static{ + this._ = super.w(); + } +} +export { }; +//// [funcExprInContainingScopeStaticBlock.ts] +class C extends B { + static{ + super.w(); + } +} +export { }; +//// [inContainingFuncExprStaticField.ts] +export { }; +//// [inContainingFuncExprStaticBlock.ts] +export { }; diff --git a/crates/swc/tests/tsc-references/thisAndSuperInStaticMembers1(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/thisAndSuperInStaticMembers1(target=esnext).1.normal.js new file mode 100644 index 000000000000..e0e2085319e5 --- /dev/null +++ b/crates/swc/tests/tsc-references/thisAndSuperInStaticMembers1(target=esnext).1.normal.js @@ -0,0 +1,45 @@ +//// [thisAndSuperInStaticMembers1.ts] +class C extends B { + static x = undefined; + static y1 = this.x; + static y2 = this.x(); + static y3 = this?.x(); + static y4 = this["x"](); + static y5 = this?.["x"](); + static z1 = super.a; + static z2 = super["a"]; + static z3 = super.f(); + static z4 = super["f"](); + static z5 = super.a = 0; + static z6 = super.a += 1; + static z7 = (()=>{ + super.a = 0; + })(); + static z8 = [super.a] = [ + 0 + ]; + static z9 = [super.a = 0] = [ + 0 + ]; + static z10 = [...super.a] = [ + 0 + ]; + static z11 = { x: super.a } = { + x: 0 + }; + static z12 = { x: super.a = 0 } = { + x: 0 + }; + static z13 = { ...super.a } = { + x: 0 + }; + static z14 = ++super.a; + static z15 = --super.a; + static z16 = ++super["a"]; + static z17 = super.a++; + static z18 = super.a``; + // these should be unaffected + x = 1; + y = this.x; + z = super.f(); +} diff --git a/crates/swc/tests/tsc-references/thisAndSuperInStaticMembers1(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/thisAndSuperInStaticMembers1(target=esnext).2.minified.js new file mode 100644 index 000000000000..660eb7df27f4 --- /dev/null +++ b/crates/swc/tests/tsc-references/thisAndSuperInStaticMembers1(target=esnext).2.minified.js @@ -0,0 +1,42 @@ +//// [thisAndSuperInStaticMembers1.ts] +class C extends B { + static x = void 0; + static y1 = this.x; + static y2 = this.x(); + static y3 = this?.x(); + static y4 = this.x(); + static y5 = this?.x(); + static z1 = super.a; + static z2 = super.a; + static z3 = super.f(); + static z4 = super.f(); + static z5 = super.a = 0; + static z6 = super.a += 1; + static z7 = void (super.a = 0); + static z8 = [super.a] = [ + 0 + ]; + static z9 = [super.a = 0] = [ + 0 + ]; + static z10 = [...super.a] = [ + 0 + ]; + static z11 = { x: super.a } = { + x: 0 + }; + static z12 = { x: super.a = 0 } = { + x: 0 + }; + static z13 = { ...super.a } = { + x: 0 + }; + static z14 = ++super.a; + static z15 = --super.a; + static z16 = ++super.a; + static z17 = super.a++; + static z18 = super.a``; + x = 1; + y = this.x; + z = super.f(); +} diff --git a/crates/swc/tests/tsc-references/thisAndSuperInStaticMembers2(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/thisAndSuperInStaticMembers2(target=esnext).1.normal.js new file mode 100644 index 000000000000..082532f1e97a --- /dev/null +++ b/crates/swc/tests/tsc-references/thisAndSuperInStaticMembers2(target=esnext).1.normal.js @@ -0,0 +1,96 @@ +//// [thisAndSuperInStaticMembers2.ts] +class C extends B { + static{ + this.x = undefined; + } + static{ + this.y1 = this.x; + } + static{ + this.y2 = this.x(); + } + static{ + this.y3 = this?.x(); + } + static{ + this.y4 = this["x"](); + } + static{ + this.y5 = this?.["x"](); + } + static{ + this.z1 = super.a; + } + static{ + this.z2 = super["a"]; + } + static{ + this.z3 = super.f(); + } + static{ + this.z4 = super["f"](); + } + static{ + this.z5 = super.a = 0; + } + static{ + this.z6 = super.a += 1; + } + static{ + this.z7 = (()=>{ + super.a = 0; + })(); + } + static{ + this.z8 = [super.a] = [ + 0 + ]; + } + static{ + this.z9 = [super.a = 0] = [ + 0 + ]; + } + static{ + this.z10 = [...super.a] = [ + 0 + ]; + } + static{ + this.z11 = { x: super.a } = { + x: 0 + }; + } + static{ + this.z12 = { x: super.a = 0 } = { + x: 0 + }; + } + static{ + this.z13 = { ...super.a } = { + x: 0 + }; + } + static{ + this.z14 = ++super.a; + } + static{ + this.z15 = --super.a; + } + static{ + this.z16 = ++super["a"]; + } + static{ + this.z17 = super.a++; + } + static{ + this.z18 = super.a``; + } + constructor(...args){ + super(...args); + // these should be unaffected + this.x = 1; + this.y = this.x; + this.z = super.f(); + } +} diff --git a/crates/swc/tests/tsc-references/thisAndSuperInStaticMembers2(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/thisAndSuperInStaticMembers2(target=esnext).2.minified.js new file mode 100644 index 000000000000..f56c72b9d6aa --- /dev/null +++ b/crates/swc/tests/tsc-references/thisAndSuperInStaticMembers2(target=esnext).2.minified.js @@ -0,0 +1,90 @@ +//// [thisAndSuperInStaticMembers2.ts] +class C extends B { + static{ + this.x = void 0; + } + static{ + this.y1 = this.x; + } + static{ + this.y2 = this.x(); + } + static{ + this.y3 = this?.x(); + } + static{ + this.y4 = this.x(); + } + static{ + this.y5 = this?.x(); + } + static{ + this.z1 = super.a; + } + static{ + this.z2 = super.a; + } + static{ + this.z3 = super.f(); + } + static{ + this.z4 = super.f(); + } + static{ + this.z5 = super.a = 0; + } + static{ + this.z6 = super.a += 1; + } + static{ + this.z7 = void (super.a = 0); + } + static{ + this.z8 = [super.a] = [ + 0 + ]; + } + static{ + this.z9 = [super.a = 0] = [ + 0 + ]; + } + static{ + this.z10 = [...super.a] = [ + 0 + ]; + } + static{ + this.z11 = { x: super.a } = { + x: 0 + }; + } + static{ + this.z12 = { x: super.a = 0 } = { + x: 0 + }; + } + static{ + this.z13 = { ...super.a } = { + x: 0 + }; + } + static{ + this.z14 = ++super.a; + } + static{ + this.z15 = --super.a; + } + static{ + this.z16 = ++super.a; + } + static{ + this.z17 = super.a++; + } + static{ + this.z18 = super.a``; + } + constructor(...args){ + super(...args), this.x = 1, this.y = this.x, this.z = super.f(); + } +} diff --git a/crates/swc/tests/tsc-references/typeOfThisInStaticMembers10(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/typeOfThisInStaticMembers10(target=esnext).1.normal.js new file mode 100644 index 000000000000..73c4480e1d09 --- /dev/null +++ b/crates/swc/tests/tsc-references/typeOfThisInStaticMembers10(target=esnext).1.normal.js @@ -0,0 +1,80 @@ +//// [typeOfThisInStaticMembers10.ts] +import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate"; +class C { + static{ + this.a = 1; + } + static{ + this.b = this.a + 1; + } +} +C = _ts_decorate([ + foo +], C); +class D extends C { + static{ + this.c = 2; + } + static{ + this.d = this.c + 1; + } + static{ + this.e = super.a + this.c + 1; + } + static{ + this.f = ()=>this.c + 1; + } + static{ + this.ff = function() { + this.c + 1; + }; + } + static foo() { + return this.c + 1; + } + static get fa() { + return this.c + 1; + } + static set fa(v) { + this.c = v + 1; + } +} +D = _ts_decorate([ + foo +], D); +class CC { + static{ + this.a = 1; + } + static{ + this.b = this.a + 1; + } +} +class DD extends CC { + static{ + this.c = 2; + } + static{ + this.d = this.c + 1; + } + static{ + this.e = super.a + this.c + 1; + } + static{ + this.f = ()=>this.c + 1; + } + static{ + this.ff = function() { + this.c + 1; + }; + } + static foo() { + return this.c + 1; + } + static get fa() { + return this.c + 1; + } + static set fa(v) { + this.c = v + 1; + } +} diff --git a/crates/swc/tests/tsc-references/typeOfThisInStaticMembers10(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/typeOfThisInStaticMembers10(target=esnext).2.minified.js new file mode 100644 index 000000000000..704545d184f2 --- /dev/null +++ b/crates/swc/tests/tsc-references/typeOfThisInStaticMembers10(target=esnext).2.minified.js @@ -0,0 +1,80 @@ +//// [typeOfThisInStaticMembers10.ts] +import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate"; +class C { + static{ + this.a = 1; + } + static{ + this.b = this.a + 1; + } +} +C = _ts_decorate([ + foo +], C); +class D extends C { + static{ + this.c = 2; + } + static{ + this.d = this.c + 1; + } + static{ + this.e = super.a + this.c + 1; + } + static{ + this.f = ()=>this.c + 1; + } + static{ + this.ff = function() { + this.c; + }; + } + static foo() { + return this.c + 1; + } + static get fa() { + return this.c + 1; + } + static set fa(v) { + this.c = v + 1; + } +} +D = _ts_decorate([ + foo +], D); +class CC { + static{ + this.a = 1; + } + static{ + this.b = this.a + 1; + } +} +class DD extends CC { + static{ + this.c = 2; + } + static{ + this.d = this.c + 1; + } + static{ + this.e = super.a + this.c + 1; + } + static{ + this.f = ()=>this.c + 1; + } + static{ + this.ff = function() { + this.c; + }; + } + static foo() { + return this.c + 1; + } + static get fa() { + return this.c + 1; + } + static set fa(v) { + this.c = v + 1; + } +} diff --git a/crates/swc/tests/tsc-references/typeOfThisInStaticMembers11(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/typeOfThisInStaticMembers11(target=esnext).1.normal.js new file mode 100644 index 000000000000..814b7b99ddd2 --- /dev/null +++ b/crates/swc/tests/tsc-references/typeOfThisInStaticMembers11(target=esnext).1.normal.js @@ -0,0 +1,52 @@ +//// [typeOfThisInStaticMembers11.ts] +import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate"; +class C { + static a = 1; + static b = this.a + 1; +} +C = _ts_decorate([ + foo +], C); +class D extends C { + static c = 2; + static d = this.c + 1; + static e = super.a + this.c + 1; + static f = ()=>this.c + 1; + static ff = function() { + this.c + 1; + }; + static foo() { + return this.c + 1; + } + static get fa() { + return this.c + 1; + } + static set fa(v) { + this.c = v + 1; + } +} +D = _ts_decorate([ + foo +], D); +class CC { + static a = 1; + static b = this.a + 1; +} +class DD extends CC { + static c = 2; + static d = this.c + 1; + static e = super.a + this.c + 1; + static f = ()=>this.c + 1; + static ff = function() { + this.c + 1; + }; + static foo() { + return this.c + 1; + } + static get fa() { + return this.c + 1; + } + static set fa(v) { + this.c = v + 1; + } +} diff --git a/crates/swc/tests/tsc-references/typeOfThisInStaticMembers11(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/typeOfThisInStaticMembers11(target=esnext).2.minified.js new file mode 100644 index 000000000000..744520a09fa5 --- /dev/null +++ b/crates/swc/tests/tsc-references/typeOfThisInStaticMembers11(target=esnext).2.minified.js @@ -0,0 +1,52 @@ +//// [typeOfThisInStaticMembers11.ts] +import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate"; +class C { + static a = 1; + static b = this.a + 1; +} +C = _ts_decorate([ + foo +], C); +class D extends C { + static c = 2; + static d = this.c + 1; + static e = super.a + this.c + 1; + static f = ()=>this.c + 1; + static ff = function() { + this.c; + }; + static foo() { + return this.c + 1; + } + static get fa() { + return this.c + 1; + } + static set fa(v) { + this.c = v + 1; + } +} +D = _ts_decorate([ + foo +], D); +class CC { + static a = 1; + static b = this.a + 1; +} +class DD extends CC { + static c = 2; + static d = this.c + 1; + static e = super.a + this.c + 1; + static f = ()=>this.c + 1; + static ff = function() { + this.c; + }; + static foo() { + return this.c + 1; + } + static get fa() { + return this.c + 1; + } + static set fa(v) { + this.c = v + 1; + } +} diff --git a/crates/swc/tests/tsc-references/typeOfThisInStaticMembers3(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/typeOfThisInStaticMembers3(target=esnext).1.normal.js new file mode 100644 index 000000000000..8648dda5fe42 --- /dev/null +++ b/crates/swc/tests/tsc-references/typeOfThisInStaticMembers3(target=esnext).1.normal.js @@ -0,0 +1,20 @@ +//// [typeOfThisInStaticMembers3.ts] +class C { + static{ + this.a = 1; + } + static{ + this.b = this.a + 1; + } +} +class D extends C { + static{ + this.c = 2; + } + static{ + this.d = this.c + 1; + } + static{ + this.e = super.a + this.c + 1; + } +} diff --git a/crates/swc/tests/tsc-references/typeOfThisInStaticMembers3(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/typeOfThisInStaticMembers3(target=esnext).2.minified.js new file mode 100644 index 000000000000..8648dda5fe42 --- /dev/null +++ b/crates/swc/tests/tsc-references/typeOfThisInStaticMembers3(target=esnext).2.minified.js @@ -0,0 +1,20 @@ +//// [typeOfThisInStaticMembers3.ts] +class C { + static{ + this.a = 1; + } + static{ + this.b = this.a + 1; + } +} +class D extends C { + static{ + this.c = 2; + } + static{ + this.d = this.c + 1; + } + static{ + this.e = super.a + this.c + 1; + } +} diff --git a/crates/swc/tests/tsc-references/typeOfThisInStaticMembers4(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/typeOfThisInStaticMembers4(target=esnext).1.normal.js new file mode 100644 index 000000000000..362079408846 --- /dev/null +++ b/crates/swc/tests/tsc-references/typeOfThisInStaticMembers4(target=esnext).1.normal.js @@ -0,0 +1,10 @@ +//// [typeOfThisInStaticMembers4.ts] +class C { + static a = 1; + static b = this.a + 1; +} +class D extends C { + static c = 2; + static d = this.c + 1; + static e = super.a + this.c + 1; +} diff --git a/crates/swc/tests/tsc-references/typeOfThisInStaticMembers4(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/typeOfThisInStaticMembers4(target=esnext).2.minified.js new file mode 100644 index 000000000000..362079408846 --- /dev/null +++ b/crates/swc/tests/tsc-references/typeOfThisInStaticMembers4(target=esnext).2.minified.js @@ -0,0 +1,10 @@ +//// [typeOfThisInStaticMembers4.ts] +class C { + static a = 1; + static b = this.a + 1; +} +class D extends C { + static c = 2; + static d = this.c + 1; + static e = super.a + this.c + 1; +} diff --git a/crates/swc/tests/tsc-references/typeOfThisInStaticMembers5(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/typeOfThisInStaticMembers5(target=esnext).1.normal.js new file mode 100644 index 000000000000..161522235a40 --- /dev/null +++ b/crates/swc/tests/tsc-references/typeOfThisInStaticMembers5(target=esnext).1.normal.js @@ -0,0 +1,9 @@ +//// [typeOfThisInStaticMembers5.ts] +class C { + static{ + this.create = ()=>new this("yep"); + } + constructor(foo){ + this.foo = foo; + } +} diff --git a/crates/swc/tests/tsc-references/typeOfThisInStaticMembers5(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/typeOfThisInStaticMembers5(target=esnext).2.minified.js new file mode 100644 index 000000000000..161522235a40 --- /dev/null +++ b/crates/swc/tests/tsc-references/typeOfThisInStaticMembers5(target=esnext).2.minified.js @@ -0,0 +1,9 @@ +//// [typeOfThisInStaticMembers5.ts] +class C { + static{ + this.create = ()=>new this("yep"); + } + constructor(foo){ + this.foo = foo; + } +} diff --git a/crates/swc/tests/tsc-references/typeOfThisInStaticMembers7(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/typeOfThisInStaticMembers7(target=esnext).1.normal.js new file mode 100644 index 000000000000..f9f8fd6f575d --- /dev/null +++ b/crates/swc/tests/tsc-references/typeOfThisInStaticMembers7(target=esnext).1.normal.js @@ -0,0 +1,20 @@ +//// [typeOfThisInStaticMembers7.ts] +class C { + static{ + this.a = 1; + } + static{ + this.b = this.a + 1; + } +} +class D extends C { + static{ + this.c = 2; + } + static{ + this.d = this.c + 1; + } + static{ + this.e = 1 + super.a + (this.c + 1) + 1; + } +} diff --git a/crates/swc/tests/tsc-references/typeOfThisInStaticMembers7(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/typeOfThisInStaticMembers7(target=esnext).2.minified.js new file mode 100644 index 000000000000..f9f8fd6f575d --- /dev/null +++ b/crates/swc/tests/tsc-references/typeOfThisInStaticMembers7(target=esnext).2.minified.js @@ -0,0 +1,20 @@ +//// [typeOfThisInStaticMembers7.ts] +class C { + static{ + this.a = 1; + } + static{ + this.b = this.a + 1; + } +} +class D extends C { + static{ + this.c = 2; + } + static{ + this.d = this.c + 1; + } + static{ + this.e = 1 + super.a + (this.c + 1) + 1; + } +} diff --git a/crates/swc/tests/tsc-references/typeOfThisInStaticMembers8(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/typeOfThisInStaticMembers8(target=esnext).1.normal.js new file mode 100644 index 000000000000..dd2d1d3096fb --- /dev/null +++ b/crates/swc/tests/tsc-references/typeOfThisInStaticMembers8(target=esnext).1.normal.js @@ -0,0 +1,36 @@ +//// [typeOfThisInStaticMembers8.ts] +class C { + static{ + this.f = 1; + } + static{ + this.arrowFunctionBoundary = ()=>this.f + 1; + } + static{ + this.functionExprBoundary = function() { + return this.f + 2; + }; + } + static{ + this.classExprBoundary = class { + constructor(){ + this.a = this.f + 3; + } + }; + } + static{ + this.functionAndClassDeclBoundary = (()=>{ + function foo() { + return this.f + 4; + } + class CC { + method() { + return this.f + 6; + } + constructor(){ + this.a = this.f + 5; + } + } + })(); + } +} diff --git a/crates/swc/tests/tsc-references/typeOfThisInStaticMembers8(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/typeOfThisInStaticMembers8(target=esnext).2.minified.js new file mode 100644 index 000000000000..5cccc6a3b677 --- /dev/null +++ b/crates/swc/tests/tsc-references/typeOfThisInStaticMembers8(target=esnext).2.minified.js @@ -0,0 +1,24 @@ +//// [typeOfThisInStaticMembers8.ts] +class C { + static{ + this.f = 1; + } + static{ + this.arrowFunctionBoundary = ()=>this.f + 1; + } + static{ + this.functionExprBoundary = function() { + return this.f + 2; + }; + } + static{ + this.classExprBoundary = class { + constructor(){ + this.a = this.f + 3; + } + }; + } + static{ + this.functionAndClassDeclBoundary = void 0; + } +} diff --git a/crates/swc/tests/tsc-references/typeOfThisInStaticMembers9(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/typeOfThisInStaticMembers9(target=esnext).1.normal.js new file mode 100644 index 000000000000..26532c041360 --- /dev/null +++ b/crates/swc/tests/tsc-references/typeOfThisInStaticMembers9(target=esnext).1.normal.js @@ -0,0 +1,38 @@ +//// [typeOfThisInStaticMembers9.ts] +class C { + static{ + this.f = 1; + } +} +class D extends C { + static{ + this.arrowFunctionBoundary = ()=>super.f + 1; + } + static{ + this.functionExprBoundary = function() { + return super.f + 2; + }; + } + static{ + this.classExprBoundary = class { + constructor(){ + this.a = super.f + 3; + } + }; + } + static{ + this.functionAndClassDeclBoundary = (()=>{ + function foo() { + return super.f + 4; + } + class C { + method() { + return super.f + 6; + } + constructor(){ + this.a = super.f + 5; + } + } + })(); + } +} diff --git a/crates/swc/tests/tsc-references/typeOfThisInStaticMembers9(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/typeOfThisInStaticMembers9(target=esnext).2.minified.js new file mode 100644 index 000000000000..9d7888da9637 --- /dev/null +++ b/crates/swc/tests/tsc-references/typeOfThisInStaticMembers9(target=esnext).2.minified.js @@ -0,0 +1,26 @@ +//// [typeOfThisInStaticMembers9.ts] +class C { + static{ + this.f = 1; + } +} +class D extends C { + static{ + this.arrowFunctionBoundary = ()=>super.f + 1; + } + static{ + this.functionExprBoundary = function() { + return super.f + 2; + }; + } + static{ + this.classExprBoundary = class { + constructor(){ + this.a = super.f + 3; + } + }; + } + static{ + this.functionAndClassDeclBoundary = void 0; + } +} diff --git a/crates/swc/tests/tsc-references/usingDeclarations.1(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarations.1(target=esnext).1.normal.js new file mode 100644 index 000000000000..37785332587a --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarations.1(target=esnext).1.normal.js @@ -0,0 +1,441 @@ +//// [usingDeclarations.1.ts] +import { _ as _dispose } from "@swc/helpers/_/_dispose"; +import { _ as _using } from "@swc/helpers/_/_using"; +function f() { + try { + var _stack = []; + var d2 = _using(_stack, { + [Symbol.dispose] () {} + }); + } catch (_) { + var _error = _; + var _hasError = true; + } finally{ + _dispose(_stack, _error, _hasError); + } +} +async function af() { + try { + var _stack = []; + var d3 = _using(_stack, { + [Symbol.dispose] () {} + }); + await null; + } catch (_) { + var _error = _; + var _hasError = true; + } finally{ + _dispose(_stack, _error, _hasError); + } +} +function* g() { + try { + var _stack = []; + var d4 = _using(_stack, { + [Symbol.dispose] () {} + }); + yield; + } catch (_) { + var _error = _; + var _hasError = true; + } finally{ + _dispose(_stack, _error, _hasError); + } +} +async function* ag() { + try { + var _stack = []; + var d5 = _using(_stack, { + [Symbol.dispose] () {} + }); + yield; + await null; + } catch (_) { + var _error = _; + var _hasError = true; + } finally{ + _dispose(_stack, _error, _hasError); + } +} +try { + var _stack = []; + var d1 = _using(_stack, { + [Symbol.dispose] () {} + }); + var a = ()=>{ + try { + var _stack = []; + var d6 = _using(_stack, { + [Symbol.dispose] () {} + }); + } catch (_) { + var _error = _; + var _hasError = true; + } finally{ + _dispose(_stack, _error, _hasError); + } + }; + class C1 { + constructor(){ + this.a = ()=>{ + try { + var _stack = []; + var d7 = _using(_stack, { + [Symbol.dispose] () {} + }); + } catch (_) { + var _error = _; + var _hasError = true; + } finally{ + _dispose(_stack, _error, _hasError); + } + }; + try { + var _stack = []; + var d8 = _using(_stack, { + [Symbol.dispose] () {} + }); + } catch (_) { + var _error = _; + var _hasError = true; + } finally{ + _dispose(_stack, _error, _hasError); + } + } + static{ + try { + var _stack = []; + var d9 = _using(_stack, { + [Symbol.dispose] () {} + }); + } catch (_) { + var _error = _; + var _hasError = true; + } finally{ + _dispose(_stack, _error, _hasError); + } + } + m() { + try { + var _stack = []; + var d10 = _using(_stack, { + [Symbol.dispose] () {} + }); + } catch (_) { + var _error = _; + var _hasError = true; + } finally{ + _dispose(_stack, _error, _hasError); + } + } + get x() { + try { + var _stack = []; + var d11 = _using(_stack, { + [Symbol.dispose] () {} + }); + return 0; + } catch (_) { + var _error = _; + var _hasError = true; + } finally{ + _dispose(_stack, _error, _hasError); + } + } + set x(v) { + try { + var _stack = []; + var d12 = _using(_stack, { + [Symbol.dispose] () {} + }); + } catch (_) { + var _error = _; + var _hasError = true; + } finally{ + _dispose(_stack, _error, _hasError); + } + } + async am() { + try { + var _stack = []; + var d13 = _using(_stack, { + [Symbol.dispose] () {} + }); + await null; + } catch (_) { + var _error = _; + var _hasError = true; + } finally{ + _dispose(_stack, _error, _hasError); + } + } + *g() { + try { + var _stack = []; + var d14 = _using(_stack, { + [Symbol.dispose] () {} + }); + yield; + } catch (_) { + var _error = _; + var _hasError = true; + } finally{ + _dispose(_stack, _error, _hasError); + } + } + async *ag() { + try { + var _stack = []; + var d15 = _using(_stack, { + [Symbol.dispose] () {} + }); + yield; + await null; + } catch (_) { + var _error = _; + var _hasError = true; + } finally{ + _dispose(_stack, _error, _hasError); + } + } + } + class C2 extends C1 { + constructor(){ + try { + var _stack = []; + var d16 = _using(_stack, { + [Symbol.dispose] () {} + }); + super(); + } catch (_) { + var _error = _; + var _hasError = true; + } finally{ + _dispose(_stack, _error, _hasError); + } + } + } + class C3 extends C1 { + constructor(){ + try { + var _stack = []; + var d17 = _using(_stack, { + [Symbol.dispose] () {} + }); + super(); + this.y = 1; + } catch (_) { + var _error = _; + var _hasError = true; + } finally{ + _dispose(_stack, _error, _hasError); + } + } + } + var N; + (function(N) { + try { + var _stack = []; + var d18 = _using(_stack, { + [Symbol.dispose] () {} + }); + } catch (_) { + var _error = _; + var _hasError = true; + } finally{ + _dispose(_stack, _error, _hasError); + } + })(N || (N = {})); + { + try { + var _stack1 = []; + var d19 = _using(_stack1, { + [Symbol.dispose] () {} + }); + } catch (_) { + var _error = _; + var _hasError = true; + } finally{ + _dispose(_stack1, _error, _hasError); + } + } + switch(Math.random()){ + case 0: + try { + var _stack2 = []; + var d20 = _using(_stack2, { + [Symbol.dispose] () {} + }); + break; + } catch (_) { + var _error1 = _; + var _hasError1 = true; + } finally{ + _dispose(_stack2, _error1, _hasError1); + } + case 1: + try { + var _stack3 = []; + var d21 = _using(_stack3, { + [Symbol.dispose] () {} + }); + break; + } catch (_) { + var _error2 = _; + var _hasError2 = true; + } finally{ + _dispose(_stack3, _error2, _hasError2); + } + } + if (true) switch(0){ + case 0: + try { + var _stack4 = []; + var d22 = _using(_stack4, { + [Symbol.dispose] () {} + }); + break; + } catch (_) { + var _error3 = _; + var _hasError3 = true; + } finally{ + _dispose(_stack4, _error3, _hasError3); + } + } + try { + try { + var _stack5 = []; + var d23 = _using(_stack5, { + [Symbol.dispose] () {} + }); + } catch (_) { + var _error4 = _; + var _hasError4 = true; + } finally{ + _dispose(_stack5, _error4, _hasError4); + } + } catch { + try { + var _stack6 = []; + var d24 = _using(_stack6, { + [Symbol.dispose] () {} + }); + } catch (_) { + var _error5 = _; + var _hasError5 = true; + } finally{ + _dispose(_stack6, _error5, _hasError5); + } + } finally{ + try { + var _stack7 = []; + var d25 = _using(_stack7, { + [Symbol.dispose] () {} + }); + } catch (_) { + var _error6 = _; + var _hasError6 = true; + } finally{ + _dispose(_stack7, _error6, _hasError6); + } + } + if (true) { + try { + var _stack8 = []; + var d26 = _using(_stack8, { + [Symbol.dispose] () {} + }); + } catch (_) { + var _error7 = _; + var _hasError7 = true; + } finally{ + _dispose(_stack8, _error7, _hasError7); + } + } else { + try { + var _stack9 = []; + var d27 = _using(_stack9, { + [Symbol.dispose] () {} + }); + } catch (_) { + var _error8 = _; + var _hasError8 = true; + } finally{ + _dispose(_stack9, _error8, _hasError8); + } + } + while(true){ + try { + var _stack10 = []; + var d28 = _using(_stack10, { + [Symbol.dispose] () {} + }); + break; + } catch (_) { + var _error9 = _; + var _hasError9 = true; + } finally{ + _dispose(_stack10, _error9, _hasError9); + } + } + do { + try { + var _stack11 = []; + var d29 = _using(_stack11, { + [Symbol.dispose] () {} + }); + break; + } catch (_) { + var _error10 = _; + var _hasError10 = true; + } finally{ + _dispose(_stack11, _error10, _hasError10); + } + }while (true) + for(;;){ + try { + var _stack12 = []; + var d30 = _using(_stack12, { + [Symbol.dispose] () {} + }); + break; + } catch (_) { + var _error11 = _; + var _hasError11 = true; + } finally{ + _dispose(_stack12, _error11, _hasError11); + } + } + for(const x in {}){ + try { + var _stack13 = []; + var d31 = _using(_stack13, { + [Symbol.dispose] () {} + }); + } catch (_) { + var _error12 = _; + var _hasError12 = true; + } finally{ + _dispose(_stack13, _error12, _hasError12); + } + } + for (const x of []){ + try { + var _stack14 = []; + var d32 = _using(_stack14, { + [Symbol.dispose] () {} + }); + } catch (_) { + var _error13 = _; + var _hasError13 = true; + } finally{ + _dispose(_stack14, _error13, _hasError13); + } + } +} catch (_) { + var _error14 = _; + var _hasError14 = true; +} finally{ + _dispose(_stack, _error14, _hasError14); +} +export { }; diff --git a/crates/swc/tests/tsc-references/usingDeclarations.1(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarations.1(target=esnext).2.minified.js new file mode 100644 index 000000000000..5d654f5f2e97 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarations.1(target=esnext).2.minified.js @@ -0,0 +1,277 @@ +//// [usingDeclarations.1.ts] +import { _ as _dispose } from "@swc/helpers/_/_dispose"; +import { _ as _using } from "@swc/helpers/_/_using"; +try { + var N, _stack = []; + _using(_stack, { + [Symbol.dispose] () {} + }); + class C1 { + constructor(){ + this.a = ()=>{ + try { + var _stack = []; + _using(_stack, { + [Symbol.dispose] () {} + }); + } catch (_) { + var _error = _, _hasError = !0; + } finally{ + _dispose(_stack, _error, _hasError); + } + }; + try { + var _stack = []; + _using(_stack, { + [Symbol.dispose] () {} + }); + } catch (_) { + var _error = _, _hasError = !0; + } finally{ + _dispose(_stack, _error, _hasError); + } + } + static{ + try { + var _stack = []; + _using(_stack, { + [Symbol.dispose] () {} + }); + } catch (_) { + var _error = _, _hasError = !0; + } finally{ + _dispose(_stack, _error, _hasError); + } + } + m() { + try { + var _stack = []; + _using(_stack, { + [Symbol.dispose] () {} + }); + } catch (_) { + var _error = _, _hasError = !0; + } finally{ + _dispose(_stack, _error, _hasError); + } + } + get x() { + try { + var _stack = []; + return _using(_stack, { + [Symbol.dispose] () {} + }), 0; + } catch (_) { + var _error = _, _hasError = !0; + } finally{ + _dispose(_stack, _error, _hasError); + } + } + set x(v) { + try { + var _stack = []; + _using(_stack, { + [Symbol.dispose] () {} + }); + } catch (_) { + var _error = _, _hasError = !0; + } finally{ + _dispose(_stack, _error, _hasError); + } + } + async am() { + try { + var _stack = []; + _using(_stack, { + [Symbol.dispose] () {} + }), await null; + } catch (_) { + var _error = _, _hasError = !0; + } finally{ + _dispose(_stack, _error, _hasError); + } + } + *g() { + try { + var _stack = []; + _using(_stack, { + [Symbol.dispose] () {} + }), yield; + } catch (_) { + var _error = _, _hasError = !0; + } finally{ + _dispose(_stack, _error, _hasError); + } + } + async *ag() { + try { + var _stack = []; + _using(_stack, { + [Symbol.dispose] () {} + }), yield, await null; + } catch (_) { + var _error = _, _hasError = !0; + } finally{ + _dispose(_stack, _error, _hasError); + } + } + } + !function(N) { + try { + var _stack = []; + _using(_stack, { + [Symbol.dispose] () {} + }); + } catch (_) { + var _error = _, _hasError = !0; + } finally{ + _dispose(_stack, _error, _hasError); + } + }(N || (N = {})); + try { + var _stack1 = []; + _using(_stack1, { + [Symbol.dispose] () {} + }); + } catch (_) { + var _error = _, _hasError = !0; + } finally{ + _dispose(_stack1, _error, _hasError); + } + switch(Math.random()){ + case 0: + try { + var _stack2 = []; + _using(_stack2, { + [Symbol.dispose] () {} + }); + break; + } catch (_) { + var _error1 = _, _hasError1 = !0; + } finally{ + _dispose(_stack2, _error1, _hasError1); + } + case 1: + try { + var _stack3 = []; + _using(_stack3, { + [Symbol.dispose] () {} + }); + } catch (_) { + var _error2 = _, _hasError2 = !0; + } finally{ + _dispose(_stack3, _error2, _hasError2); + } + } + try { + var _stack4 = []; + _using(_stack4, { + [Symbol.dispose] () {} + }); + } catch (_) { + var _error3 = _, _hasError3 = !0; + } finally{ + _dispose(_stack4, _error3, _hasError3); + } + try { + try { + var _stack5 = []; + _using(_stack5, { + [Symbol.dispose] () {} + }); + } catch (_) { + var _error4 = _, _hasError4 = !0; + } finally{ + _dispose(_stack5, _error4, _hasError4); + } + } catch { + try { + var _stack6 = []; + _using(_stack6, { + [Symbol.dispose] () {} + }); + } catch (_) { + var _error5 = _, _hasError5 = !0; + } finally{ + _dispose(_stack6, _error5, _hasError5); + } + } finally{ + try { + var _stack7 = []; + _using(_stack7, { + [Symbol.dispose] () {} + }); + } catch (_) { + var _error6 = _, _hasError6 = !0; + } finally{ + _dispose(_stack7, _error6, _hasError6); + } + } + try { + var _stack8 = []; + _using(_stack8, { + [Symbol.dispose] () {} + }); + } catch (_) { + var _error7 = _, _hasError7 = !0; + } finally{ + _dispose(_stack8, _error7, _hasError7); + } + for(;;)try { + var _stack10 = []; + _using(_stack10, { + [Symbol.dispose] () {} + }); + break; + } catch (_) { + var _error9 = _, _hasError9 = !0; + } finally{ + _dispose(_stack10, _error9, _hasError9); + } + for(;;)try { + var _stack11 = []; + _using(_stack11, { + [Symbol.dispose] () {} + }); + break; + } catch (_) { + var _error10 = _, _hasError10 = !0; + } finally{ + _dispose(_stack11, _error10, _hasError10); + } + for(;;)try { + var _stack12 = []; + _using(_stack12, { + [Symbol.dispose] () {} + }); + break; + } catch (_) { + var _error11 = _, _hasError11 = !0; + } finally{ + _dispose(_stack12, _error11, _hasError11); + } + for(let x in {})try { + var _stack13 = []; + _using(_stack13, { + [Symbol.dispose] () {} + }); + } catch (_) { + var _error12 = _, _hasError12 = !0; + } finally{ + _dispose(_stack13, _error12, _hasError12); + } + for (let x of [])try { + var _stack14 = []; + _using(_stack14, { + [Symbol.dispose] () {} + }); + } catch (_) { + var _error13 = _, _hasError13 = !0; + } finally{ + _dispose(_stack14, _error13, _hasError13); + } +} catch (_) { + var _error14 = _, _hasError14 = !0; +} finally{ + _dispose(_stack, _error14, _hasError14); +} diff --git a/crates/swc/tests/tsc-references/usingDeclarations.2(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarations.2(target=esnext).1.normal.js new file mode 100644 index 000000000000..72957d777f17 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarations.2(target=esnext).1.normal.js @@ -0,0 +1,18 @@ +//// [usingDeclarations.2.ts] +import { _ as _dispose } from "@swc/helpers/_/_dispose"; +import { _ as _using } from "@swc/helpers/_/_using"; +{ + try { + var _stack = []; + var d1 = _using(_stack, { + [Symbol.dispose] () {} + }), d2 = _using(_stack, { + [Symbol.dispose] () {} + }); + } catch (_) { + var _error = _; + var _hasError = true; + } finally{ + _dispose(_stack, _error, _hasError); + } +} diff --git a/crates/swc/tests/tsc-references/usingDeclarations.2(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarations.2(target=esnext).2.minified.js new file mode 100644 index 000000000000..bea0f731245e --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarations.2(target=esnext).2.minified.js @@ -0,0 +1,15 @@ +//// [usingDeclarations.2.ts] +import { _ as _dispose } from "@swc/helpers/_/_dispose"; +import { _ as _using } from "@swc/helpers/_/_using"; +try { + var _stack = []; + _using(_stack, { + [Symbol.dispose] () {} + }), _using(_stack, { + [Symbol.dispose] () {} + }); +} catch (_) { + var _error = _, _hasError = !0; +} finally{ + _dispose(_stack, _error, _hasError); +} diff --git a/crates/swc/tests/tsc-references/usingDeclarations.3(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarations.3(target=esnext).1.normal.js new file mode 100644 index 000000000000..774e56f6bc0d --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarations.3(target=esnext).1.normal.js @@ -0,0 +1,18 @@ +//// [usingDeclarations.3.ts] +import { _ as _dispose } from "@swc/helpers/_/_dispose"; +import { _ as _using } from "@swc/helpers/_/_using"; +{ + try { + var _stack = []; + var d1 = _using(_stack, { + [Symbol.dispose] () {} + }), d2 = _using(_stack, null), d3 = _using(_stack, undefined), d4 = _using(_stack, { + [Symbol.dispose] () {} + }); + } catch (_) { + var _error = _; + var _hasError = true; + } finally{ + _dispose(_stack, _error, _hasError); + } +} diff --git a/crates/swc/tests/tsc-references/usingDeclarations.3(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarations.3(target=esnext).2.minified.js new file mode 100644 index 000000000000..7f1c4a10bf9e --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarations.3(target=esnext).2.minified.js @@ -0,0 +1,15 @@ +//// [usingDeclarations.3.ts] +import { _ as _dispose } from "@swc/helpers/_/_dispose"; +import { _ as _using } from "@swc/helpers/_/_using"; +try { + var _stack = []; + _using(_stack, { + [Symbol.dispose] () {} + }), _using(_stack, null), _using(_stack, void 0), _using(_stack, { + [Symbol.dispose] () {} + }); +} catch (_) { + var _error = _, _hasError = !0; +} finally{ + _dispose(_stack, _error, _hasError); +} diff --git a/crates/swc/tests/tsc-references/usingDeclarationsInFor(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsInFor(target=esnext).1.normal.js new file mode 100644 index 000000000000..df4a33cf79ac --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsInFor(target=esnext).1.normal.js @@ -0,0 +1,9 @@ +//// [usingDeclarationsInFor.ts] +//! +//! x Expected ';', got 'd1' +//! ,-[1:1] +//! 1 | +//! 2 | for (using d1 = { [Symbol.dispose]() {} }, d2 = null, d3 = undefined;;) { +//! : ^^ +//! 3 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsInFor(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsInFor(target=esnext).2.minified.js new file mode 100644 index 000000000000..df4a33cf79ac --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsInFor(target=esnext).2.minified.js @@ -0,0 +1,9 @@ +//// [usingDeclarationsInFor.ts] +//! +//! x Expected ';', got 'd1' +//! ,-[1:1] +//! 1 | +//! 2 | for (using d1 = { [Symbol.dispose]() {} }, d2 = null, d3 = undefined;;) { +//! : ^^ +//! 3 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsInForAwaitOf(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsInForAwaitOf(target=esnext).1.normal.js new file mode 100644 index 000000000000..f84db7340602 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsInForAwaitOf(target=esnext).1.normal.js @@ -0,0 +1,21 @@ +//// [usingDeclarationsInForAwaitOf.ts] +import { _ as _dispose } from "@swc/helpers/_/_dispose"; +async function main() { + for await (const d1 of [ + { + [Symbol.dispose] () {} + }, + null, + undefined + ]){ + try { + var _stack = []; + {} + } catch (_) { + var _error = _; + var _hasError = true; + } finally{ + _dispose(_stack, _error, _hasError); + } + } +} diff --git a/crates/swc/tests/tsc-references/usingDeclarationsInForAwaitOf(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsInForAwaitOf(target=esnext).2.minified.js new file mode 100644 index 000000000000..ec22de7422b7 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsInForAwaitOf(target=esnext).2.minified.js @@ -0,0 +1,2 @@ +//// [usingDeclarationsInForAwaitOf.ts] +import "@swc/helpers/_/_dispose"; diff --git a/crates/swc/tests/tsc-references/usingDeclarationsInForOf.1(target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsInForOf.1(target=esnext).1.normal.js new file mode 100644 index 000000000000..7cf6dff0cf89 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsInForOf.1(target=esnext).1.normal.js @@ -0,0 +1,19 @@ +//// [usingDeclarationsInForOf.1.ts] +import { _ as _dispose } from "@swc/helpers/_/_dispose"; +for (const d1 of [ + { + [Symbol.dispose] () {} + }, + null, + undefined +]){ + try { + var _stack = []; + {} + } catch (_) { + var _error = _; + var _hasError = true; + } finally{ + _dispose(_stack, _error, _hasError); + } +} diff --git a/crates/swc/tests/tsc-references/usingDeclarationsInForOf.1(target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsInForOf.1(target=esnext).2.minified.js new file mode 100644 index 000000000000..ba9595c1ab7b --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsInForOf.1(target=esnext).2.minified.js @@ -0,0 +1,15 @@ +//// [usingDeclarationsInForOf.1.ts] +import { _ as _dispose } from "@swc/helpers/_/_dispose"; +for (let d1 of [ + { + [Symbol.dispose] () {} + }, + null, + void 0 +])try { + var _stack = []; +} catch (_) { + var _error = _, _hasError = !0; +} finally{ + _dispose(_stack, _error, _hasError); +} diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.1(module=commonjs,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.1(module=commonjs,target=esnext).1.normal.js new file mode 100644 index 000000000000..5b2004dd5b07 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.1(module=commonjs,target=esnext).1.normal.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.1.ts] +//! +//! x Expression expected +//! ,-[4:1] +//! 4 | +//! 5 | using before = null; +//! 6 | +//! 7 | @dec +//! : ^ +//! 8 | class C { +//! 9 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.1(module=commonjs,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.1(module=commonjs,target=esnext).2.minified.js new file mode 100644 index 000000000000..5b2004dd5b07 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.1(module=commonjs,target=esnext).2.minified.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.1.ts] +//! +//! x Expression expected +//! ,-[4:1] +//! 4 | +//! 5 | using before = null; +//! 6 | +//! 7 | @dec +//! : ^ +//! 8 | class C { +//! 9 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.1(module=es6,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.1(module=es6,target=esnext).1.normal.js new file mode 100644 index 000000000000..5b2004dd5b07 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.1(module=es6,target=esnext).1.normal.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.1.ts] +//! +//! x Expression expected +//! ,-[4:1] +//! 4 | +//! 5 | using before = null; +//! 6 | +//! 7 | @dec +//! : ^ +//! 8 | class C { +//! 9 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.1(module=es6,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.1(module=es6,target=esnext).2.minified.js new file mode 100644 index 000000000000..5b2004dd5b07 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.1(module=es6,target=esnext).2.minified.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.1.ts] +//! +//! x Expression expected +//! ,-[4:1] +//! 4 | +//! 5 | using before = null; +//! 6 | +//! 7 | @dec +//! : ^ +//! 8 | class C { +//! 9 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.1(module=system,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.1(module=system,target=esnext).1.normal.js new file mode 100644 index 000000000000..5b2004dd5b07 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.1(module=system,target=esnext).1.normal.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.1.ts] +//! +//! x Expression expected +//! ,-[4:1] +//! 4 | +//! 5 | using before = null; +//! 6 | +//! 7 | @dec +//! : ^ +//! 8 | class C { +//! 9 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.1(module=system,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.1(module=system,target=esnext).2.minified.js new file mode 100644 index 000000000000..5b2004dd5b07 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.1(module=system,target=esnext).2.minified.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.1.ts] +//! +//! x Expression expected +//! ,-[4:1] +//! 4 | +//! 5 | using before = null; +//! 6 | +//! 7 | @dec +//! : ^ +//! 8 | class C { +//! 9 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.10(module=commonjs,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.10(module=commonjs,target=esnext).1.normal.js new file mode 100644 index 000000000000..b3089822f351 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.10(module=commonjs,target=esnext).1.normal.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.10.ts] +//! +//! x Expression expected +//! ,-[2:1] +//! 2 | +//! 3 | declare var dec: any; +//! 4 | +//! 5 | @dec +//! : ^ +//! 6 | export default class { +//! 7 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.10(module=commonjs,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.10(module=commonjs,target=esnext).2.minified.js new file mode 100644 index 000000000000..b3089822f351 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.10(module=commonjs,target=esnext).2.minified.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.10.ts] +//! +//! x Expression expected +//! ,-[2:1] +//! 2 | +//! 3 | declare var dec: any; +//! 4 | +//! 5 | @dec +//! : ^ +//! 6 | export default class { +//! 7 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.10(module=es6,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.10(module=es6,target=esnext).1.normal.js new file mode 100644 index 000000000000..b3089822f351 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.10(module=es6,target=esnext).1.normal.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.10.ts] +//! +//! x Expression expected +//! ,-[2:1] +//! 2 | +//! 3 | declare var dec: any; +//! 4 | +//! 5 | @dec +//! : ^ +//! 6 | export default class { +//! 7 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.10(module=es6,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.10(module=es6,target=esnext).2.minified.js new file mode 100644 index 000000000000..b3089822f351 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.10(module=es6,target=esnext).2.minified.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.10.ts] +//! +//! x Expression expected +//! ,-[2:1] +//! 2 | +//! 3 | declare var dec: any; +//! 4 | +//! 5 | @dec +//! : ^ +//! 6 | export default class { +//! 7 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.10(module=system,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.10(module=system,target=esnext).1.normal.js new file mode 100644 index 000000000000..b3089822f351 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.10(module=system,target=esnext).1.normal.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.10.ts] +//! +//! x Expression expected +//! ,-[2:1] +//! 2 | +//! 3 | declare var dec: any; +//! 4 | +//! 5 | @dec +//! : ^ +//! 6 | export default class { +//! 7 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.10(module=system,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.10(module=system,target=esnext).2.minified.js new file mode 100644 index 000000000000..b3089822f351 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.10(module=system,target=esnext).2.minified.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.10.ts] +//! +//! x Expression expected +//! ,-[2:1] +//! 2 | +//! 3 | declare var dec: any; +//! 4 | +//! 5 | @dec +//! : ^ +//! 6 | export default class { +//! 7 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.11(module=commonjs,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.11(module=commonjs,target=esnext).1.normal.js new file mode 100644 index 000000000000..5e3ca3ac14dc --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.11(module=commonjs,target=esnext).1.normal.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.11.ts] +//! +//! x Expression expected +//! ,-[2:1] +//! 2 | +//! 3 | declare var dec: any; +//! 4 | +//! 5 | @dec +//! : ^ +//! 6 | class C { +//! 7 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.11(module=commonjs,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.11(module=commonjs,target=esnext).2.minified.js new file mode 100644 index 000000000000..5e3ca3ac14dc --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.11(module=commonjs,target=esnext).2.minified.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.11.ts] +//! +//! x Expression expected +//! ,-[2:1] +//! 2 | +//! 3 | declare var dec: any; +//! 4 | +//! 5 | @dec +//! : ^ +//! 6 | class C { +//! 7 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.11(module=es6,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.11(module=es6,target=esnext).1.normal.js new file mode 100644 index 000000000000..5e3ca3ac14dc --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.11(module=es6,target=esnext).1.normal.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.11.ts] +//! +//! x Expression expected +//! ,-[2:1] +//! 2 | +//! 3 | declare var dec: any; +//! 4 | +//! 5 | @dec +//! : ^ +//! 6 | class C { +//! 7 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.11(module=es6,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.11(module=es6,target=esnext).2.minified.js new file mode 100644 index 000000000000..5e3ca3ac14dc --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.11(module=es6,target=esnext).2.minified.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.11.ts] +//! +//! x Expression expected +//! ,-[2:1] +//! 2 | +//! 3 | declare var dec: any; +//! 4 | +//! 5 | @dec +//! : ^ +//! 6 | class C { +//! 7 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.11(module=system,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.11(module=system,target=esnext).1.normal.js new file mode 100644 index 000000000000..5e3ca3ac14dc --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.11(module=system,target=esnext).1.normal.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.11.ts] +//! +//! x Expression expected +//! ,-[2:1] +//! 2 | +//! 3 | declare var dec: any; +//! 4 | +//! 5 | @dec +//! : ^ +//! 6 | class C { +//! 7 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.11(module=system,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.11(module=system,target=esnext).2.minified.js new file mode 100644 index 000000000000..5e3ca3ac14dc --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.11(module=system,target=esnext).2.minified.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.11.ts] +//! +//! x Expression expected +//! ,-[2:1] +//! 2 | +//! 3 | declare var dec: any; +//! 4 | +//! 5 | @dec +//! : ^ +//! 6 | class C { +//! 7 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.12(module=commonjs,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.12(module=commonjs,target=esnext).1.normal.js new file mode 100644 index 000000000000..b2a0dd15f763 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.12(module=commonjs,target=esnext).1.normal.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.12.ts] +//! +//! x Expression expected +//! ,-[2:1] +//! 2 | +//! 3 | declare var dec: any; +//! 4 | +//! 5 | @dec +//! : ^ +//! 6 | class C { +//! 7 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.12(module=commonjs,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.12(module=commonjs,target=esnext).2.minified.js new file mode 100644 index 000000000000..b2a0dd15f763 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.12(module=commonjs,target=esnext).2.minified.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.12.ts] +//! +//! x Expression expected +//! ,-[2:1] +//! 2 | +//! 3 | declare var dec: any; +//! 4 | +//! 5 | @dec +//! : ^ +//! 6 | class C { +//! 7 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.12(module=es6,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.12(module=es6,target=esnext).1.normal.js new file mode 100644 index 000000000000..b2a0dd15f763 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.12(module=es6,target=esnext).1.normal.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.12.ts] +//! +//! x Expression expected +//! ,-[2:1] +//! 2 | +//! 3 | declare var dec: any; +//! 4 | +//! 5 | @dec +//! : ^ +//! 6 | class C { +//! 7 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.12(module=es6,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.12(module=es6,target=esnext).2.minified.js new file mode 100644 index 000000000000..b2a0dd15f763 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.12(module=es6,target=esnext).2.minified.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.12.ts] +//! +//! x Expression expected +//! ,-[2:1] +//! 2 | +//! 3 | declare var dec: any; +//! 4 | +//! 5 | @dec +//! : ^ +//! 6 | class C { +//! 7 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.12(module=system,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.12(module=system,target=esnext).1.normal.js new file mode 100644 index 000000000000..b2a0dd15f763 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.12(module=system,target=esnext).1.normal.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.12.ts] +//! +//! x Expression expected +//! ,-[2:1] +//! 2 | +//! 3 | declare var dec: any; +//! 4 | +//! 5 | @dec +//! : ^ +//! 6 | class C { +//! 7 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.12(module=system,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.12(module=system,target=esnext).2.minified.js new file mode 100644 index 000000000000..b2a0dd15f763 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.12(module=system,target=esnext).2.minified.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.12.ts] +//! +//! x Expression expected +//! ,-[2:1] +//! 2 | +//! 3 | declare var dec: any; +//! 4 | +//! 5 | @dec +//! : ^ +//! 6 | class C { +//! 7 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.2(module=commonjs,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.2(module=commonjs,target=esnext).1.normal.js new file mode 100644 index 000000000000..ac89319a3259 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.2(module=commonjs,target=esnext).1.normal.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.2.ts] +//! +//! x Expression expected +//! ,-[4:1] +//! 4 | +//! 5 | using before = null; +//! 6 | +//! 7 | @dec +//! : ^ +//! 8 | export class C { +//! 9 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.2(module=commonjs,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.2(module=commonjs,target=esnext).2.minified.js new file mode 100644 index 000000000000..ac89319a3259 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.2(module=commonjs,target=esnext).2.minified.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.2.ts] +//! +//! x Expression expected +//! ,-[4:1] +//! 4 | +//! 5 | using before = null; +//! 6 | +//! 7 | @dec +//! : ^ +//! 8 | export class C { +//! 9 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.2(module=es6,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.2(module=es6,target=esnext).1.normal.js new file mode 100644 index 000000000000..ac89319a3259 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.2(module=es6,target=esnext).1.normal.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.2.ts] +//! +//! x Expression expected +//! ,-[4:1] +//! 4 | +//! 5 | using before = null; +//! 6 | +//! 7 | @dec +//! : ^ +//! 8 | export class C { +//! 9 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.2(module=es6,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.2(module=es6,target=esnext).2.minified.js new file mode 100644 index 000000000000..ac89319a3259 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.2(module=es6,target=esnext).2.minified.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.2.ts] +//! +//! x Expression expected +//! ,-[4:1] +//! 4 | +//! 5 | using before = null; +//! 6 | +//! 7 | @dec +//! : ^ +//! 8 | export class C { +//! 9 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.2(module=system,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.2(module=system,target=esnext).1.normal.js new file mode 100644 index 000000000000..ac89319a3259 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.2(module=system,target=esnext).1.normal.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.2.ts] +//! +//! x Expression expected +//! ,-[4:1] +//! 4 | +//! 5 | using before = null; +//! 6 | +//! 7 | @dec +//! : ^ +//! 8 | export class C { +//! 9 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.2(module=system,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.2(module=system,target=esnext).2.minified.js new file mode 100644 index 000000000000..ac89319a3259 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.2(module=system,target=esnext).2.minified.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.2.ts] +//! +//! x Expression expected +//! ,-[4:1] +//! 4 | +//! 5 | using before = null; +//! 6 | +//! 7 | @dec +//! : ^ +//! 8 | export class C { +//! 9 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.3(module=commonjs,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.3(module=commonjs,target=esnext).1.normal.js new file mode 100644 index 000000000000..14463a5bcaa5 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.3(module=commonjs,target=esnext).1.normal.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.3.ts] +//! +//! x Expression expected +//! ,-[4:1] +//! 4 | +//! 5 | using before = null; +//! 6 | +//! 7 | @dec +//! : ^ +//! 8 | export default class C { +//! 9 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.3(module=commonjs,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.3(module=commonjs,target=esnext).2.minified.js new file mode 100644 index 000000000000..14463a5bcaa5 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.3(module=commonjs,target=esnext).2.minified.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.3.ts] +//! +//! x Expression expected +//! ,-[4:1] +//! 4 | +//! 5 | using before = null; +//! 6 | +//! 7 | @dec +//! : ^ +//! 8 | export default class C { +//! 9 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.3(module=es6,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.3(module=es6,target=esnext).1.normal.js new file mode 100644 index 000000000000..14463a5bcaa5 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.3(module=es6,target=esnext).1.normal.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.3.ts] +//! +//! x Expression expected +//! ,-[4:1] +//! 4 | +//! 5 | using before = null; +//! 6 | +//! 7 | @dec +//! : ^ +//! 8 | export default class C { +//! 9 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.3(module=es6,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.3(module=es6,target=esnext).2.minified.js new file mode 100644 index 000000000000..14463a5bcaa5 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.3(module=es6,target=esnext).2.minified.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.3.ts] +//! +//! x Expression expected +//! ,-[4:1] +//! 4 | +//! 5 | using before = null; +//! 6 | +//! 7 | @dec +//! : ^ +//! 8 | export default class C { +//! 9 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.3(module=system,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.3(module=system,target=esnext).1.normal.js new file mode 100644 index 000000000000..14463a5bcaa5 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.3(module=system,target=esnext).1.normal.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.3.ts] +//! +//! x Expression expected +//! ,-[4:1] +//! 4 | +//! 5 | using before = null; +//! 6 | +//! 7 | @dec +//! : ^ +//! 8 | export default class C { +//! 9 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.3(module=system,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.3(module=system,target=esnext).2.minified.js new file mode 100644 index 000000000000..14463a5bcaa5 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.3(module=system,target=esnext).2.minified.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.3.ts] +//! +//! x Expression expected +//! ,-[4:1] +//! 4 | +//! 5 | using before = null; +//! 6 | +//! 7 | @dec +//! : ^ +//! 8 | export default class C { +//! 9 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.4(module=commonjs,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.4(module=commonjs,target=esnext).1.normal.js new file mode 100644 index 000000000000..a34dd211936c --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.4(module=commonjs,target=esnext).1.normal.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.4.ts] +//! +//! x Expression expected +//! ,-[4:1] +//! 4 | +//! 5 | using before = null; +//! 6 | +//! 7 | @dec +//! : ^ +//! 8 | export default class { +//! 9 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.4(module=commonjs,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.4(module=commonjs,target=esnext).2.minified.js new file mode 100644 index 000000000000..a34dd211936c --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.4(module=commonjs,target=esnext).2.minified.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.4.ts] +//! +//! x Expression expected +//! ,-[4:1] +//! 4 | +//! 5 | using before = null; +//! 6 | +//! 7 | @dec +//! : ^ +//! 8 | export default class { +//! 9 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.4(module=es6,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.4(module=es6,target=esnext).1.normal.js new file mode 100644 index 000000000000..a34dd211936c --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.4(module=es6,target=esnext).1.normal.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.4.ts] +//! +//! x Expression expected +//! ,-[4:1] +//! 4 | +//! 5 | using before = null; +//! 6 | +//! 7 | @dec +//! : ^ +//! 8 | export default class { +//! 9 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.4(module=es6,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.4(module=es6,target=esnext).2.minified.js new file mode 100644 index 000000000000..a34dd211936c --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.4(module=es6,target=esnext).2.minified.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.4.ts] +//! +//! x Expression expected +//! ,-[4:1] +//! 4 | +//! 5 | using before = null; +//! 6 | +//! 7 | @dec +//! : ^ +//! 8 | export default class { +//! 9 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.4(module=system,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.4(module=system,target=esnext).1.normal.js new file mode 100644 index 000000000000..a34dd211936c --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.4(module=system,target=esnext).1.normal.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.4.ts] +//! +//! x Expression expected +//! ,-[4:1] +//! 4 | +//! 5 | using before = null; +//! 6 | +//! 7 | @dec +//! : ^ +//! 8 | export default class { +//! 9 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.4(module=system,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.4(module=system,target=esnext).2.minified.js new file mode 100644 index 000000000000..a34dd211936c --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.4(module=system,target=esnext).2.minified.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.4.ts] +//! +//! x Expression expected +//! ,-[4:1] +//! 4 | +//! 5 | using before = null; +//! 6 | +//! 7 | @dec +//! : ^ +//! 8 | export default class { +//! 9 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.5(module=commonjs,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.5(module=commonjs,target=esnext).1.normal.js new file mode 100644 index 000000000000..c0b334945c43 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.5(module=commonjs,target=esnext).1.normal.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.5.ts] +//! +//! x Expression expected +//! ,-[4:1] +//! 4 | +//! 5 | using before = null; +//! 6 | +//! 7 | @dec +//! : ^ +//! 8 | class C { +//! 9 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.5(module=commonjs,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.5(module=commonjs,target=esnext).2.minified.js new file mode 100644 index 000000000000..c0b334945c43 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.5(module=commonjs,target=esnext).2.minified.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.5.ts] +//! +//! x Expression expected +//! ,-[4:1] +//! 4 | +//! 5 | using before = null; +//! 6 | +//! 7 | @dec +//! : ^ +//! 8 | class C { +//! 9 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.5(module=es6,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.5(module=es6,target=esnext).1.normal.js new file mode 100644 index 000000000000..c0b334945c43 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.5(module=es6,target=esnext).1.normal.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.5.ts] +//! +//! x Expression expected +//! ,-[4:1] +//! 4 | +//! 5 | using before = null; +//! 6 | +//! 7 | @dec +//! : ^ +//! 8 | class C { +//! 9 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.5(module=es6,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.5(module=es6,target=esnext).2.minified.js new file mode 100644 index 000000000000..c0b334945c43 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.5(module=es6,target=esnext).2.minified.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.5.ts] +//! +//! x Expression expected +//! ,-[4:1] +//! 4 | +//! 5 | using before = null; +//! 6 | +//! 7 | @dec +//! : ^ +//! 8 | class C { +//! 9 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.5(module=system,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.5(module=system,target=esnext).1.normal.js new file mode 100644 index 000000000000..c0b334945c43 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.5(module=system,target=esnext).1.normal.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.5.ts] +//! +//! x Expression expected +//! ,-[4:1] +//! 4 | +//! 5 | using before = null; +//! 6 | +//! 7 | @dec +//! : ^ +//! 8 | class C { +//! 9 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.5(module=system,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.5(module=system,target=esnext).2.minified.js new file mode 100644 index 000000000000..c0b334945c43 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.5(module=system,target=esnext).2.minified.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.5.ts] +//! +//! x Expression expected +//! ,-[4:1] +//! 4 | +//! 5 | using before = null; +//! 6 | +//! 7 | @dec +//! : ^ +//! 8 | class C { +//! 9 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.6(module=commonjs,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.6(module=commonjs,target=esnext).1.normal.js new file mode 100644 index 000000000000..258dc5a7efb5 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.6(module=commonjs,target=esnext).1.normal.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.6.ts] +//! +//! x Expression expected +//! ,-[4:1] +//! 4 | +//! 5 | using before = null; +//! 6 | +//! 7 | @dec +//! : ^ +//! 8 | class C { +//! 9 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.6(module=commonjs,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.6(module=commonjs,target=esnext).2.minified.js new file mode 100644 index 000000000000..258dc5a7efb5 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.6(module=commonjs,target=esnext).2.minified.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.6.ts] +//! +//! x Expression expected +//! ,-[4:1] +//! 4 | +//! 5 | using before = null; +//! 6 | +//! 7 | @dec +//! : ^ +//! 8 | class C { +//! 9 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.6(module=es6,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.6(module=es6,target=esnext).1.normal.js new file mode 100644 index 000000000000..258dc5a7efb5 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.6(module=es6,target=esnext).1.normal.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.6.ts] +//! +//! x Expression expected +//! ,-[4:1] +//! 4 | +//! 5 | using before = null; +//! 6 | +//! 7 | @dec +//! : ^ +//! 8 | class C { +//! 9 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.6(module=es6,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.6(module=es6,target=esnext).2.minified.js new file mode 100644 index 000000000000..258dc5a7efb5 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.6(module=es6,target=esnext).2.minified.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.6.ts] +//! +//! x Expression expected +//! ,-[4:1] +//! 4 | +//! 5 | using before = null; +//! 6 | +//! 7 | @dec +//! : ^ +//! 8 | class C { +//! 9 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.6(module=system,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.6(module=system,target=esnext).1.normal.js new file mode 100644 index 000000000000..258dc5a7efb5 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.6(module=system,target=esnext).1.normal.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.6.ts] +//! +//! x Expression expected +//! ,-[4:1] +//! 4 | +//! 5 | using before = null; +//! 6 | +//! 7 | @dec +//! : ^ +//! 8 | class C { +//! 9 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.6(module=system,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.6(module=system,target=esnext).2.minified.js new file mode 100644 index 000000000000..258dc5a7efb5 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.6(module=system,target=esnext).2.minified.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.6.ts] +//! +//! x Expression expected +//! ,-[4:1] +//! 4 | +//! 5 | using before = null; +//! 6 | +//! 7 | @dec +//! : ^ +//! 8 | class C { +//! 9 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.7(module=commonjs,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.7(module=commonjs,target=esnext).1.normal.js new file mode 100644 index 000000000000..0155a6682256 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.7(module=commonjs,target=esnext).1.normal.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.7.ts] +//! +//! x Expression expected +//! ,-[2:1] +//! 2 | +//! 3 | declare var dec: any; +//! 4 | +//! 5 | @dec +//! : ^ +//! 6 | class C { +//! 7 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.7(module=commonjs,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.7(module=commonjs,target=esnext).2.minified.js new file mode 100644 index 000000000000..0155a6682256 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.7(module=commonjs,target=esnext).2.minified.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.7.ts] +//! +//! x Expression expected +//! ,-[2:1] +//! 2 | +//! 3 | declare var dec: any; +//! 4 | +//! 5 | @dec +//! : ^ +//! 6 | class C { +//! 7 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.7(module=es6,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.7(module=es6,target=esnext).1.normal.js new file mode 100644 index 000000000000..0155a6682256 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.7(module=es6,target=esnext).1.normal.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.7.ts] +//! +//! x Expression expected +//! ,-[2:1] +//! 2 | +//! 3 | declare var dec: any; +//! 4 | +//! 5 | @dec +//! : ^ +//! 6 | class C { +//! 7 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.7(module=es6,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.7(module=es6,target=esnext).2.minified.js new file mode 100644 index 000000000000..0155a6682256 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.7(module=es6,target=esnext).2.minified.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.7.ts] +//! +//! x Expression expected +//! ,-[2:1] +//! 2 | +//! 3 | declare var dec: any; +//! 4 | +//! 5 | @dec +//! : ^ +//! 6 | class C { +//! 7 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.7(module=system,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.7(module=system,target=esnext).1.normal.js new file mode 100644 index 000000000000..0155a6682256 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.7(module=system,target=esnext).1.normal.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.7.ts] +//! +//! x Expression expected +//! ,-[2:1] +//! 2 | +//! 3 | declare var dec: any; +//! 4 | +//! 5 | @dec +//! : ^ +//! 6 | class C { +//! 7 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.7(module=system,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.7(module=system,target=esnext).2.minified.js new file mode 100644 index 000000000000..0155a6682256 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.7(module=system,target=esnext).2.minified.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.7.ts] +//! +//! x Expression expected +//! ,-[2:1] +//! 2 | +//! 3 | declare var dec: any; +//! 4 | +//! 5 | @dec +//! : ^ +//! 6 | class C { +//! 7 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.8(module=commonjs,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.8(module=commonjs,target=esnext).1.normal.js new file mode 100644 index 000000000000..1101b4e6c8f0 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.8(module=commonjs,target=esnext).1.normal.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.8.ts] +//! +//! x Expression expected +//! ,-[2:1] +//! 2 | +//! 3 | declare var dec: any; +//! 4 | +//! 5 | @dec +//! : ^ +//! 6 | export class C { +//! 7 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.8(module=commonjs,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.8(module=commonjs,target=esnext).2.minified.js new file mode 100644 index 000000000000..1101b4e6c8f0 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.8(module=commonjs,target=esnext).2.minified.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.8.ts] +//! +//! x Expression expected +//! ,-[2:1] +//! 2 | +//! 3 | declare var dec: any; +//! 4 | +//! 5 | @dec +//! : ^ +//! 6 | export class C { +//! 7 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.8(module=es6,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.8(module=es6,target=esnext).1.normal.js new file mode 100644 index 000000000000..1101b4e6c8f0 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.8(module=es6,target=esnext).1.normal.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.8.ts] +//! +//! x Expression expected +//! ,-[2:1] +//! 2 | +//! 3 | declare var dec: any; +//! 4 | +//! 5 | @dec +//! : ^ +//! 6 | export class C { +//! 7 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.8(module=es6,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.8(module=es6,target=esnext).2.minified.js new file mode 100644 index 000000000000..1101b4e6c8f0 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.8(module=es6,target=esnext).2.minified.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.8.ts] +//! +//! x Expression expected +//! ,-[2:1] +//! 2 | +//! 3 | declare var dec: any; +//! 4 | +//! 5 | @dec +//! : ^ +//! 6 | export class C { +//! 7 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.8(module=system,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.8(module=system,target=esnext).1.normal.js new file mode 100644 index 000000000000..1101b4e6c8f0 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.8(module=system,target=esnext).1.normal.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.8.ts] +//! +//! x Expression expected +//! ,-[2:1] +//! 2 | +//! 3 | declare var dec: any; +//! 4 | +//! 5 | @dec +//! : ^ +//! 6 | export class C { +//! 7 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.8(module=system,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.8(module=system,target=esnext).2.minified.js new file mode 100644 index 000000000000..1101b4e6c8f0 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.8(module=system,target=esnext).2.minified.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.8.ts] +//! +//! x Expression expected +//! ,-[2:1] +//! 2 | +//! 3 | declare var dec: any; +//! 4 | +//! 5 | @dec +//! : ^ +//! 6 | export class C { +//! 7 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.9(module=commonjs,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.9(module=commonjs,target=esnext).1.normal.js new file mode 100644 index 000000000000..36b3a3c967bd --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.9(module=commonjs,target=esnext).1.normal.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.9.ts] +//! +//! x Expression expected +//! ,-[2:1] +//! 2 | +//! 3 | declare var dec: any; +//! 4 | +//! 5 | @dec +//! : ^ +//! 6 | export default class C { +//! 7 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.9(module=commonjs,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.9(module=commonjs,target=esnext).2.minified.js new file mode 100644 index 000000000000..36b3a3c967bd --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.9(module=commonjs,target=esnext).2.minified.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.9.ts] +//! +//! x Expression expected +//! ,-[2:1] +//! 2 | +//! 3 | declare var dec: any; +//! 4 | +//! 5 | @dec +//! : ^ +//! 6 | export default class C { +//! 7 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.9(module=es6,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.9(module=es6,target=esnext).1.normal.js new file mode 100644 index 000000000000..36b3a3c967bd --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.9(module=es6,target=esnext).1.normal.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.9.ts] +//! +//! x Expression expected +//! ,-[2:1] +//! 2 | +//! 3 | declare var dec: any; +//! 4 | +//! 5 | @dec +//! : ^ +//! 6 | export default class C { +//! 7 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.9(module=es6,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.9(module=es6,target=esnext).2.minified.js new file mode 100644 index 000000000000..36b3a3c967bd --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.9(module=es6,target=esnext).2.minified.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.9.ts] +//! +//! x Expression expected +//! ,-[2:1] +//! 2 | +//! 3 | declare var dec: any; +//! 4 | +//! 5 | @dec +//! : ^ +//! 6 | export default class C { +//! 7 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.9(module=system,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.9(module=system,target=esnext).1.normal.js new file mode 100644 index 000000000000..36b3a3c967bd --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.9(module=system,target=esnext).1.normal.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.9.ts] +//! +//! x Expression expected +//! ,-[2:1] +//! 2 | +//! 3 | declare var dec: any; +//! 4 | +//! 5 | @dec +//! : ^ +//! 6 | export default class C { +//! 7 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.9(module=system,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.9(module=system,target=esnext).2.minified.js new file mode 100644 index 000000000000..36b3a3c967bd --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithESClassDecorators.9(module=system,target=esnext).2.minified.js @@ -0,0 +1,12 @@ +//// [usingDeclarationsWithESClassDecorators.9.ts] +//! +//! x Expression expected +//! ,-[2:1] +//! 2 | +//! 3 | declare var dec: any; +//! 4 | +//! 5 | @dec +//! : ^ +//! 6 | export default class C { +//! 7 | } +//! `---- diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.1(module=commonjs,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.1(module=commonjs,target=esnext).1.normal.js new file mode 100644 index 000000000000..71858adb8861 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.1(module=commonjs,target=esnext).1.normal.js @@ -0,0 +1,22 @@ +//// [usingDeclarationsWithLegacyClassDecorators.1.ts] +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +const _ts_decorate = require("@swc/helpers/_/_ts_decorate"); +const _dispose = require("@swc/helpers/_/_dispose"); +const _using = require("@swc/helpers/_/_using"); +try { + var _stack = []; + var before = _using._(_stack, null); + class C { + } + C = _ts_decorate._([ + dec + ], C); +} catch (_) { + var _error = _; + var _hasError = true; +} finally{ + _dispose._(_stack, _error, _hasError); +} diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.1(module=commonjs,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.1(module=commonjs,target=esnext).2.minified.js new file mode 100644 index 000000000000..5347912f58a5 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.1(module=commonjs,target=esnext).2.minified.js @@ -0,0 +1,18 @@ +//// [usingDeclarationsWithLegacyClassDecorators.1.ts] +Object.defineProperty(exports, "__esModule", { + value: !0 +}); +const _ts_decorate = require("@swc/helpers/_/_ts_decorate"), _dispose = require("@swc/helpers/_/_dispose"), _using = require("@swc/helpers/_/_using"); +try { + var _stack = []; + _using._(_stack, null); + class C { + } + C = _ts_decorate._([ + dec + ], C); +} catch (_) { + var _error = _, _hasError = !0; +} finally{ + _dispose._(_stack, _error, _hasError); +} diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.1(module=es6,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.1(module=es6,target=esnext).1.normal.js new file mode 100644 index 000000000000..f50c324a8527 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.1(module=es6,target=esnext).1.normal.js @@ -0,0 +1,19 @@ +//// [usingDeclarationsWithLegacyClassDecorators.1.ts] +import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate"; +import { _ as _dispose } from "@swc/helpers/_/_dispose"; +import { _ as _using } from "@swc/helpers/_/_using"; +try { + var _stack = []; + var before = _using(_stack, null); + class C { + } + C = _ts_decorate([ + dec + ], C); +} catch (_) { + var _error = _; + var _hasError = true; +} finally{ + _dispose(_stack, _error, _hasError); +} +export { }; diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.1(module=es6,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.1(module=es6,target=esnext).2.minified.js new file mode 100644 index 000000000000..9cbb6cc4f685 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.1(module=es6,target=esnext).2.minified.js @@ -0,0 +1,17 @@ +//// [usingDeclarationsWithLegacyClassDecorators.1.ts] +import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate"; +import { _ as _dispose } from "@swc/helpers/_/_dispose"; +import { _ as _using } from "@swc/helpers/_/_using"; +try { + var _stack = []; + _using(_stack, null); + class C { + } + C = _ts_decorate([ + dec + ], C); +} catch (_) { + var _error = _, _hasError = !0; +} finally{ + _dispose(_stack, _error, _hasError); +} diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.1(module=system,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.1(module=system,target=esnext).1.normal.js new file mode 100644 index 000000000000..292bace8b988 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.1(module=system,target=esnext).1.normal.js @@ -0,0 +1,38 @@ +//// [usingDeclarationsWithLegacyClassDecorators.1.ts] +System.register([ + "@swc/helpers/_/_ts_decorate", + "@swc/helpers/_/_dispose", + "@swc/helpers/_/_using" +], function(_export, _context) { + "use strict"; + var _ts_decorate, _dispose, _using; + return { + setters: [ + function(_ts_decorate1) { + _ts_decorate = _ts_decorate1._; + }, + function(_dispose1) { + _dispose = _dispose1._; + }, + function(_using1) { + _using = _using1._; + } + ], + execute: function() { + try { + var _stack = []; + var before = _using(_stack, null); + class C { + } + C = _ts_decorate([ + dec + ], C); + } catch (_) { + var _error = _; + var _hasError = true; + } finally{ + _dispose(_stack, _error, _hasError); + } + } + }; +}); diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.1(module=system,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.1(module=system,target=esnext).2.minified.js new file mode 100644 index 000000000000..1bf45619cf1c --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.1(module=system,target=esnext).2.minified.js @@ -0,0 +1,36 @@ +//// [usingDeclarationsWithLegacyClassDecorators.1.ts] +System.register([ + "@swc/helpers/_/_ts_decorate", + "@swc/helpers/_/_dispose", + "@swc/helpers/_/_using" +], function(_export, _context) { + var _ts_decorate, _dispose, _using; + return { + setters: [ + function(_ts_decorate1) { + _ts_decorate = _ts_decorate1._; + }, + function(_dispose1) { + _dispose = _dispose1._; + }, + function(_using1) { + _using = _using1._; + } + ], + execute: function() { + try { + var _stack = []; + _using(_stack, null); + class C { + } + C = _ts_decorate([ + dec + ], C); + } catch (_) { + var _error = _, _hasError = !0; + } finally{ + _dispose(_stack, _error, _hasError); + } + } + }; +}); diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.10(module=commonjs,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.10(module=commonjs,target=esnext).1.normal.js new file mode 100644 index 000000000000..79fc6942532b --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.10(module=commonjs,target=esnext).1.normal.js @@ -0,0 +1,28 @@ +//// [usingDeclarationsWithLegacyClassDecorators.10.ts] +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "default", { + enumerable: true, + get: function() { + return _class; + } +}); +const _ts_decorate = require("@swc/helpers/_/_ts_decorate"); +const _dispose = require("@swc/helpers/_/_dispose"); +const _using = require("@swc/helpers/_/_using"); +try { + var _stack = []; + var _class = class _class { + }; + _class = _ts_decorate._([ + dec + ], _class); + var after = _using._(_stack, null); +} catch (_) { + var _error = _; + var _hasError = true; +} finally{ + _dispose._(_stack, _error, _hasError); +} diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.10(module=commonjs,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.10(module=commonjs,target=esnext).2.minified.js new file mode 100644 index 000000000000..cf4b69303668 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.10(module=commonjs,target=esnext).2.minified.js @@ -0,0 +1,21 @@ +//// [usingDeclarationsWithLegacyClassDecorators.10.ts] +Object.defineProperty(exports, "__esModule", { + value: !0 +}), Object.defineProperty(exports, "default", { + enumerable: !0, + get: function() { + return _class; + } +}); +const _ts_decorate = require("@swc/helpers/_/_ts_decorate"), _dispose = require("@swc/helpers/_/_dispose"), _using = require("@swc/helpers/_/_using"); +try { + var _stack = [], _class = class { + }; + _class = _ts_decorate._([ + dec + ], _class), _using._(_stack, null); +} catch (_) { + var _error = _, _hasError = !0; +} finally{ + _dispose._(_stack, _error, _hasError); +} diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.10(module=es6,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.10(module=es6,target=esnext).1.normal.js new file mode 100644 index 000000000000..6823bf320d59 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.10(module=es6,target=esnext).1.normal.js @@ -0,0 +1,19 @@ +//// [usingDeclarationsWithLegacyClassDecorators.10.ts] +import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate"; +import { _ as _dispose } from "@swc/helpers/_/_dispose"; +import { _ as _using } from "@swc/helpers/_/_using"; +export { _class as default }; +try { + var _stack = []; + var _class = class _class { + }; + _class = _ts_decorate([ + dec + ], _class); + var after = _using(_stack, null); +} catch (_) { + var _error = _; + var _hasError = true; +} finally{ + _dispose(_stack, _error, _hasError); +} diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.10(module=es6,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.10(module=es6,target=esnext).2.minified.js new file mode 100644 index 000000000000..1b759cf5937a --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.10(module=es6,target=esnext).2.minified.js @@ -0,0 +1,16 @@ +//// [usingDeclarationsWithLegacyClassDecorators.10.ts] +import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate"; +import { _ as _dispose } from "@swc/helpers/_/_dispose"; +import { _ as _using } from "@swc/helpers/_/_using"; +try { + var _stack = [], _class = class { + }; + _class = _ts_decorate([ + dec + ], _class), _using(_stack, null); +} catch (_) { + var _error = _, _hasError = !0; +} finally{ + _dispose(_stack, _error, _hasError); +} +export { _class as default }; diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.10(module=system,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.10(module=system,target=esnext).1.normal.js new file mode 100644 index 000000000000..b840ec30cb32 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.10(module=system,target=esnext).1.normal.js @@ -0,0 +1,38 @@ +//// [usingDeclarationsWithLegacyClassDecorators.10.ts] +System.register([ + "@swc/helpers/_/_ts_decorate", + "@swc/helpers/_/_dispose", + "@swc/helpers/_/_using" +], function(_export, _context) { + "use strict"; + var _ts_decorate, _dispose, _using; + return { + setters: [ + function(_ts_decorate1) { + _ts_decorate = _ts_decorate1._; + }, + function(_dispose1) { + _dispose = _dispose1._; + }, + function(_using1) { + _using = _using1._; + } + ], + execute: function() { + try { + var _stack = []; + var _class = class _class { + }; + _export("default", _class = _ts_decorate([ + dec + ], _class)); + var after = _using(_stack, null); + } catch (_) { + var _error = _; + var _hasError = true; + } finally{ + _dispose(_stack, _error, _hasError); + } + } + }; +}); diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.10(module=system,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.10(module=system,target=esnext).2.minified.js new file mode 100644 index 000000000000..79281b2bafc5 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.10(module=system,target=esnext).2.minified.js @@ -0,0 +1,34 @@ +//// [usingDeclarationsWithLegacyClassDecorators.10.ts] +System.register([ + "@swc/helpers/_/_ts_decorate", + "@swc/helpers/_/_dispose", + "@swc/helpers/_/_using" +], function(_export, _context) { + var _ts_decorate, _dispose, _using; + return { + setters: [ + function(_ts_decorate1) { + _ts_decorate = _ts_decorate1._; + }, + function(_dispose1) { + _dispose = _dispose1._; + }, + function(_using1) { + _using = _using1._; + } + ], + execute: function() { + try { + var _stack = [], _class = class { + }; + _export("default", _class = _ts_decorate([ + dec + ], _class)), _using(_stack, null); + } catch (_) { + var _error = _, _hasError = !0; + } finally{ + _dispose(_stack, _error, _hasError); + } + } + }; +}); diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.11(module=commonjs,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.11(module=commonjs,target=esnext).1.normal.js new file mode 100644 index 000000000000..2060f3f17abd --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.11(module=commonjs,target=esnext).1.normal.js @@ -0,0 +1,28 @@ +//// [usingDeclarationsWithLegacyClassDecorators.11.ts] +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "C", { + enumerable: true, + get: function() { + return C; + } +}); +const _ts_decorate = require("@swc/helpers/_/_ts_decorate"); +const _dispose = require("@swc/helpers/_/_dispose"); +const _using = require("@swc/helpers/_/_using"); +try { + var _stack = []; + class C { + } + C = _ts_decorate._([ + dec + ], C); + var after = _using._(_stack, null); +} catch (_) { + var _error = _; + var _hasError = true; +} finally{ + _dispose._(_stack, _error, _hasError); +} diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.11(module=commonjs,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.11(module=commonjs,target=esnext).2.minified.js new file mode 100644 index 000000000000..712eac0bbbc3 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.11(module=commonjs,target=esnext).2.minified.js @@ -0,0 +1,22 @@ +//// [usingDeclarationsWithLegacyClassDecorators.11.ts] +Object.defineProperty(exports, "__esModule", { + value: !0 +}), Object.defineProperty(exports, "C", { + enumerable: !0, + get: function() { + return C; + } +}); +const _ts_decorate = require("@swc/helpers/_/_ts_decorate"), _dispose = require("@swc/helpers/_/_dispose"), _using = require("@swc/helpers/_/_using"); +try { + var _stack = []; + class C1 { + } + C1 = _ts_decorate._([ + dec + ], C1), _using._(_stack, null); +} catch (_) { + var _error = _, _hasError = !0; +} finally{ + _dispose._(_stack, _error, _hasError); +} diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.11(module=es6,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.11(module=es6,target=esnext).1.normal.js new file mode 100644 index 000000000000..f2936a1d2007 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.11(module=es6,target=esnext).1.normal.js @@ -0,0 +1,19 @@ +//// [usingDeclarationsWithLegacyClassDecorators.11.ts] +import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate"; +import { _ as _dispose } from "@swc/helpers/_/_dispose"; +import { _ as _using } from "@swc/helpers/_/_using"; +export { C }; +try { + var _stack = []; + class C { + } + C = _ts_decorate([ + dec + ], C); + var after = _using(_stack, null); +} catch (_) { + var _error = _; + var _hasError = true; +} finally{ + _dispose(_stack, _error, _hasError); +} diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.11(module=es6,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.11(module=es6,target=esnext).2.minified.js new file mode 100644 index 000000000000..bfc41e688265 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.11(module=es6,target=esnext).2.minified.js @@ -0,0 +1,17 @@ +//// [usingDeclarationsWithLegacyClassDecorators.11.ts] +import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate"; +import { _ as _dispose } from "@swc/helpers/_/_dispose"; +import { _ as _using } from "@swc/helpers/_/_using"; +try { + var _stack = []; + class C { + } + C = _ts_decorate([ + dec + ], C), _using(_stack, null); +} catch (_) { + var _error = _, _hasError = !0; +} finally{ + _dispose(_stack, _error, _hasError); +} +export { C }; diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.11(module=system,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.11(module=system,target=esnext).1.normal.js new file mode 100644 index 000000000000..68ed418475fd --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.11(module=system,target=esnext).1.normal.js @@ -0,0 +1,38 @@ +//// [usingDeclarationsWithLegacyClassDecorators.11.ts] +System.register([ + "@swc/helpers/_/_ts_decorate", + "@swc/helpers/_/_dispose", + "@swc/helpers/_/_using" +], function(_export, _context) { + "use strict"; + var _ts_decorate, _dispose, _using; + return { + setters: [ + function(_ts_decorate1) { + _ts_decorate = _ts_decorate1._; + }, + function(_dispose1) { + _dispose = _dispose1._; + }, + function(_using1) { + _using = _using1._; + } + ], + execute: function() { + try { + var _stack = []; + class C { + } + _export("C", C = _ts_decorate([ + dec + ], C)); + var after = _using(_stack, null); + } catch (_) { + var _error = _; + var _hasError = true; + } finally{ + _dispose(_stack, _error, _hasError); + } + } + }; +}); diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.11(module=system,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.11(module=system,target=esnext).2.minified.js new file mode 100644 index 000000000000..4846050e419d --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.11(module=system,target=esnext).2.minified.js @@ -0,0 +1,35 @@ +//// [usingDeclarationsWithLegacyClassDecorators.11.ts] +System.register([ + "@swc/helpers/_/_ts_decorate", + "@swc/helpers/_/_dispose", + "@swc/helpers/_/_using" +], function(_export, _context) { + var _ts_decorate, _dispose, _using; + return { + setters: [ + function(_ts_decorate1) { + _ts_decorate = _ts_decorate1._; + }, + function(_dispose1) { + _dispose = _dispose1._; + }, + function(_using1) { + _using = _using1._; + } + ], + execute: function() { + try { + var _stack = []; + class C { + } + _export("C", C = _ts_decorate([ + dec + ], C)), _using(_stack, null); + } catch (_) { + var _error = _, _hasError = !0; + } finally{ + _dispose(_stack, _error, _hasError); + } + } + }; +}); diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.12(module=commonjs,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.12(module=commonjs,target=esnext).1.normal.js new file mode 100644 index 000000000000..977c78ee12bf --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.12(module=commonjs,target=esnext).1.normal.js @@ -0,0 +1,28 @@ +//// [usingDeclarationsWithLegacyClassDecorators.12.ts] +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "D", { + enumerable: true, + get: function() { + return C; + } +}); +const _ts_decorate = require("@swc/helpers/_/_ts_decorate"); +const _dispose = require("@swc/helpers/_/_dispose"); +const _using = require("@swc/helpers/_/_using"); +try { + var _stack = []; + class C { + } + C = _ts_decorate._([ + dec + ], C); + var after = _using._(_stack, null); +} catch (_) { + var _error = _; + var _hasError = true; +} finally{ + _dispose._(_stack, _error, _hasError); +} diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.12(module=commonjs,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.12(module=commonjs,target=esnext).2.minified.js new file mode 100644 index 000000000000..7cf79fb251ce --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.12(module=commonjs,target=esnext).2.minified.js @@ -0,0 +1,22 @@ +//// [usingDeclarationsWithLegacyClassDecorators.12.ts] +Object.defineProperty(exports, "__esModule", { + value: !0 +}), Object.defineProperty(exports, "D", { + enumerable: !0, + get: function() { + return C; + } +}); +const _ts_decorate = require("@swc/helpers/_/_ts_decorate"), _dispose = require("@swc/helpers/_/_dispose"), _using = require("@swc/helpers/_/_using"); +try { + var _stack = []; + class C1 { + } + C1 = _ts_decorate._([ + dec + ], C1), _using._(_stack, null); +} catch (_) { + var _error = _, _hasError = !0; +} finally{ + _dispose._(_stack, _error, _hasError); +} diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.12(module=es6,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.12(module=es6,target=esnext).1.normal.js new file mode 100644 index 000000000000..ab3578769112 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.12(module=es6,target=esnext).1.normal.js @@ -0,0 +1,19 @@ +//// [usingDeclarationsWithLegacyClassDecorators.12.ts] +import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate"; +import { _ as _dispose } from "@swc/helpers/_/_dispose"; +import { _ as _using } from "@swc/helpers/_/_using"; +export { C as D }; +try { + var _stack = []; + class C { + } + C = _ts_decorate([ + dec + ], C); + var after = _using(_stack, null); +} catch (_) { + var _error = _; + var _hasError = true; +} finally{ + _dispose(_stack, _error, _hasError); +} diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.12(module=es6,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.12(module=es6,target=esnext).2.minified.js new file mode 100644 index 000000000000..025b7687012a --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.12(module=es6,target=esnext).2.minified.js @@ -0,0 +1,17 @@ +//// [usingDeclarationsWithLegacyClassDecorators.12.ts] +import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate"; +import { _ as _dispose } from "@swc/helpers/_/_dispose"; +import { _ as _using } from "@swc/helpers/_/_using"; +try { + var _stack = []; + class C { + } + C = _ts_decorate([ + dec + ], C), _using(_stack, null); +} catch (_) { + var _error = _, _hasError = !0; +} finally{ + _dispose(_stack, _error, _hasError); +} +export { C as D }; diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.12(module=system,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.12(module=system,target=esnext).1.normal.js new file mode 100644 index 000000000000..af4f0cb9a19b --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.12(module=system,target=esnext).1.normal.js @@ -0,0 +1,38 @@ +//// [usingDeclarationsWithLegacyClassDecorators.12.ts] +System.register([ + "@swc/helpers/_/_ts_decorate", + "@swc/helpers/_/_dispose", + "@swc/helpers/_/_using" +], function(_export, _context) { + "use strict"; + var _ts_decorate, _dispose, _using; + return { + setters: [ + function(_ts_decorate1) { + _ts_decorate = _ts_decorate1._; + }, + function(_dispose1) { + _dispose = _dispose1._; + }, + function(_using1) { + _using = _using1._; + } + ], + execute: function() { + try { + var _stack = []; + class C { + } + _export("D", C = _ts_decorate([ + dec + ], C)); + var after = _using(_stack, null); + } catch (_) { + var _error = _; + var _hasError = true; + } finally{ + _dispose(_stack, _error, _hasError); + } + } + }; +}); diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.12(module=system,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.12(module=system,target=esnext).2.minified.js new file mode 100644 index 000000000000..dd20b3a8fab6 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.12(module=system,target=esnext).2.minified.js @@ -0,0 +1,35 @@ +//// [usingDeclarationsWithLegacyClassDecorators.12.ts] +System.register([ + "@swc/helpers/_/_ts_decorate", + "@swc/helpers/_/_dispose", + "@swc/helpers/_/_using" +], function(_export, _context) { + var _ts_decorate, _dispose, _using; + return { + setters: [ + function(_ts_decorate1) { + _ts_decorate = _ts_decorate1._; + }, + function(_dispose1) { + _dispose = _dispose1._; + }, + function(_using1) { + _using = _using1._; + } + ], + execute: function() { + try { + var _stack = []; + class C { + } + _export("D", C = _ts_decorate([ + dec + ], C)), _using(_stack, null); + } catch (_) { + var _error = _, _hasError = !0; + } finally{ + _dispose(_stack, _error, _hasError); + } + } + }; +}); diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=commonjs,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=commonjs,target=esnext).1.normal.js new file mode 100644 index 000000000000..1ae9d023e761 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=commonjs,target=esnext).1.normal.js @@ -0,0 +1,28 @@ +//// [usingDeclarationsWithLegacyClassDecorators.2.ts] +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "C", { + enumerable: true, + get: function() { + return C; + } +}); +const _ts_decorate = require("@swc/helpers/_/_ts_decorate"); +const _dispose = require("@swc/helpers/_/_dispose"); +const _using = require("@swc/helpers/_/_using"); +class C { +} +try { + var _stack = []; + var before = _using._(_stack, null); + C = _ts_decorate._([ + dec + ], C); +} catch (_) { + var _error = _; + var _hasError = true; +} finally{ + _dispose._(_stack, _error, _hasError); +} diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=commonjs,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=commonjs,target=esnext).2.minified.js new file mode 100644 index 000000000000..d15b7ebd3f3a --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=commonjs,target=esnext).2.minified.js @@ -0,0 +1,22 @@ +//// [usingDeclarationsWithLegacyClassDecorators.2.ts] +Object.defineProperty(exports, "__esModule", { + value: !0 +}), Object.defineProperty(exports, "C", { + enumerable: !0, + get: function() { + return C; + } +}); +const _ts_decorate = require("@swc/helpers/_/_ts_decorate"), _dispose = require("@swc/helpers/_/_dispose"), _using = require("@swc/helpers/_/_using"); +class C { +} +try { + var _stack = []; + _using._(_stack, null), C = _ts_decorate._([ + dec + ], C); +} catch (_) { + var _error = _, _hasError = !0; +} finally{ + _dispose._(_stack, _error, _hasError); +} diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=es6,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=es6,target=esnext).1.normal.js new file mode 100644 index 000000000000..ff48f455bbae --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=es6,target=esnext).1.normal.js @@ -0,0 +1,18 @@ +//// [usingDeclarationsWithLegacyClassDecorators.2.ts] +import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate"; +import { _ as _dispose } from "@swc/helpers/_/_dispose"; +import { _ as _using } from "@swc/helpers/_/_using"; +export class C { +} +try { + var _stack = []; + var before = _using(_stack, null); + C = _ts_decorate([ + dec + ], C); +} catch (_) { + var _error = _; + var _hasError = true; +} finally{ + _dispose(_stack, _error, _hasError); +} diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=es6,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=es6,target=esnext).2.minified.js new file mode 100644 index 000000000000..c4b0cfc77cef --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=es6,target=esnext).2.minified.js @@ -0,0 +1,16 @@ +//// [usingDeclarationsWithLegacyClassDecorators.2.ts] +import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate"; +import { _ as _dispose } from "@swc/helpers/_/_dispose"; +import { _ as _using } from "@swc/helpers/_/_using"; +export class C { +} +try { + var _stack = []; + _using(_stack, null), C = _ts_decorate([ + dec + ], C); +} catch (_) { + var _error = _, _hasError = !0; +} finally{ + _dispose(_stack, _error, _hasError); +} diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=system,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=system,target=esnext).1.normal.js new file mode 100644 index 000000000000..2a82f32ab288 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=system,target=esnext).1.normal.js @@ -0,0 +1,39 @@ +//// [usingDeclarationsWithLegacyClassDecorators.2.ts] +System.register([ + "@swc/helpers/_/_ts_decorate", + "@swc/helpers/_/_dispose", + "@swc/helpers/_/_using" +], function(_export, _context) { + "use strict"; + var _ts_decorate, _dispose, _using, C; + _export("C", void 0); + return { + setters: [ + function(_ts_decorate1) { + _ts_decorate = _ts_decorate1._; + }, + function(_dispose1) { + _dispose = _dispose1._; + }, + function(_using1) { + _using = _using1._; + } + ], + execute: function() { + _export("C", C = class C { + }); + try { + var _stack = []; + var before = _using(_stack, null); + _export("C", C = _ts_decorate([ + dec + ], C)); + } catch (_) { + var _error = _; + var _hasError = true; + } finally{ + _dispose(_stack, _error, _hasError); + } + } + }; +}); diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=system,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=system,target=esnext).2.minified.js new file mode 100644 index 000000000000..5fef1b50b93c --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=system,target=esnext).2.minified.js @@ -0,0 +1,35 @@ +//// [usingDeclarationsWithLegacyClassDecorators.2.ts] +System.register([ + "@swc/helpers/_/_ts_decorate", + "@swc/helpers/_/_dispose", + "@swc/helpers/_/_using" +], function(_export, _context) { + var _ts_decorate, _dispose, _using, C; + return _export("C", void 0), { + setters: [ + function(_ts_decorate1) { + _ts_decorate = _ts_decorate1._; + }, + function(_dispose1) { + _dispose = _dispose1._; + }, + function(_using1) { + _using = _using1._; + } + ], + execute: function() { + _export("C", C = class { + }); + try { + var _stack = []; + _using(_stack, null), _export("C", C = _ts_decorate([ + dec + ], C)); + } catch (_) { + var _error = _, _hasError = !0; + } finally{ + _dispose(_stack, _error, _hasError); + } + } + }; +}); diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.3(module=commonjs,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.3(module=commonjs,target=esnext).1.normal.js new file mode 100644 index 000000000000..9735c1f95d4f --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.3(module=commonjs,target=esnext).1.normal.js @@ -0,0 +1,28 @@ +//// [usingDeclarationsWithLegacyClassDecorators.3.ts] +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "default", { + enumerable: true, + get: function() { + return C; + } +}); +const _ts_decorate = require("@swc/helpers/_/_ts_decorate"); +const _dispose = require("@swc/helpers/_/_dispose"); +const _using = require("@swc/helpers/_/_using"); +try { + var _stack = []; + var before = _using._(_stack, null); + var C = class C { + }; + C = _ts_decorate._([ + dec + ], C); +} catch (_) { + var _error = _; + var _hasError = true; +} finally{ + _dispose._(_stack, _error, _hasError); +} diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.3(module=commonjs,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.3(module=commonjs,target=esnext).2.minified.js new file mode 100644 index 000000000000..c31f8af43fb9 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.3(module=commonjs,target=esnext).2.minified.js @@ -0,0 +1,23 @@ +//// [usingDeclarationsWithLegacyClassDecorators.3.ts] +Object.defineProperty(exports, "__esModule", { + value: !0 +}), Object.defineProperty(exports, "default", { + enumerable: !0, + get: function() { + return C; + } +}); +const _ts_decorate = require("@swc/helpers/_/_ts_decorate"), _dispose = require("@swc/helpers/_/_dispose"), _using = require("@swc/helpers/_/_using"); +try { + var _stack = []; + _using._(_stack, null); + var C = class { + }; + C = _ts_decorate._([ + dec + ], C); +} catch (_) { + var _error = _, _hasError = !0; +} finally{ + _dispose._(_stack, _error, _hasError); +} diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.3(module=es6,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.3(module=es6,target=esnext).1.normal.js new file mode 100644 index 000000000000..8bdcb3119add --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.3(module=es6,target=esnext).1.normal.js @@ -0,0 +1,19 @@ +//// [usingDeclarationsWithLegacyClassDecorators.3.ts] +import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate"; +import { _ as _dispose } from "@swc/helpers/_/_dispose"; +import { _ as _using } from "@swc/helpers/_/_using"; +export { C as default }; +try { + var _stack = []; + var before = _using(_stack, null); + var C = class C { + }; + C = _ts_decorate([ + dec + ], C); +} catch (_) { + var _error = _; + var _hasError = true; +} finally{ + _dispose(_stack, _error, _hasError); +} diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.3(module=es6,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.3(module=es6,target=esnext).2.minified.js new file mode 100644 index 000000000000..ded12a82e6b9 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.3(module=es6,target=esnext).2.minified.js @@ -0,0 +1,18 @@ +//// [usingDeclarationsWithLegacyClassDecorators.3.ts] +import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate"; +import { _ as _dispose } from "@swc/helpers/_/_dispose"; +import { _ as _using } from "@swc/helpers/_/_using"; +try { + var _stack = []; + _using(_stack, null); + var C = class { + }; + C = _ts_decorate([ + dec + ], C); +} catch (_) { + var _error = _, _hasError = !0; +} finally{ + _dispose(_stack, _error, _hasError); +} +export { C as default }; diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.3(module=system,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.3(module=system,target=esnext).1.normal.js new file mode 100644 index 000000000000..b5cc17c4b511 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.3(module=system,target=esnext).1.normal.js @@ -0,0 +1,38 @@ +//// [usingDeclarationsWithLegacyClassDecorators.3.ts] +System.register([ + "@swc/helpers/_/_ts_decorate", + "@swc/helpers/_/_dispose", + "@swc/helpers/_/_using" +], function(_export, _context) { + "use strict"; + var _ts_decorate, _dispose, _using; + return { + setters: [ + function(_ts_decorate1) { + _ts_decorate = _ts_decorate1._; + }, + function(_dispose1) { + _dispose = _dispose1._; + }, + function(_using1) { + _using = _using1._; + } + ], + execute: function() { + try { + var _stack = []; + var before = _using(_stack, null); + var C = class C { + }; + _export("default", C = _ts_decorate([ + dec + ], C)); + } catch (_) { + var _error = _; + var _hasError = true; + } finally{ + _dispose(_stack, _error, _hasError); + } + } + }; +}); diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.3(module=system,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.3(module=system,target=esnext).2.minified.js new file mode 100644 index 000000000000..5f2d6e813f72 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.3(module=system,target=esnext).2.minified.js @@ -0,0 +1,36 @@ +//// [usingDeclarationsWithLegacyClassDecorators.3.ts] +System.register([ + "@swc/helpers/_/_ts_decorate", + "@swc/helpers/_/_dispose", + "@swc/helpers/_/_using" +], function(_export, _context) { + var _ts_decorate, _dispose, _using; + return { + setters: [ + function(_ts_decorate1) { + _ts_decorate = _ts_decorate1._; + }, + function(_dispose1) { + _dispose = _dispose1._; + }, + function(_using1) { + _using = _using1._; + } + ], + execute: function() { + try { + var _stack = []; + _using(_stack, null); + var C = class { + }; + _export("default", C = _ts_decorate([ + dec + ], C)); + } catch (_) { + var _error = _, _hasError = !0; + } finally{ + _dispose(_stack, _error, _hasError); + } + } + }; +}); diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.4(module=commonjs,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.4(module=commonjs,target=esnext).1.normal.js new file mode 100644 index 000000000000..95fad7db1859 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.4(module=commonjs,target=esnext).1.normal.js @@ -0,0 +1,28 @@ +//// [usingDeclarationsWithLegacyClassDecorators.4.ts] +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "default", { + enumerable: true, + get: function() { + return _class; + } +}); +const _ts_decorate = require("@swc/helpers/_/_ts_decorate"); +const _dispose = require("@swc/helpers/_/_dispose"); +const _using = require("@swc/helpers/_/_using"); +try { + var _stack = []; + var before = _using._(_stack, null); + var _class = class _class { + }; + _class = _ts_decorate._([ + dec + ], _class); +} catch (_) { + var _error = _; + var _hasError = true; +} finally{ + _dispose._(_stack, _error, _hasError); +} diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.4(module=commonjs,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.4(module=commonjs,target=esnext).2.minified.js new file mode 100644 index 000000000000..f210eadd3063 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.4(module=commonjs,target=esnext).2.minified.js @@ -0,0 +1,23 @@ +//// [usingDeclarationsWithLegacyClassDecorators.4.ts] +Object.defineProperty(exports, "__esModule", { + value: !0 +}), Object.defineProperty(exports, "default", { + enumerable: !0, + get: function() { + return _class; + } +}); +const _ts_decorate = require("@swc/helpers/_/_ts_decorate"), _dispose = require("@swc/helpers/_/_dispose"), _using = require("@swc/helpers/_/_using"); +try { + var _stack = []; + _using._(_stack, null); + var _class = class { + }; + _class = _ts_decorate._([ + dec + ], _class); +} catch (_) { + var _error = _, _hasError = !0; +} finally{ + _dispose._(_stack, _error, _hasError); +} diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.4(module=es6,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.4(module=es6,target=esnext).1.normal.js new file mode 100644 index 000000000000..54bbc3405516 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.4(module=es6,target=esnext).1.normal.js @@ -0,0 +1,19 @@ +//// [usingDeclarationsWithLegacyClassDecorators.4.ts] +import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate"; +import { _ as _dispose } from "@swc/helpers/_/_dispose"; +import { _ as _using } from "@swc/helpers/_/_using"; +export { _class as default }; +try { + var _stack = []; + var before = _using(_stack, null); + var _class = class _class { + }; + _class = _ts_decorate([ + dec + ], _class); +} catch (_) { + var _error = _; + var _hasError = true; +} finally{ + _dispose(_stack, _error, _hasError); +} diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.4(module=es6,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.4(module=es6,target=esnext).2.minified.js new file mode 100644 index 000000000000..0c6931f10edc --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.4(module=es6,target=esnext).2.minified.js @@ -0,0 +1,18 @@ +//// [usingDeclarationsWithLegacyClassDecorators.4.ts] +import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate"; +import { _ as _dispose } from "@swc/helpers/_/_dispose"; +import { _ as _using } from "@swc/helpers/_/_using"; +try { + var _stack = []; + _using(_stack, null); + var _class = class { + }; + _class = _ts_decorate([ + dec + ], _class); +} catch (_) { + var _error = _, _hasError = !0; +} finally{ + _dispose(_stack, _error, _hasError); +} +export { _class as default }; diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.4(module=system,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.4(module=system,target=esnext).1.normal.js new file mode 100644 index 000000000000..efb6402b75bc --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.4(module=system,target=esnext).1.normal.js @@ -0,0 +1,38 @@ +//// [usingDeclarationsWithLegacyClassDecorators.4.ts] +System.register([ + "@swc/helpers/_/_ts_decorate", + "@swc/helpers/_/_dispose", + "@swc/helpers/_/_using" +], function(_export, _context) { + "use strict"; + var _ts_decorate, _dispose, _using; + return { + setters: [ + function(_ts_decorate1) { + _ts_decorate = _ts_decorate1._; + }, + function(_dispose1) { + _dispose = _dispose1._; + }, + function(_using1) { + _using = _using1._; + } + ], + execute: function() { + try { + var _stack = []; + var before = _using(_stack, null); + var _class = class _class { + }; + _export("default", _class = _ts_decorate([ + dec + ], _class)); + } catch (_) { + var _error = _; + var _hasError = true; + } finally{ + _dispose(_stack, _error, _hasError); + } + } + }; +}); diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.4(module=system,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.4(module=system,target=esnext).2.minified.js new file mode 100644 index 000000000000..c7a07b62be46 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.4(module=system,target=esnext).2.minified.js @@ -0,0 +1,36 @@ +//// [usingDeclarationsWithLegacyClassDecorators.4.ts] +System.register([ + "@swc/helpers/_/_ts_decorate", + "@swc/helpers/_/_dispose", + "@swc/helpers/_/_using" +], function(_export, _context) { + var _ts_decorate, _dispose, _using; + return { + setters: [ + function(_ts_decorate1) { + _ts_decorate = _ts_decorate1._; + }, + function(_dispose1) { + _dispose = _dispose1._; + }, + function(_using1) { + _using = _using1._; + } + ], + execute: function() { + try { + var _stack = []; + _using(_stack, null); + var _class = class { + }; + _export("default", _class = _ts_decorate([ + dec + ], _class)); + } catch (_) { + var _error = _, _hasError = !0; + } finally{ + _dispose(_stack, _error, _hasError); + } + } + }; +}); diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.5(module=commonjs,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.5(module=commonjs,target=esnext).1.normal.js new file mode 100644 index 000000000000..009466ea54f9 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.5(module=commonjs,target=esnext).1.normal.js @@ -0,0 +1,28 @@ +//// [usingDeclarationsWithLegacyClassDecorators.5.ts] +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "C", { + enumerable: true, + get: function() { + return C; + } +}); +const _ts_decorate = require("@swc/helpers/_/_ts_decorate"); +const _dispose = require("@swc/helpers/_/_dispose"); +const _using = require("@swc/helpers/_/_using"); +try { + var _stack = []; + var before = _using._(_stack, null); + class C { + } + C = _ts_decorate._([ + dec + ], C); +} catch (_) { + var _error = _; + var _hasError = true; +} finally{ + _dispose._(_stack, _error, _hasError); +} diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.5(module=commonjs,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.5(module=commonjs,target=esnext).2.minified.js new file mode 100644 index 000000000000..152d3812ef55 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.5(module=commonjs,target=esnext).2.minified.js @@ -0,0 +1,23 @@ +//// [usingDeclarationsWithLegacyClassDecorators.5.ts] +Object.defineProperty(exports, "__esModule", { + value: !0 +}), Object.defineProperty(exports, "C", { + enumerable: !0, + get: function() { + return C; + } +}); +const _ts_decorate = require("@swc/helpers/_/_ts_decorate"), _dispose = require("@swc/helpers/_/_dispose"), _using = require("@swc/helpers/_/_using"); +try { + var _stack = []; + _using._(_stack, null); + class C1 { + } + C1 = _ts_decorate._([ + dec + ], C1); +} catch (_) { + var _error = _, _hasError = !0; +} finally{ + _dispose._(_stack, _error, _hasError); +} diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.5(module=es6,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.5(module=es6,target=esnext).1.normal.js new file mode 100644 index 000000000000..f6c6f5053a9d --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.5(module=es6,target=esnext).1.normal.js @@ -0,0 +1,19 @@ +//// [usingDeclarationsWithLegacyClassDecorators.5.ts] +import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate"; +import { _ as _dispose } from "@swc/helpers/_/_dispose"; +import { _ as _using } from "@swc/helpers/_/_using"; +export { C }; +try { + var _stack = []; + var before = _using(_stack, null); + class C { + } + C = _ts_decorate([ + dec + ], C); +} catch (_) { + var _error = _; + var _hasError = true; +} finally{ + _dispose(_stack, _error, _hasError); +} diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.5(module=es6,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.5(module=es6,target=esnext).2.minified.js new file mode 100644 index 000000000000..96d6a1140a68 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.5(module=es6,target=esnext).2.minified.js @@ -0,0 +1,18 @@ +//// [usingDeclarationsWithLegacyClassDecorators.5.ts] +import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate"; +import { _ as _dispose } from "@swc/helpers/_/_dispose"; +import { _ as _using } from "@swc/helpers/_/_using"; +try { + var _stack = []; + _using(_stack, null); + class C { + } + C = _ts_decorate([ + dec + ], C); +} catch (_) { + var _error = _, _hasError = !0; +} finally{ + _dispose(_stack, _error, _hasError); +} +export { C }; diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.5(module=system,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.5(module=system,target=esnext).1.normal.js new file mode 100644 index 000000000000..b0eab7c811bd --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.5(module=system,target=esnext).1.normal.js @@ -0,0 +1,38 @@ +//// [usingDeclarationsWithLegacyClassDecorators.5.ts] +System.register([ + "@swc/helpers/_/_ts_decorate", + "@swc/helpers/_/_dispose", + "@swc/helpers/_/_using" +], function(_export, _context) { + "use strict"; + var _ts_decorate, _dispose, _using; + return { + setters: [ + function(_ts_decorate1) { + _ts_decorate = _ts_decorate1._; + }, + function(_dispose1) { + _dispose = _dispose1._; + }, + function(_using1) { + _using = _using1._; + } + ], + execute: function() { + try { + var _stack = []; + var before = _using(_stack, null); + class C { + } + _export("C", C = _ts_decorate([ + dec + ], C)); + } catch (_) { + var _error = _; + var _hasError = true; + } finally{ + _dispose(_stack, _error, _hasError); + } + } + }; +}); diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.5(module=system,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.5(module=system,target=esnext).2.minified.js new file mode 100644 index 000000000000..018faf498774 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.5(module=system,target=esnext).2.minified.js @@ -0,0 +1,36 @@ +//// [usingDeclarationsWithLegacyClassDecorators.5.ts] +System.register([ + "@swc/helpers/_/_ts_decorate", + "@swc/helpers/_/_dispose", + "@swc/helpers/_/_using" +], function(_export, _context) { + var _ts_decorate, _dispose, _using; + return { + setters: [ + function(_ts_decorate1) { + _ts_decorate = _ts_decorate1._; + }, + function(_dispose1) { + _dispose = _dispose1._; + }, + function(_using1) { + _using = _using1._; + } + ], + execute: function() { + try { + var _stack = []; + _using(_stack, null); + class C { + } + _export("C", C = _ts_decorate([ + dec + ], C)); + } catch (_) { + var _error = _, _hasError = !0; + } finally{ + _dispose(_stack, _error, _hasError); + } + } + }; +}); diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.6(module=commonjs,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.6(module=commonjs,target=esnext).1.normal.js new file mode 100644 index 000000000000..c7cb727c0511 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.6(module=commonjs,target=esnext).1.normal.js @@ -0,0 +1,28 @@ +//// [usingDeclarationsWithLegacyClassDecorators.6.ts] +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "D", { + enumerable: true, + get: function() { + return C; + } +}); +const _ts_decorate = require("@swc/helpers/_/_ts_decorate"); +const _dispose = require("@swc/helpers/_/_dispose"); +const _using = require("@swc/helpers/_/_using"); +try { + var _stack = []; + var before = _using._(_stack, null); + class C { + } + C = _ts_decorate._([ + dec + ], C); +} catch (_) { + var _error = _; + var _hasError = true; +} finally{ + _dispose._(_stack, _error, _hasError); +} diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.6(module=commonjs,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.6(module=commonjs,target=esnext).2.minified.js new file mode 100644 index 000000000000..a1ea7d66bbb5 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.6(module=commonjs,target=esnext).2.minified.js @@ -0,0 +1,23 @@ +//// [usingDeclarationsWithLegacyClassDecorators.6.ts] +Object.defineProperty(exports, "__esModule", { + value: !0 +}), Object.defineProperty(exports, "D", { + enumerable: !0, + get: function() { + return C; + } +}); +const _ts_decorate = require("@swc/helpers/_/_ts_decorate"), _dispose = require("@swc/helpers/_/_dispose"), _using = require("@swc/helpers/_/_using"); +try { + var _stack = []; + _using._(_stack, null); + class C1 { + } + C1 = _ts_decorate._([ + dec + ], C1); +} catch (_) { + var _error = _, _hasError = !0; +} finally{ + _dispose._(_stack, _error, _hasError); +} diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.6(module=es6,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.6(module=es6,target=esnext).1.normal.js new file mode 100644 index 000000000000..c4fc86a5ce20 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.6(module=es6,target=esnext).1.normal.js @@ -0,0 +1,19 @@ +//// [usingDeclarationsWithLegacyClassDecorators.6.ts] +import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate"; +import { _ as _dispose } from "@swc/helpers/_/_dispose"; +import { _ as _using } from "@swc/helpers/_/_using"; +export { C as D }; +try { + var _stack = []; + var before = _using(_stack, null); + class C { + } + C = _ts_decorate([ + dec + ], C); +} catch (_) { + var _error = _; + var _hasError = true; +} finally{ + _dispose(_stack, _error, _hasError); +} diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.6(module=es6,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.6(module=es6,target=esnext).2.minified.js new file mode 100644 index 000000000000..8ec90864b21d --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.6(module=es6,target=esnext).2.minified.js @@ -0,0 +1,18 @@ +//// [usingDeclarationsWithLegacyClassDecorators.6.ts] +import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate"; +import { _ as _dispose } from "@swc/helpers/_/_dispose"; +import { _ as _using } from "@swc/helpers/_/_using"; +try { + var _stack = []; + _using(_stack, null); + class C { + } + C = _ts_decorate([ + dec + ], C); +} catch (_) { + var _error = _, _hasError = !0; +} finally{ + _dispose(_stack, _error, _hasError); +} +export { C as D }; diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.6(module=system,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.6(module=system,target=esnext).1.normal.js new file mode 100644 index 000000000000..bb30a21f28ce --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.6(module=system,target=esnext).1.normal.js @@ -0,0 +1,38 @@ +//// [usingDeclarationsWithLegacyClassDecorators.6.ts] +System.register([ + "@swc/helpers/_/_ts_decorate", + "@swc/helpers/_/_dispose", + "@swc/helpers/_/_using" +], function(_export, _context) { + "use strict"; + var _ts_decorate, _dispose, _using; + return { + setters: [ + function(_ts_decorate1) { + _ts_decorate = _ts_decorate1._; + }, + function(_dispose1) { + _dispose = _dispose1._; + }, + function(_using1) { + _using = _using1._; + } + ], + execute: function() { + try { + var _stack = []; + var before = _using(_stack, null); + class C { + } + _export("D", C = _ts_decorate([ + dec + ], C)); + } catch (_) { + var _error = _; + var _hasError = true; + } finally{ + _dispose(_stack, _error, _hasError); + } + } + }; +}); diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.6(module=system,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.6(module=system,target=esnext).2.minified.js new file mode 100644 index 000000000000..4996610bbc1f --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.6(module=system,target=esnext).2.minified.js @@ -0,0 +1,36 @@ +//// [usingDeclarationsWithLegacyClassDecorators.6.ts] +System.register([ + "@swc/helpers/_/_ts_decorate", + "@swc/helpers/_/_dispose", + "@swc/helpers/_/_using" +], function(_export, _context) { + var _ts_decorate, _dispose, _using; + return { + setters: [ + function(_ts_decorate1) { + _ts_decorate = _ts_decorate1._; + }, + function(_dispose1) { + _dispose = _dispose1._; + }, + function(_using1) { + _using = _using1._; + } + ], + execute: function() { + try { + var _stack = []; + _using(_stack, null); + class C { + } + _export("D", C = _ts_decorate([ + dec + ], C)); + } catch (_) { + var _error = _, _hasError = !0; + } finally{ + _dispose(_stack, _error, _hasError); + } + } + }; +}); diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.7(module=commonjs,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.7(module=commonjs,target=esnext).1.normal.js new file mode 100644 index 000000000000..9021d5532f74 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.7(module=commonjs,target=esnext).1.normal.js @@ -0,0 +1,22 @@ +//// [usingDeclarationsWithLegacyClassDecorators.7.ts] +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +const _ts_decorate = require("@swc/helpers/_/_ts_decorate"); +const _dispose = require("@swc/helpers/_/_dispose"); +const _using = require("@swc/helpers/_/_using"); +try { + var _stack = []; + class C { + } + C = _ts_decorate._([ + dec + ], C); + var after = _using._(_stack, null); +} catch (_) { + var _error = _; + var _hasError = true; +} finally{ + _dispose._(_stack, _error, _hasError); +} diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.7(module=commonjs,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.7(module=commonjs,target=esnext).2.minified.js new file mode 100644 index 000000000000..bf84a5632b5a --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.7(module=commonjs,target=esnext).2.minified.js @@ -0,0 +1,17 @@ +//// [usingDeclarationsWithLegacyClassDecorators.7.ts] +Object.defineProperty(exports, "__esModule", { + value: !0 +}); +const _ts_decorate = require("@swc/helpers/_/_ts_decorate"), _dispose = require("@swc/helpers/_/_dispose"), _using = require("@swc/helpers/_/_using"); +try { + var _stack = []; + class C { + } + C = _ts_decorate._([ + dec + ], C), _using._(_stack, null); +} catch (_) { + var _error = _, _hasError = !0; +} finally{ + _dispose._(_stack, _error, _hasError); +} diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.7(module=es6,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.7(module=es6,target=esnext).1.normal.js new file mode 100644 index 000000000000..72a97e8c0f22 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.7(module=es6,target=esnext).1.normal.js @@ -0,0 +1,19 @@ +//// [usingDeclarationsWithLegacyClassDecorators.7.ts] +import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate"; +import { _ as _dispose } from "@swc/helpers/_/_dispose"; +import { _ as _using } from "@swc/helpers/_/_using"; +try { + var _stack = []; + class C { + } + C = _ts_decorate([ + dec + ], C); + var after = _using(_stack, null); +} catch (_) { + var _error = _; + var _hasError = true; +} finally{ + _dispose(_stack, _error, _hasError); +} +export { }; diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.7(module=es6,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.7(module=es6,target=esnext).2.minified.js new file mode 100644 index 000000000000..5d4519141cf5 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.7(module=es6,target=esnext).2.minified.js @@ -0,0 +1,16 @@ +//// [usingDeclarationsWithLegacyClassDecorators.7.ts] +import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate"; +import { _ as _dispose } from "@swc/helpers/_/_dispose"; +import { _ as _using } from "@swc/helpers/_/_using"; +try { + var _stack = []; + class C { + } + C = _ts_decorate([ + dec + ], C), _using(_stack, null); +} catch (_) { + var _error = _, _hasError = !0; +} finally{ + _dispose(_stack, _error, _hasError); +} diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.7(module=system,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.7(module=system,target=esnext).1.normal.js new file mode 100644 index 000000000000..bc8c9f021d29 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.7(module=system,target=esnext).1.normal.js @@ -0,0 +1,38 @@ +//// [usingDeclarationsWithLegacyClassDecorators.7.ts] +System.register([ + "@swc/helpers/_/_ts_decorate", + "@swc/helpers/_/_dispose", + "@swc/helpers/_/_using" +], function(_export, _context) { + "use strict"; + var _ts_decorate, _dispose, _using; + return { + setters: [ + function(_ts_decorate1) { + _ts_decorate = _ts_decorate1._; + }, + function(_dispose1) { + _dispose = _dispose1._; + }, + function(_using1) { + _using = _using1._; + } + ], + execute: function() { + try { + var _stack = []; + class C { + } + C = _ts_decorate([ + dec + ], C); + var after = _using(_stack, null); + } catch (_) { + var _error = _; + var _hasError = true; + } finally{ + _dispose(_stack, _error, _hasError); + } + } + }; +}); diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.7(module=system,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.7(module=system,target=esnext).2.minified.js new file mode 100644 index 000000000000..a24f2db11bfe --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.7(module=system,target=esnext).2.minified.js @@ -0,0 +1,35 @@ +//// [usingDeclarationsWithLegacyClassDecorators.7.ts] +System.register([ + "@swc/helpers/_/_ts_decorate", + "@swc/helpers/_/_dispose", + "@swc/helpers/_/_using" +], function(_export, _context) { + var _ts_decorate, _dispose, _using; + return { + setters: [ + function(_ts_decorate1) { + _ts_decorate = _ts_decorate1._; + }, + function(_dispose1) { + _dispose = _dispose1._; + }, + function(_using1) { + _using = _using1._; + } + ], + execute: function() { + try { + var _stack = []; + class C { + } + C = _ts_decorate([ + dec + ], C), _using(_stack, null); + } catch (_) { + var _error = _, _hasError = !0; + } finally{ + _dispose(_stack, _error, _hasError); + } + } + }; +}); diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=commonjs,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=commonjs,target=esnext).1.normal.js new file mode 100644 index 000000000000..199c2f4579f2 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=commonjs,target=esnext).1.normal.js @@ -0,0 +1,28 @@ +//// [usingDeclarationsWithLegacyClassDecorators.8.ts] +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "C", { + enumerable: true, + get: function() { + return C; + } +}); +const _ts_decorate = require("@swc/helpers/_/_ts_decorate"); +const _dispose = require("@swc/helpers/_/_dispose"); +const _using = require("@swc/helpers/_/_using"); +class C { +} +try { + var _stack = []; + C = _ts_decorate._([ + dec + ], C); + var after = _using._(_stack, null); +} catch (_) { + var _error = _; + var _hasError = true; +} finally{ + _dispose._(_stack, _error, _hasError); +} diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=commonjs,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=commonjs,target=esnext).2.minified.js new file mode 100644 index 000000000000..a21aea63e27d --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=commonjs,target=esnext).2.minified.js @@ -0,0 +1,22 @@ +//// [usingDeclarationsWithLegacyClassDecorators.8.ts] +Object.defineProperty(exports, "__esModule", { + value: !0 +}), Object.defineProperty(exports, "C", { + enumerable: !0, + get: function() { + return C; + } +}); +const _ts_decorate = require("@swc/helpers/_/_ts_decorate"), _dispose = require("@swc/helpers/_/_dispose"), _using = require("@swc/helpers/_/_using"); +class C { +} +try { + var _stack = []; + C = _ts_decorate._([ + dec + ], C), _using._(_stack, null); +} catch (_) { + var _error = _, _hasError = !0; +} finally{ + _dispose._(_stack, _error, _hasError); +} diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=es6,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=es6,target=esnext).1.normal.js new file mode 100644 index 000000000000..6c373ed12a1e --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=es6,target=esnext).1.normal.js @@ -0,0 +1,18 @@ +//// [usingDeclarationsWithLegacyClassDecorators.8.ts] +import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate"; +import { _ as _dispose } from "@swc/helpers/_/_dispose"; +import { _ as _using } from "@swc/helpers/_/_using"; +export class C { +} +try { + var _stack = []; + C = _ts_decorate([ + dec + ], C); + var after = _using(_stack, null); +} catch (_) { + var _error = _; + var _hasError = true; +} finally{ + _dispose(_stack, _error, _hasError); +} diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=es6,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=es6,target=esnext).2.minified.js new file mode 100644 index 000000000000..a3af30389d45 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=es6,target=esnext).2.minified.js @@ -0,0 +1,16 @@ +//// [usingDeclarationsWithLegacyClassDecorators.8.ts] +import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate"; +import { _ as _dispose } from "@swc/helpers/_/_dispose"; +import { _ as _using } from "@swc/helpers/_/_using"; +export class C { +} +try { + var _stack = []; + C = _ts_decorate([ + dec + ], C), _using(_stack, null); +} catch (_) { + var _error = _, _hasError = !0; +} finally{ + _dispose(_stack, _error, _hasError); +} diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=system,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=system,target=esnext).1.normal.js new file mode 100644 index 000000000000..50c063c482ff --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=system,target=esnext).1.normal.js @@ -0,0 +1,39 @@ +//// [usingDeclarationsWithLegacyClassDecorators.8.ts] +System.register([ + "@swc/helpers/_/_ts_decorate", + "@swc/helpers/_/_dispose", + "@swc/helpers/_/_using" +], function(_export, _context) { + "use strict"; + var _ts_decorate, _dispose, _using, C; + _export("C", void 0); + return { + setters: [ + function(_ts_decorate1) { + _ts_decorate = _ts_decorate1._; + }, + function(_dispose1) { + _dispose = _dispose1._; + }, + function(_using1) { + _using = _using1._; + } + ], + execute: function() { + _export("C", C = class C { + }); + try { + var _stack = []; + _export("C", C = _ts_decorate([ + dec + ], C)); + var after = _using(_stack, null); + } catch (_) { + var _error = _; + var _hasError = true; + } finally{ + _dispose(_stack, _error, _hasError); + } + } + }; +}); diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=system,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=system,target=esnext).2.minified.js new file mode 100644 index 000000000000..f2c0c82a426a --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=system,target=esnext).2.minified.js @@ -0,0 +1,35 @@ +//// [usingDeclarationsWithLegacyClassDecorators.8.ts] +System.register([ + "@swc/helpers/_/_ts_decorate", + "@swc/helpers/_/_dispose", + "@swc/helpers/_/_using" +], function(_export, _context) { + var _ts_decorate, _dispose, _using, C; + return _export("C", void 0), { + setters: [ + function(_ts_decorate1) { + _ts_decorate = _ts_decorate1._; + }, + function(_dispose1) { + _dispose = _dispose1._; + }, + function(_using1) { + _using = _using1._; + } + ], + execute: function() { + _export("C", C = class { + }); + try { + var _stack = []; + _export("C", C = _ts_decorate([ + dec + ], C)), _using(_stack, null); + } catch (_) { + var _error = _, _hasError = !0; + } finally{ + _dispose(_stack, _error, _hasError); + } + } + }; +}); diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.9(module=commonjs,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.9(module=commonjs,target=esnext).1.normal.js new file mode 100644 index 000000000000..b23b8ccd8fc3 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.9(module=commonjs,target=esnext).1.normal.js @@ -0,0 +1,28 @@ +//// [usingDeclarationsWithLegacyClassDecorators.9.ts] +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "default", { + enumerable: true, + get: function() { + return C; + } +}); +const _ts_decorate = require("@swc/helpers/_/_ts_decorate"); +const _dispose = require("@swc/helpers/_/_dispose"); +const _using = require("@swc/helpers/_/_using"); +try { + var _stack = []; + var C = class C { + }; + C = _ts_decorate._([ + dec + ], C); + var after = _using._(_stack, null); +} catch (_) { + var _error = _; + var _hasError = true; +} finally{ + _dispose._(_stack, _error, _hasError); +} diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.9(module=commonjs,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.9(module=commonjs,target=esnext).2.minified.js new file mode 100644 index 000000000000..4374fcb711a7 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.9(module=commonjs,target=esnext).2.minified.js @@ -0,0 +1,21 @@ +//// [usingDeclarationsWithLegacyClassDecorators.9.ts] +Object.defineProperty(exports, "__esModule", { + value: !0 +}), Object.defineProperty(exports, "default", { + enumerable: !0, + get: function() { + return C; + } +}); +const _ts_decorate = require("@swc/helpers/_/_ts_decorate"), _dispose = require("@swc/helpers/_/_dispose"), _using = require("@swc/helpers/_/_using"); +try { + var _stack = [], C = class { + }; + C = _ts_decorate._([ + dec + ], C), _using._(_stack, null); +} catch (_) { + var _error = _, _hasError = !0; +} finally{ + _dispose._(_stack, _error, _hasError); +} diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.9(module=es6,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.9(module=es6,target=esnext).1.normal.js new file mode 100644 index 000000000000..65b351dfa8e8 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.9(module=es6,target=esnext).1.normal.js @@ -0,0 +1,19 @@ +//// [usingDeclarationsWithLegacyClassDecorators.9.ts] +import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate"; +import { _ as _dispose } from "@swc/helpers/_/_dispose"; +import { _ as _using } from "@swc/helpers/_/_using"; +export { C as default }; +try { + var _stack = []; + var C = class C { + }; + C = _ts_decorate([ + dec + ], C); + var after = _using(_stack, null); +} catch (_) { + var _error = _; + var _hasError = true; +} finally{ + _dispose(_stack, _error, _hasError); +} diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.9(module=es6,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.9(module=es6,target=esnext).2.minified.js new file mode 100644 index 000000000000..3a03f356c560 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.9(module=es6,target=esnext).2.minified.js @@ -0,0 +1,16 @@ +//// [usingDeclarationsWithLegacyClassDecorators.9.ts] +import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate"; +import { _ as _dispose } from "@swc/helpers/_/_dispose"; +import { _ as _using } from "@swc/helpers/_/_using"; +try { + var _stack = [], C = class { + }; + C = _ts_decorate([ + dec + ], C), _using(_stack, null); +} catch (_) { + var _error = _, _hasError = !0; +} finally{ + _dispose(_stack, _error, _hasError); +} +export { C as default }; diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.9(module=system,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.9(module=system,target=esnext).1.normal.js new file mode 100644 index 000000000000..c1a39246a4af --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.9(module=system,target=esnext).1.normal.js @@ -0,0 +1,38 @@ +//// [usingDeclarationsWithLegacyClassDecorators.9.ts] +System.register([ + "@swc/helpers/_/_ts_decorate", + "@swc/helpers/_/_dispose", + "@swc/helpers/_/_using" +], function(_export, _context) { + "use strict"; + var _ts_decorate, _dispose, _using; + return { + setters: [ + function(_ts_decorate1) { + _ts_decorate = _ts_decorate1._; + }, + function(_dispose1) { + _dispose = _dispose1._; + }, + function(_using1) { + _using = _using1._; + } + ], + execute: function() { + try { + var _stack = []; + var C = class C { + }; + _export("default", C = _ts_decorate([ + dec + ], C)); + var after = _using(_stack, null); + } catch (_) { + var _error = _; + var _hasError = true; + } finally{ + _dispose(_stack, _error, _hasError); + } + } + }; +}); diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.9(module=system,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.9(module=system,target=esnext).2.minified.js new file mode 100644 index 000000000000..3832dfd790c9 --- /dev/null +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.9(module=system,target=esnext).2.minified.js @@ -0,0 +1,34 @@ +//// [usingDeclarationsWithLegacyClassDecorators.9.ts] +System.register([ + "@swc/helpers/_/_ts_decorate", + "@swc/helpers/_/_dispose", + "@swc/helpers/_/_using" +], function(_export, _context) { + var _ts_decorate, _dispose, _using; + return { + setters: [ + function(_ts_decorate1) { + _ts_decorate = _ts_decorate1._; + }, + function(_dispose1) { + _dispose = _dispose1._; + }, + function(_using1) { + _using = _using1._; + } + ], + execute: function() { + try { + var _stack = [], C = class { + }; + _export("default", C = _ts_decorate([ + dec + ], C)), _using(_stack, null); + } catch (_) { + var _error = _, _hasError = !0; + } finally{ + _dispose(_stack, _error, _hasError); + } + } + }; +}); diff --git a/crates/swc_ecma_ast/src/lib.rs b/crates/swc_ecma_ast/src/lib.rs index 3ff976b32d74..75128632909d 100644 --- a/crates/swc_ecma_ast/src/lib.rs +++ b/crates/swc_ecma_ast/src/lib.rs @@ -108,35 +108,36 @@ impl Take for Invalid { #[derive(Debug, Clone, Copy, PartialOrd, Ord, PartialEq, Eq, Hash)] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub enum EsVersion { - #[cfg_attr(feature = "serde", serde(rename = "es3"))] + #[cfg_attr(feature = "serde", serde(rename = "es3", alias = "ES3"))] Es3, - #[cfg_attr(feature = "serde", serde(rename = "es5"))] + #[cfg_attr(feature = "serde", serde(rename = "es5", alias = "ES5"))] Es5, - #[cfg_attr(feature = "serde", serde(rename = "es2015"))] + #[cfg_attr( + feature = "serde", + serde(rename = "es2015", alias = "ES2015", alias = "ES6", alias = "es6") + )] Es2015, - #[cfg_attr(feature = "serde", serde(rename = "es2016"))] + #[cfg_attr(feature = "serde", serde(rename = "es2016", alias = "ES2016"))] Es2016, - #[cfg_attr(feature = "serde", serde(rename = "es2017"))] + #[cfg_attr(feature = "serde", serde(rename = "es2017", alias = "ES2017"))] Es2017, - #[cfg_attr(feature = "serde", serde(rename = "es2018"))] + #[cfg_attr(feature = "serde", serde(rename = "es2018", alias = "ES2018"))] Es2018, - #[cfg_attr(feature = "serde", serde(rename = "es2019"))] + #[cfg_attr(feature = "serde", serde(rename = "es2019", alias = "ES2019"))] Es2019, - #[cfg_attr(feature = "serde", serde(rename = "es2020"))] + #[cfg_attr(feature = "serde", serde(rename = "es2020", alias = "ES2020"))] Es2020, - #[cfg_attr(feature = "serde", serde(rename = "es2021"))] + #[cfg_attr(feature = "serde", serde(rename = "es2021", alias = "ES2021"))] Es2021, - #[cfg_attr(feature = "serde", serde(rename = "es2022"))] + #[cfg_attr(feature = "serde", serde(rename = "es2022", alias = "ES2022"))] Es2022, - #[cfg_attr(feature = "serde", serde(rename = "esnext"))] + #[cfg_attr(feature = "serde", serde(rename = "esnext", alias = "EsNext"))] EsNext, } impl EsVersion { - /// Get the latest version. This is `es2022` for now, but it will be changed - /// if a new version of specification is released. pub const fn latest() -> Self { - EsVersion::Es2022 + EsVersion::EsNext } }