From a7a267c86c3dcfdc1f51bec2801b0677338846e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EB=8F=99=EC=9C=A4=20=28Donny=29?= Date: Tue, 28 May 2024 12:15:41 +0900 Subject: [PATCH 1/9] Add a test --- .../tests/fixture/issues/ts-enum/input.js | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 crates/swc_ecma_minifier/tests/fixture/issues/ts-enum/input.js diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/ts-enum/input.js b/crates/swc_ecma_minifier/tests/fixture/issues/ts-enum/input.js new file mode 100644 index 000000000000..7e170ddf8954 --- /dev/null +++ b/crates/swc_ecma_minifier/tests/fixture/issues/ts-enum/input.js @@ -0,0 +1,8 @@ +var Foo; +(function (Foo) { + Foo[Foo["a"] = 1] = "a"; + Foo[Foo["b"] = 2] = "b"; +})(Foo || (Foo = {})); + + +export { Foo }; \ No newline at end of file From 5e782373d1b8d3249b03516d39274c1169722039 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EB=8F=99=EC=9C=A4=20=28Donny=29?= Date: Tue, 28 May 2024 12:59:17 +0900 Subject: [PATCH 2/9] More test --- .../tests/fixture/issues/ts-enum/{ => basic}/input.js | 0 .../tests/fixture/issues/ts-enum/unused/input.js | 6 ++++++ 2 files changed, 6 insertions(+) rename crates/swc_ecma_minifier/tests/fixture/issues/ts-enum/{ => basic}/input.js (100%) create mode 100644 crates/swc_ecma_minifier/tests/fixture/issues/ts-enum/unused/input.js diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/ts-enum/input.js b/crates/swc_ecma_minifier/tests/fixture/issues/ts-enum/basic/input.js similarity index 100% rename from crates/swc_ecma_minifier/tests/fixture/issues/ts-enum/input.js rename to crates/swc_ecma_minifier/tests/fixture/issues/ts-enum/basic/input.js diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/ts-enum/unused/input.js b/crates/swc_ecma_minifier/tests/fixture/issues/ts-enum/unused/input.js new file mode 100644 index 000000000000..b609648066ad --- /dev/null +++ b/crates/swc_ecma_minifier/tests/fixture/issues/ts-enum/unused/input.js @@ -0,0 +1,6 @@ +var Foo; +(function (Foo) { + Foo[Foo["a"] = 1] = "a"; + Foo[Foo["b"] = 2] = "b"; +})(Foo || (Foo = {})); + From 4c30d9d82dc143ca6659bc16a3c92d27a2890a00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EB=8F=99=EC=9C=A4=20=28Donny=29?= Date: Tue, 28 May 2024 13:03:21 +0900 Subject: [PATCH 3/9] `optimize_ts_enum_init` --- crates/swc_ecma_minifier/src/compress/optimize/inline.rs | 7 +++++++ crates/swc_ecma_minifier/src/compress/optimize/mod.rs | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/crates/swc_ecma_minifier/src/compress/optimize/inline.rs b/crates/swc_ecma_minifier/src/compress/optimize/inline.rs index bafad07387cc..3973589cfbce 100644 --- a/crates/swc_ecma_minifier/src/compress/optimize/inline.rs +++ b/crates/swc_ecma_minifier/src/compress/optimize/inline.rs @@ -891,6 +891,13 @@ impl Optimizer<'_> { _ => (), } } + + /// Optimizes + /// ```ts + /// var Foo; + /// Foo || (Foo = {} + /// ``` + pub(super) fn optimize_ts_enum_init(&mut self, e: &mut Expr) {} } fn is_arrow_simple_enough_for_copy(e: &ArrowExpr) -> bool { diff --git a/crates/swc_ecma_minifier/src/compress/optimize/mod.rs b/crates/swc_ecma_minifier/src/compress/optimize/mod.rs index 09556b6c356d..626730fc3a89 100644 --- a/crates/swc_ecma_minifier/src/compress/optimize/mod.rs +++ b/crates/swc_ecma_minifier/src/compress/optimize/mod.rs @@ -1830,6 +1830,12 @@ impl VisitMut for Optimizer<'_> { debug_assert_valid(e); } + self.optimize_ts_enum_init(e); + + if e.is_seq() { + debug_assert_valid(e); + } + self.optimize_str_access_to_arguments(e); if e.is_seq() { From 89e606113c2abfa035510bcb1b31dae7124c1ff5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EB=8F=99=EC=9C=A4=20=28Donny=29?= Date: Tue, 28 May 2024 13:09:28 +0900 Subject: [PATCH 4/9] Implement `optimize_ts_enum_init` --- .../src/compress/optimize/inline.rs | 57 ++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/crates/swc_ecma_minifier/src/compress/optimize/inline.rs b/crates/swc_ecma_minifier/src/compress/optimize/inline.rs index 3973589cfbce..9d428572e6d3 100644 --- a/crates/swc_ecma_minifier/src/compress/optimize/inline.rs +++ b/crates/swc_ecma_minifier/src/compress/optimize/inline.rs @@ -1,3 +1,5 @@ +use std::convert::Infallible; + use rustc_hash::FxHashMap; use swc_common::{collections::AHashSet, util::take::Take, EqIgnoreSpan, Mark, Spanned}; use swc_ecma_ast::*; @@ -897,7 +899,60 @@ impl Optimizer<'_> { /// var Foo; /// Foo || (Foo = {} /// ``` - pub(super) fn optimize_ts_enum_init(&mut self, e: &mut Expr) {} + pub(super) fn optimize_ts_enum_init(&mut self, e: &mut Expr) -> Option { + if !self.options.reduce_vars { + return None; + } + + let bin = match e { + Expr::Bin(bin @ BinExpr { op: op!("||"), .. }) => bin, + _ => return None, + }; + + let lhs = bin.left.as_ident()?; + + let rhs = match &mut *bin.right { + Expr::Assign(a @ AssignExpr { op: op!("="), .. }) => a, + _ => return None, + }; + + if !self.may_remove_ident(lhs) { + return None; + } + + { + let usage = self.data.vars.get(&lhs.to_id())?; + + if !usage.declared { + return None; + } + } + + if let Expr::Object(obj) = &*rhs.right { + if !obj.props.is_empty() { + return None; + } + } else { + return None; + } + + let rhs_left = rhs.left.as_ident()?; + + if !lhs.eq_ignore_span(rhs_left) { + return None; + } + + self.changed = true; + report_change!("inline: Removed `||` operator"); + *e = Expr::Assign(AssignExpr { + span: rhs.span, + op: op!("="), + left: lhs.clone().into(), + right: rhs.right.take(), + }); + + None + } } fn is_arrow_simple_enough_for_copy(e: &ArrowExpr) -> bool { From 409cb143f89fa854a8b34cbf088b861bbaedb761 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EB=8F=99=EC=9C=A4=20=28Donny=29?= Date: Tue, 28 May 2024 13:10:33 +0900 Subject: [PATCH 5/9] assign count --- crates/swc_ecma_minifier/src/compress/optimize/inline.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/swc_ecma_minifier/src/compress/optimize/inline.rs b/crates/swc_ecma_minifier/src/compress/optimize/inline.rs index 9d428572e6d3..539347c3c901 100644 --- a/crates/swc_ecma_minifier/src/compress/optimize/inline.rs +++ b/crates/swc_ecma_minifier/src/compress/optimize/inline.rs @@ -926,6 +926,9 @@ impl Optimizer<'_> { if !usage.declared { return None; } + if usage.assign_count != 1 { + return None; + } } if let Expr::Object(obj) = &*rhs.right { From 9b7bb1c8028dd04204d10e9cfd23bb9e15b450ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EB=8F=99=EC=9C=A4=20=28Donny=29?= Date: Tue, 28 May 2024 13:13:16 +0900 Subject: [PATCH 6/9] Update test refs --- ...assWithSameNameAndCommonRoot.2.minified.js | 4 - ...portedFunctionThatShareAName.2.minified.js | 4 +- ...portedFunctionThatShareAName.2.minified.js | 4 +- ...AndExportedVarThatShareAName.2.minified.js | 4 +- ...NonExportedVarThatShareAName.2.minified.js | 4 +- ...uleWithSameNameAndCommonRoot.2.minified.js | 8 +- ...WithSameNameAndCommonRootES6.2.minified.js | 8 +- .../ES5SymbolProperty2.2.minified.js | 2 +- ...nterfaceWithInaccessibleType.2.minified.js | 6 +- ...ageListMemberTypeAnnotations.2.minified.js | 10 +- ...TypeInIndexerTypeAnnotations.2.minified.js | 4 - ...ypeInTypeParameterConstraint.2.minified.js | 8 +- ...meterAndReturnTypeAnnotation.2.minified.js | 6 +- ...pesInParameterTypeAnnotation.2.minified.js | 6 +- ...eTypesInReturnTypeAnnotation.2.minified.js | 6 +- ...ageListMemberTypeAnnotations.2.minified.js | 6 +- ...ypeInTypeParameterConstraint.2.minified.js | 6 +- ...bleTypesOnItsExportedMembers.2.minified.js | 6 +- ...TypesInMemberTypeAnnotations.2.minified.js | 8 +- ...nNestedMemberTypeAnnotations.2.minified.js | 2 - ...accessibleTypeAsTypeArgument.2.minified.js | 2 - ...cessibleTypeInTypeAnnotation.2.minified.js | 5 - ...cessibleTypeInTypeAnnotation.2.minified.js | 6 +- ...uleWithSameNameAndCommonRoot.2.minified.js | 13 +- ...meNameAndDifferentCommonRoot.2.minified.js | 11 +- ...assWithSameNameAndCommonRoot.2.minified.js | 8 +- ...ionWithSameNameAndCommonRoot.2.minified.js | 14 +- ...xportedAndNonExportedClasses.2.minified.js | 2 +- ...hExportedAndNonExportedEnums.2.minified.js | 4 +- ...ortedAndNonExportedFunctions.2.minified.js | 2 +- ...tedAndNonExportedImportAlias.2.minified.js | 8 +- ...ortedAndNonExportedVariables.2.minified.js | 2 +- ...portedLocalVarsOfTheSameName.2.minified.js | 10 +- ...ExportedModulesOfTheSameName.2.minified.js | 8 +- ...meNameAndDifferentCommonRoot.2.minified.js | 8 +- ...TheSameNameAndSameCommonRoot.2.minified.js | 10 +- .../TypeGuardWithEnumUnion.2.minified.js | 4 +- ...nOperatorWithAnyAndEveryType.2.minified.js | 4 +- ...nOperatorWithInvalidOperands.2.minified.js | 4 +- ...ithNullValueAndValidOperator.2.minified.js | 4 +- ...ionOperatorWithNumberAndEnum.2.minified.js | 4 +- ...eratorWithStringAndEveryType.2.minified.js | 4 +- ...ionOperatorWithTypeParameter.2.minified.js | 4 +- ...definedValueAndValidOperator.2.minified.js | 4 +- .../ambientInsideNonAmbient.2.minified.js | 2 - ...amdImportAsPrimaryExpression.2.minified.js | 2 +- ...ImportNotAsPrimaryExpression.2.minified.js | 2 +- ...nyAssignabilityInInheritance.2.minified.js | 4 +- .../anyAssignableToEveryType.2.minified.js | 4 +- .../anyAssignableToEveryType2.2.minified.js | 4 +- .../arithmeticOperatorWithEnum.2.minified.js | 4 +- ...thmeticOperatorWithEnumUnion.2.minified.js | 4 +- ...cOperatorWithInvalidOperands.2.minified.js | 4 +- ...ingAsAmbientExternalModule02.2.minified.js | 2 - ...PreventsParsingAsNamespace05.2.minified.js | 4 +- ...PreventsParsingAsTypeAlias02.2.minified.js | 2 - .../assignAnyToEveryType.2.minified.js | 4 +- .../assignEveryTypeToAny.2.minified.js | 4 +- ...entCompatWithCallSignatures4.2.minified.js | 2 - ...mpatWithConstructSignatures4.2.minified.js | 2 - ...CompatWithDiscriminatedUnion.2.minified.js | 6 +- ...ignmentCompatWithEnumIndexer.2.minified.js | 4 +- ...aturesWithOptionalParameters.2.minified.js | 2 - ...mentCompatWithNumericIndexer.2.minified.js | 2 - ...entCompatWithNumericIndexer2.2.minified.js | 2 - ...entCompatWithNumericIndexer3.2.minified.js | 2 - ...nmentCompatWithObjectMembers.2.minified.js | 4 +- ...mentCompatWithObjectMembers4.2.minified.js | 6 +- ...WithObjectMembersOptionality.2.minified.js | 4 +- ...ithObjectMembersOptionality2.2.minified.js | 4 +- ...ectMembersStringNumericNames.2.minified.js | 2 - ...nmentCompatWithStringIndexer.2.minified.js | 2 - ...mentCompatWithStringIndexer2.2.minified.js | 2 - ...mentCompatWithStringIndexer3.2.minified.js | 2 - ...ntToParenthesizedIdentifiers.2.minified.js | 6 +- ...cAwaitIsolatedModules_es2017.2.minified.js | 3 +- ...syncAwaitIsolatedModules_es5.2.minified.js | 3 +- ...syncAwaitIsolatedModules_es6.2.minified.js | 3 +- .../asyncAwait_es2017.2.minified.js | 3 +- .../asyncAwait_es5.2.minified.js | 3 +- .../asyncAwait_es6.2.minified.js | 3 +- .../bestCommonTypeOfTuple.2.minified.js | 4 +- ...seNotOperatorWithBooleanType.2.minified.js | 2 +- ...twiseNotOperatorWithEnumType.2.minified.js | 4 +- ...iseNotOperatorWithNumberType.2.minified.js | 2 +- ...iseNotOperatorWithStringType.2.minified.js | 2 +- ...eAssignabilityInInheritance3.2.minified.js | 2 - ...eturnTypeAnnotationInference.2.minified.js | 4 +- .../tsc-references/castingTuple.2.minified.js | 4 +- .../circularImportAlias.2.minified.js | 4 +- ...sAbstractImportInstantiation.2.minified.js | 2 +- .../classAbstractInAModule.2.minified.js | 2 +- ...lassAndInterfaceWithSameName.2.minified.js | 2 - ...lassConstructorAccessibility.2.minified.js | 3 +- ...DoesNotDependOnPrivateMember.2.minified.js | 4 - .../classExpression.2.minified.js | 2 - ...lassExtendsItselfIndirectly2.2.minified.js | 12 +- ...sShadowedConstructorFunction.2.minified.js | 2 - .../classWithConstructors.2.minified.js | 6 +- ...ImportNotAsPrimaryExpression.2.minified.js | 2 +- ...hNoRelationshipPrimitiveType.2.minified.js | 4 +- ...hNoRelationshipTypeParameter.2.minified.js | 4 +- ...nOperatorWithOneOperandIsAny.2.minified.js | 4 +- ...torWithOneOperandIsUndefined.2.minified.js | 4 +- ...atorWithSubtypeEnumAndNumber.2.minified.js | 4 +- ...onAssignmentLHSCanBeAssigned.2.minified.js | 4 +- ...ssignmentLHSCannotBeAssigned.2.minified.js | 4 +- ...ssignmentWithInvalidOperands.2.minified.js | 4 +- .../computedPropertyNames19_ES5.2.minified.js | 3 +- .../computedPropertyNames19_ES6.2.minified.js | 3 +- .../computedPropertyNames47_ES5.2.minified.js | 4 +- .../computedPropertyNames47_ES6.2.minified.js | 4 +- .../computedPropertyNames48_ES5.2.minified.js | 4 +- .../computedPropertyNames48_ES6.2.minified.js | 4 +- .../computedPropertyNames7_ES5.2.minified.js | 4 +- .../computedPropertyNames7_ES6.2.minified.js | 4 +- .../tsc-references/constEnum2.2.minified.js | 4 +- ...reAssignabilityInInheritance.2.minified.js | 3 +- ...eAssignabilityInInheritance3.2.minified.js | 2 - ...structorHasPrototypeProperty.2.minified.js | 6 +- .../declarationsAndAssignments.2.minified.js | 4 +- .../decoratorOnClassMethod11.2.minified.js | 3 +- .../decoratorOnClassMethod12.2.minified.js | 4 +- ...mentOperatorWithAnyOtherType.2.minified.js | 2 +- ...ecrementOperatorWithEnumType.2.minified.js | 2 +- ...rementOperatorWithNumberType.2.minified.js | 2 +- ...rnAndAssignment7(target=es5).2.minified.js | 4 +- ...ndAssignment7(target=esnext).2.minified.js | 4 +- ...ringParameterDeclaration3ES5.2.minified.js | 4 +- ...meterDeclaration3ES5iterable.2.minified.js | 4 +- ...ringParameterDeclaration3ES6.2.minified.js | 4 +- .../duplicateStringIndexers.2.minified.js | 2 - .../enumAssignability.2.minified.js | 4 +- ...umAssignabilityInInheritance.2.minified.js | 4 +- .../tsc-references/enumBasics.2.minified.js | 5 +- .../enumClassification.2.minified.js | 4 +- ...enumConstantMemberWithString.2.minified.js | 4 +- ...berWithStringEmitDeclaration.2.minified.js | 4 +- ...ntMemberWithTemplateLiterals.2.minified.js | 4 +- ...plateLiteralsEmitDeclaration.2.minified.js | 4 +- ...tASubtypeOfAnythingButNumber.2.minified.js | 4 +- .../tsc-references/enumMerging.2.minified.js | 4 +- .../tests/tsc-references/enums.2.minified.js | 4 +- .../equalityWithEnumTypes.2.minified.js | 4 +- .../everyTypeAssignableToAny.2.minified.js | 4 +- ...WithAnnotationAndInitializer.2.minified.js | 2 +- ...otationAndInvalidInitializer.2.minified.js | 6 +- .../everyTypeWithInitializer.2.minified.js | 2 +- .../exhaustiveSwitchStatements1.2.minified.js | 4 +- ...ponentiationOperatorWithEnum.2.minified.js | 4 +- ...tiationOperatorWithEnumUnion.2.minified.js | 4 +- ...nOperatorWithInvalidOperands.2.minified.js | 4 +- ...portAssignmentAndDeclaration.2.minified.js | 4 +- ...ortAssignmentCircularModules.2.minified.js | 6 +- ...AssignmentTopLevelIdentifier.2.minified.js | 2 +- .../exportCodeGen.2.minified.js | 8 +- .../exportImportAlias.2.minified.js | 8 +- .../exportsAndImports1-amd.2.minified.js | 4 +- .../exportsAndImports1-es6.2.minified.js | 4 +- .../exportsAndImports1.2.minified.js | 4 +- .../exportsAndImports3-amd.2.minified.js | 4 +- .../exportsAndImports3-es6.2.minified.js | 4 +- .../exportsAndImports3.2.minified.js | 4 +- .../filterNamespace_import.2.minified.js | 2 +- .../for-inStatements.2.minified.js | 4 +- .../tsc-references/for-of47.2.minified.js | 4 +- .../tsc-references/for-of48.2.minified.js | 4 +- .../forStatements.2.minified.js | 2 +- ...tatementsMultipleInvalidDecl.2.minified.js | 2 +- .../tsc-references/forgottenNew.2.minified.js | 2 +- ...nExpressionContextualTyping1.2.minified.js | 4 +- .../generatedContextualTyping.2.minified.js | 59 +--- .../generatorInAmbientContext6.2.minified.js | 2 - .../generatorOverloads5.2.minified.js | 2 - ...generatorYieldContextualType.2.minified.js | 4 +- ...ethodWithOverloadedArguments.2.minified.js | 3 +- ...thGenericSignatureArguments2.2.minified.js | 4 +- ...thGenericSignatureArguments3.2.minified.js | 4 +- ...dedConstructorTypedArguments.2.minified.js | 4 +- ...edConstructorTypedArguments2.2.minified.js | 2 - ...loadedFunctionTypedArguments.2.minified.js | 2 - ...oadedFunctionTypedArguments2.2.minified.js | 2 - ...FunctionTypedMemberArguments.2.minified.js | 6 +- ...ObjectTypeArgsAndConstraints.2.minified.js | 4 +- .../genericSetterInClassType.2.minified.js | 4 +- .../globalThisAmbientModules.2.minified.js | 2 - .../heterogeneousArrayLiterals.2.minified.js | 4 +- .../ifDoWhileStatements.2.minified.js | 6 +- ...eExtendingClassWithPrivates2.2.minified.js | 4 +- .../importAliasIdentifiers.2.minified.js | 5 +- .../importNonExternalModule.2.minified.js | 5 +- .../importStatements.2.minified.js | 8 +- .../importStatementsInterfaces.2.minified.js | 5 +- ...mentOperatorWithAnyOtherType.2.minified.js | 2 +- ...ncrementOperatorWithEnumType.2.minified.js | 2 +- ...rementOperatorWithNumberType.2.minified.js | 2 +- ...ertiesInheritedIntoClassType.2.minified.js | 6 +- .../instancePropertyInClassType.2.minified.js | 6 +- .../instantiatedModule.2.minified.js | 11 +- ...rfaceWithPropertyOfEveryType.2.minified.js | 4 +- .../invalidAssignmentsToVoid.2.minified.js | 2 - .../invalidBooleanAssignments.2.minified.js | 4 +- .../invalidEnumAssignments.2.minified.js | 4 +- ...nvalidImportAliasIdentifiers.2.minified.js | 4 +- ...MultipleVariableDeclarations.2.minified.js | 2 +- .../invalidNumberAssignments.2.minified.js | 2 - .../invalidStringAssignments.2.minified.js | 4 +- .../invalidUndefinedAssignments.2.minified.js | 4 +- .../invalidUndefinedValues.2.minified.js | 4 +- .../invalidVoidAssignments.2.minified.js | 4 +- .../invalidVoidValues.2.minified.js | 4 +- .../keyofAndIndexedAccess.2.minified.js | 4 +- .../literalTypeWidening.2.minified.js | 4 +- .../literalTypes2.2.minified.js | 4 +- ...lNotOperatorWithAnyOtherType.2.minified.js | 2 +- ...alNotOperatorWithBooleanType.2.minified.js | 2 +- ...gicalNotOperatorWithEnumType.2.minified.js | 4 +- ...calNotOperatorWithNumberType.2.minified.js | 2 +- ...calNotOperatorWithStringType.2.minified.js | 2 +- ...ypeOverlappingStringEnumKeys.2.minified.js | 4 +- .../mergeThreeInterfaces.2.minified.js | 4 +- .../mergeTwoInterfaces.2.minified.js | 4 +- ...rfacesWithInheritedPrivates3.2.minified.js | 2 - ...dInterfacesWithMultipleBases.2.minified.js | 4 +- ...InterfacesWithMultipleBases2.2.minified.js | 4 +- ...uleWithStatementsOfEveryKind.2.minified.js | 16 +- .../nameCollision.2.minified.js | 4 +- .../nameWithRelativePaths.2.minified.js | 2 +- ...egateOperatorWithBooleanType.2.minified.js | 2 +- .../negateOperatorWithEnumType.2.minified.js | 4 +- ...negateOperatorWithNumberType.2.minified.js | 2 +- ...negateOperatorWithStringType.2.minified.js | 2 +- .../nestedModules.2.minified.js | 4 +- .../noUncheckedIndexedAccess.2.minified.js | 4 +- ...peReferenceWithTypeArguments.2.minified.js | 2 - .../nonInstantiatedModule.2.minified.js | 7 +- .../nullAssignableToEveryType.2.minified.js | 4 +- ...typeOfEverythingButUndefined.2.minified.js | 4 +- .../numberAssignableToEnum.2.minified.js | 4 +- .../objectTypesIdentity2.2.minified.js | 4 +- .../tsc-references/parserEnum6.2.minified.js | 4 +- .../parserEnumDeclaration1.2.minified.js | 4 +- .../parserEnumDeclaration5.2.minified.js | 4 +- .../parserEnumDeclaration6.2.minified.js | 4 +- ...ry_IncompleteMemberVariable1.2.minified.js | 2 +- ...parserInterfaceKeywordInEnum.2.minified.js | 4 +- ...arserInterfaceKeywordInEnum1.2.minified.js | 4 +- .../parserRealSource1.2.minified.js | 12 +- .../parserRealSource12.2.minified.js | 10 +- .../parserRealSource13.2.minified.js | 6 +- .../parserRealSource14.2.minified.js | 3 +- .../parserRealSource2.2.minified.js | 8 +- .../parserRealSource3.2.minified.js | 4 +- .../parserRealSource5.2.minified.js | 8 +- .../parserRealSource6.2.minified.js | 3 +- .../parserRealSource8.2.minified.js | 3 +- .../parserSuperExpression1.2.minified.js | 4 +- .../parserSuperExpression4.2.minified.js | 4 +- .../parserindenter.2.minified.js | 6 +- .../plusOperatorWithBooleanType.2.minified.js | 2 +- .../plusOperatorWithEnumType.2.minified.js | 4 +- .../plusOperatorWithNumberType.2.minified.js | 2 +- .../plusOperatorWithStringType.2.minified.js | 2 +- .../primtiveTypesAreIdentical.2.minified.js | 4 +- .../propertyAccess.2.minified.js | 4 +- ...propertyNamesOfReservedWords.2.minified.js | 4 +- .../scopeResolutionIdentifiers.2.minified.js | 2 - ...staticPropertyNotInClassType.2.minified.js | 6 +- ...strictPropertyInitialization.2.minified.js | 4 +- .../stringEnumInElementAccess01.2.minified.js | 4 +- ...LiteralTypeIsSubtypeOfString.2.minified.js | 4 +- ...tringLiteralTypesOverloads01.2.minified.js | 6 +- ...tringLiteralTypesOverloads02.2.minified.js | 6 +- .../subtypesOfAny.2.minified.js | 4 +- .../subtypesOfTypeParameter.2.minified.js | 4 +- ...ypeParameterWithConstraints2.2.minified.js | 4 +- ...eterWithRecursiveConstraints.2.minified.js | 2 - .../subtypesOfUnion.2.minified.js | 4 +- .../subtypingWithCallSignatures.2.minified.js | 3 +- ...subtypingWithCallSignatures3.2.minified.js | 5 +- ...ypingWithConstructSignatures.2.minified.js | 4 +- ...pingWithConstructSignatures3.2.minified.js | 4 +- .../subtypingWithNumericIndexer.2.minified.js | 2 - ...subtypingWithNumericIndexer3.2.minified.js | 2 - ...subtypingWithNumericIndexer4.2.minified.js | 2 - ...subtypingWithNumericIndexer5.2.minified.js | 2 - .../subtypingWithObjectMembers.2.minified.js | 2 - .../subtypingWithObjectMembers5.2.minified.js | 2 - ...hObjectMembersAccessibility2.2.minified.js | 2 - ...WithObjectMembersOptionality.2.minified.js | 2 - .../subtypingWithStringIndexer.2.minified.js | 2 - .../subtypingWithStringIndexer3.2.minified.js | 2 - .../subtypingWithStringIndexer4.2.minified.js | 2 - ...taticMembers1(target=es2015).2.minified.js | 9 +- ...taticMembers1(target=es2021).2.minified.js | 9 +- ...taticMembers1(target=es2022).2.minified.js | 10 +- ...InStaticMembers1(target=es5).2.minified.js | 12 +- ...taticMembers1(target=esnext).2.minified.js | 10 +- .../switchStatements.2.minified.js | 2 +- .../symbolDeclarationEmit12.2.minified.js | 4 +- .../symbolProperty48.2.minified.js | 3 +- .../symbolProperty49.2.minified.js | 3 +- .../symbolProperty50.2.minified.js | 2 - .../symbolProperty51.2.minified.js | 2 - .../symbolProperty55.2.minified.js | 3 +- .../symbolProperty56.2.minified.js | 3 +- .../tsc-references/symbolType19.2.minified.js | 2 - .../thisTypeErrors.2.minified.js | 3 +- .../throwStatements.2.minified.js | 6 +- .../tsxElementResolution.2.minified.js | 2 +- .../tsxElementResolution7.2.minified.js | 4 +- ...nterfacesDifferentRootModule.2.minified.js | 4 +- ...terfacesDifferentRootModule2.2.minified.js | 4 +- ...facesWithDifferingOverloads2.2.minified.js | 4 +- .../tsc-references/typeAliases.2.minified.js | 4 +- ...ntInferenceWithObjectLiteral.2.minified.js | 4 +- ...entsWithStringLiteralTypes01.2.minified.js | 4 +- ...typeFromPropertyAssignment29.2.minified.js | 4 +- .../typeGuardEnums.2.minified.js | 2 - ...ardsInFunctionAndModuleBlock.2.minified.js | 4 +- .../typeGuardsInModule.2.minified.js | 4 +- ...peOfThisInFunctionExpression.2.minified.js | 2 - .../typeOnlyMerge3.2.minified.js | 2 +- .../typeofANonExportedType.2.minified.js | 6 +- .../typeofModuleWithoutExports.2.minified.js | 2 - ...peofOperatorWithAnyOtherType.2.minified.js | 2 +- ...ypeofOperatorWithBooleanType.2.minified.js | 2 +- .../typeofOperatorWithEnumType.2.minified.js | 4 +- ...typeofOperatorWithNumberType.2.minified.js | 2 +- ...typeofOperatorWithStringType.2.minified.js | 2 +- .../tsc-references/typeofThis.2.minified.js | 2 - ...definedAssignableToEveryType.2.minified.js | 4 +- ...definedIsSubtypeOfEverything.2.minified.js | 4 +- ...veryConstituentTypeIsSubtype.2.minified.js | 4 +- .../tsc-references/unknownType2.2.minified.js | 4 +- .../useObjectValuesAndEntries1.2.minified.js | 2 +- ...eclarations.1(target=es2015).2.minified.js | 4 +- ...eclarations.1(target=es2017).2.minified.js | 4 +- ...eclarations.1(target=es2022).2.minified.js | 4 +- ...ngDeclarations.1(target=es5).2.minified.js | 4 +- ...eclarations.1(target=esnext).2.minified.js | 4 +- .../validEnumAssignments.2.minified.js | 4 +- .../validNullAssignments.2.minified.js | 4 +- .../validNumberAssignments.2.minified.js | 4 +- .../valuesMergingAcrossModules.2.minified.js | 2 +- ...leSyntaxInternalImportEquals.2.minified.js | 2 +- ...atimModuleSyntaxNoElisionCJS.2.minified.js | 2 +- ...mModuleSyntaxRestrictionsCJS.2.minified.js | 4 +- ...voidOperatorWithAnyOtherType.2.minified.js | 2 +- .../voidOperatorWithBooleanType.2.minified.js | 2 +- .../voidOperatorWithEnumType.2.minified.js | 4 +- .../voidOperatorWithNumberType.2.minified.js | 2 +- .../voidOperatorWithStringType.2.minified.js | 2 +- .../tsc-references/witness.2.minified.js | 4 +- .../tests/benches-full/jquery.js | 2 +- .../tests/benches-full/lodash.js | 2 +- .../tests/benches-full/terser.js | 4 +- .../tests/benches-full/victory.js | 2 +- .../tests/benches-full/vue.js | 2 +- .../tests/fixture/issues/6628/output.js | 2 +- .../fixture/issues/firebase-core/1/output.js | 2 +- .../issues/firebase-firestore/1/output.js | 2 +- .../fixture/issues/quagga2/1.4.2/1/output.js | 4 +- .../fixture/issues/ts-enum/basic/output.js | 3 + .../fixture/issues/ts-enum/unused/output.js | 2 + .../fixture/issues/typescript/1/output.js | 280 +++++++++--------- .../next/feedback-2/codemirror/output.js | 2 +- .../8a28b14e.d8fbda268ed281a1/output.js | 2 +- .../fixture/next/react-pdf-renderer/output.js | 4 +- .../syncfusion/933-e9f9a6bf671b96fc/output.js | 12 +- .../fixture/next/wrap-contracts/output.js | 6 +- .../fixture/projects/backbone/16/output.js | 4 +- .../fixture/projects/underscore/8/output.js | 2 +- .../tests/fixture/reduced/1/output.js | 4 +- .../tests/projects/output/backbone-1.1.0.js | 18 +- .../tests/projects/output/jquery-1.9.1.js | 2 +- .../tests/projects/output/underscore-1.5.2.js | 2 +- .../tests/projects/output/yui-3.12.0.js | 2 +- 378 files changed, 788 insertions(+), 1049 deletions(-) create mode 100644 crates/swc_ecma_minifier/tests/fixture/issues/ts-enum/basic/output.js create mode 100644 crates/swc_ecma_minifier/tests/fixture/issues/ts-enum/unused/output.js diff --git a/crates/swc/tests/tsc-references/AmbientModuleAndNonAmbientClassWithSameNameAndCommonRoot.2.minified.js b/crates/swc/tests/tsc-references/AmbientModuleAndNonAmbientClassWithSameNameAndCommonRoot.2.minified.js index 5d1299b45041..915991143645 100644 --- a/crates/swc/tests/tsc-references/AmbientModuleAndNonAmbientClassWithSameNameAndCommonRoot.2.minified.js +++ b/crates/swc/tests/tsc-references/AmbientModuleAndNonAmbientClassWithSameNameAndCommonRoot.2.minified.js @@ -1,9 +1,5 @@ //// [module.d.ts] //// [classPoint.ts] -var A; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -(A || (A = {})).Point = function Point(x, y) { - _class_call_check(this, Point), this.x = x, this.y = y; -}; //// [test.ts] A.Point.Origin, new A.Point(0, 0); diff --git a/crates/swc/tests/tsc-references/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.2.minified.js b/crates/swc/tests/tsc-references/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.2.minified.js index 9425592826c9..62b6bd612ccb 100644 --- a/crates/swc/tests/tsc-references/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.2.minified.js +++ b/crates/swc/tests/tsc-references/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.2.minified.js @@ -1,6 +1,6 @@ //// [ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.ts] import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -var A, Point, A1, Point1 = function() { +var A, Point, Point1 = function() { function Point(x, y) { _class_call_check(this, Point), this.x = x, this.y = y; } @@ -13,7 +13,7 @@ var A, Point, A1, Point1 = function() { }(); (Point1 || (Point1 = {})).Origin = function() { return null; -}, A = A1 || (A1 = {}), Point = function() { +}, A = {}, Point = function() { function Point(x, y) { _class_call_check(this, Point), this.x = x, this.y = y; } diff --git a/crates/swc/tests/tsc-references/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.2.minified.js b/crates/swc/tests/tsc-references/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.2.minified.js index 7f6480df768f..21e924b4b1b8 100644 --- a/crates/swc/tests/tsc-references/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.2.minified.js +++ b/crates/swc/tests/tsc-references/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.2.minified.js @@ -1,6 +1,6 @@ //// [ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.ts] import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -var A, Point, A1, Point1 = function() { +var A, Point, Point1 = function() { function Point(x, y) { _class_call_check(this, Point), this.x = x, this.y = y; } @@ -11,7 +11,7 @@ var A, Point, A1, Point1 = function() { }; }, Point; }(); -Point1 || (Point1 = {}), A = A1 || (A1 = {}), Point = function() { +Point1 || (Point1 = {}), A = {}, Point = function() { function Point(x, y) { _class_call_check(this, Point), this.x = x, this.y = y; } diff --git a/crates/swc/tests/tsc-references/ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.2.minified.js b/crates/swc/tests/tsc-references/ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.2.minified.js index e4c948b4f7b1..31b7e7114e70 100644 --- a/crates/swc/tests/tsc-references/ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.2.minified.js +++ b/crates/swc/tests/tsc-references/ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.2.minified.js @@ -1,12 +1,12 @@ //// [ClassAndModuleThatMergeWithStaticVariableAndExportedVarThatShareAName.ts] import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -var A, Point, A1, Point1 = function Point(x, y) { +var A, Point, Point1 = function Point(x, y) { _class_call_check(this, Point), this.x = x, this.y = y; }; Point1.Origin = { x: 0, y: 0 -}, (Point1 || (Point1 = {})).Origin = "", A = A1 || (A1 = {}), (Point = function Point(x, y) { +}, (Point1 || (Point1 = {})).Origin = "", A = {}, (Point = function Point(x, y) { _class_call_check(this, Point), this.x = x, this.y = y; }).Origin = { x: 0, diff --git a/crates/swc/tests/tsc-references/ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.2.minified.js b/crates/swc/tests/tsc-references/ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.2.minified.js index fc2719fbdaec..797e07c5ddb4 100644 --- a/crates/swc/tests/tsc-references/ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.2.minified.js +++ b/crates/swc/tests/tsc-references/ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.2.minified.js @@ -1,12 +1,12 @@ //// [ClassAndModuleThatMergeWithStaticVariableAndNonExportedVarThatShareAName.ts] import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -var A, Point, A1, Point1 = function Point(x, y) { +var A, Point, Point1 = function Point(x, y) { _class_call_check(this, Point), this.x = x, this.y = y; }; Point1.Origin = { x: 0, y: 0 -}, Point1 || (Point1 = {}), A = A1 || (A1 = {}), (Point = function Point(x, y) { +}, Point1 || (Point1 = {}), A = {}, (Point = function Point(x, y) { _class_call_check(this, Point), this.x = x, this.y = y; }).Origin = { x: 0, diff --git a/crates/swc/tests/tsc-references/ClassAndModuleWithSameNameAndCommonRoot.2.minified.js b/crates/swc/tests/tsc-references/ClassAndModuleWithSameNameAndCommonRoot.2.minified.js index a3dc5dfde8a0..1e68da26279b 100644 --- a/crates/swc/tests/tsc-references/ClassAndModuleWithSameNameAndCommonRoot.2.minified.js +++ b/crates/swc/tests/tsc-references/ClassAndModuleWithSameNameAndCommonRoot.2.minified.js @@ -1,12 +1,12 @@ //// [class.ts] -var X, X1; +var X; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -((X1 = X || (X = {})).Y || (X1.Y = {})).Point = function Point(x, y) { +((X = {}).Y || (X.Y = {})).Point = function Point(x, y) { _class_call_check(this, Point), this.x = x, this.y = y; }; //// [module.ts] -var X, X1, Y, Point; -(Point = (Y = (X1 = X || (X = {})).Y || (X1.Y = {})).Point || (Y.Point = {})).Origin = new Point(0, 0); +var X, Y, Point; +(Point = (Y = (X = {}).Y || (X.Y = {})).Point || (Y.Point = {})).Origin = new Point(0, 0); //// [test.ts] new X.Y.Point(1, 1), X.Y.Point.Origin; //// [simple.ts] diff --git a/crates/swc/tests/tsc-references/ClassAndModuleWithSameNameAndCommonRootES6.2.minified.js b/crates/swc/tests/tsc-references/ClassAndModuleWithSameNameAndCommonRootES6.2.minified.js index bed3b681a93f..019c8bb5aff0 100644 --- a/crates/swc/tests/tsc-references/ClassAndModuleWithSameNameAndCommonRootES6.2.minified.js +++ b/crates/swc/tests/tsc-references/ClassAndModuleWithSameNameAndCommonRootES6.2.minified.js @@ -1,13 +1,13 @@ //// [class.ts] -var X, X1; -((X1 = X || (X = {})).Y || (X1.Y = {})).Point = class { +var X; +((X = {}).Y || (X.Y = {})).Point = class { constructor(x, y){ this.x = x, this.y = y; } }; //// [module.ts] -var X, X1, Y, Point; -(Point = (Y = (X1 = X || (X = {})).Y || (X1.Y = {})).Point || (Y.Point = {})).Origin = new Point(0, 0); +var X, Y, Point; +(Point = (Y = (X = {}).Y || (X.Y = {})).Point || (Y.Point = {})).Origin = new Point(0, 0); //// [test.ts] new X.Y.Point(1, 1), X.Y.Point.Origin; //// [simple.ts] diff --git a/crates/swc/tests/tsc-references/ES5SymbolProperty2.2.minified.js b/crates/swc/tests/tsc-references/ES5SymbolProperty2.2.minified.js index 4d46427c09d4..95ead0f78f00 100644 --- a/crates/swc/tests/tsc-references/ES5SymbolProperty2.2.minified.js +++ b/crates/swc/tests/tsc-references/ES5SymbolProperty2.2.minified.js @@ -1,7 +1,7 @@ //// [ES5SymbolProperty2.ts] var M, M1, _$Symbol, C; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -M1 = M || (M = {}), C = function() { +M1 = M = {}, C = function() { function C() { _class_call_check(this, C); } diff --git a/crates/swc/tests/tsc-references/ExportClassWhichExtendsInterfaceWithInaccessibleType.2.minified.js b/crates/swc/tests/tsc-references/ExportClassWhichExtendsInterfaceWithInaccessibleType.2.minified.js index a9786cf3c54a..49c24f833701 100644 --- a/crates/swc/tests/tsc-references/ExportClassWhichExtendsInterfaceWithInaccessibleType.2.minified.js +++ b/crates/swc/tests/tsc-references/ExportClassWhichExtendsInterfaceWithInaccessibleType.2.minified.js @@ -1,11 +1,11 @@ //// [ExportClassWhichExtendsInterfaceWithInaccessibleType.ts] -var A, A1, Point2d; +var A, Point2d; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -A1 = A || (A = {}), Point2d = function() { +A = {}, Point2d = function() { function Point2d(x, y) { _class_call_check(this, Point2d), this.x = x, this.y = y; } return Point2d.prototype.fromOrigin = function(p) { return 1; }, Point2d; -}(), A1.Point2d = Point2d; +}(), A.Point2d = Point2d; diff --git a/crates/swc/tests/tsc-references/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.2.minified.js b/crates/swc/tests/tsc-references/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.2.minified.js index d54f621888fe..2e48c962f23b 100644 --- a/crates/swc/tests/tsc-references/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.2.minified.js +++ b/crates/swc/tests/tsc-references/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.2.minified.js @@ -1,11 +1,11 @@ //// [ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.ts] -var A, A1, Point, Point3d; +var A, Point, Point3d; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _create_super } from "@swc/helpers/_/_create_super"; -A1 = A || (A = {}), Point = function Point() { +A = {}, Point = function Point() { _class_call_check(this, Point); -}, A1.Point = Point, A1.Origin = { +}, A.Point = Point, A.Origin = { x: 0, y: 0 }, Point3d = function(Point) { @@ -15,10 +15,10 @@ A1 = A || (A = {}), Point = function Point() { return _class_call_check(this, Point3d), _super.apply(this, arguments); } return Point3d; -}(Point), A1.Point3d = Point3d, A1.Origin3d = { +}(Point), A.Point3d = Point3d, A.Origin3d = { x: 0, y: 0, z: 0 -}, A1.Line = function Line(start, end) { +}, A.Line = function Line(start, end) { _class_call_check(this, Line), this.start = start, this.end = end; }; diff --git a/crates/swc/tests/tsc-references/ExportClassWithInaccessibleTypeInIndexerTypeAnnotations.2.minified.js b/crates/swc/tests/tsc-references/ExportClassWithInaccessibleTypeInIndexerTypeAnnotations.2.minified.js index 207eaf3e809f..aa13040283e5 100644 --- a/crates/swc/tests/tsc-references/ExportClassWithInaccessibleTypeInIndexerTypeAnnotations.2.minified.js +++ b/crates/swc/tests/tsc-references/ExportClassWithInaccessibleTypeInIndexerTypeAnnotations.2.minified.js @@ -1,6 +1,2 @@ //// [ExportClassWithInaccessibleTypeInIndexerTypeAnnotations.ts] -var A; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -(A || (A = {})).points = function points() { - _class_call_check(this, points); -}; diff --git a/crates/swc/tests/tsc-references/ExportClassWithInaccessibleTypeInTypeParameterConstraint.2.minified.js b/crates/swc/tests/tsc-references/ExportClassWithInaccessibleTypeInTypeParameterConstraint.2.minified.js index 59a96bf54a1b..6ea0a156730f 100644 --- a/crates/swc/tests/tsc-references/ExportClassWithInaccessibleTypeInTypeParameterConstraint.2.minified.js +++ b/crates/swc/tests/tsc-references/ExportClassWithInaccessibleTypeInTypeParameterConstraint.2.minified.js @@ -1,9 +1,9 @@ //// [ExportClassWithInaccessibleTypeInTypeParameterConstraint.ts] -var A, A1, Point3d, Line; +var A, Point3d, Line; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _create_super } from "@swc/helpers/_/_create_super"; -(A1 = A || (A = {})).Origin = { +(A = {}).Origin = { x: 0, y: 0 }, Point3d = function(Point) { @@ -15,7 +15,7 @@ import { _ as _create_super } from "@swc/helpers/_/_create_super"; return Point3d; }(function Point() { _class_call_check(this, Point); -}), A1.Point3d = Point3d, A1.Origin3d = { +}), A.Point3d = Point3d, A.Origin3d = { x: 0, y: 0, z: 0 @@ -26,4 +26,4 @@ import { _ as _create_super } from "@swc/helpers/_/_create_super"; return Line.fromorigin2d = function(p) { return null; }, Line; -}(), A1.Line = Line; +}(), A.Line = Line; diff --git a/crates/swc/tests/tsc-references/ExportFunctionWithAccessibleTypesInParameterAndReturnTypeAnnotation.2.minified.js b/crates/swc/tests/tsc-references/ExportFunctionWithAccessibleTypesInParameterAndReturnTypeAnnotation.2.minified.js index e9b8d5500fb4..fc19163f936b 100644 --- a/crates/swc/tests/tsc-references/ExportFunctionWithAccessibleTypesInParameterAndReturnTypeAnnotation.2.minified.js +++ b/crates/swc/tests/tsc-references/ExportFunctionWithAccessibleTypesInParameterAndReturnTypeAnnotation.2.minified.js @@ -1,11 +1,11 @@ //// [ExportFunctionWithAccessibleTypesInParameterAndReturnTypeAnnotation.ts] -var A, A1, Line; +var A, Line; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -(A1 = A || (A = {})).Point = function Point() { +(A = {}).Point = function Point() { _class_call_check(this, Point); }, Line = function Line(start, end) { _class_call_check(this, Line), this.start = start, this.end = end; -}, A1.Line = Line, A1.fromOrigin = function(p) { +}, A.Line = Line, A.fromOrigin = function(p) { return new Line({ x: 0, y: 0 diff --git a/crates/swc/tests/tsc-references/ExportFunctionWithInaccessibleTypesInParameterTypeAnnotation.2.minified.js b/crates/swc/tests/tsc-references/ExportFunctionWithInaccessibleTypesInParameterTypeAnnotation.2.minified.js index ef0abb9464e5..d1c72061b41b 100644 --- a/crates/swc/tests/tsc-references/ExportFunctionWithInaccessibleTypesInParameterTypeAnnotation.2.minified.js +++ b/crates/swc/tests/tsc-references/ExportFunctionWithInaccessibleTypesInParameterTypeAnnotation.2.minified.js @@ -1,9 +1,9 @@ //// [ExportFunctionWithInaccessibleTypesInParameterTypeAnnotation.ts] -var A, A1, Line; +var A, Line; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -A1 = A || (A = {}), Line = function Line(start, end) { +A = {}, Line = function Line(start, end) { _class_call_check(this, Line), this.start = start, this.end = end; -}, A1.Line = Line, A1.fromOrigin = function(p) { +}, A.Line = Line, A.fromOrigin = function(p) { return new Line({ x: 0, y: 0 diff --git a/crates/swc/tests/tsc-references/ExportFunctionWithInaccessibleTypesInReturnTypeAnnotation.2.minified.js b/crates/swc/tests/tsc-references/ExportFunctionWithInaccessibleTypesInReturnTypeAnnotation.2.minified.js index 0846aa5d4fa9..769e915bf10c 100644 --- a/crates/swc/tests/tsc-references/ExportFunctionWithInaccessibleTypesInReturnTypeAnnotation.2.minified.js +++ b/crates/swc/tests/tsc-references/ExportFunctionWithInaccessibleTypesInReturnTypeAnnotation.2.minified.js @@ -1,11 +1,11 @@ //// [ExportFunctionWithInaccessibleTypesInReturnTypeAnnotation.ts] -var A, A1, Line; +var A, Line; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -(A1 = A || (A = {})).Point = function Point() { +(A = {}).Point = function Point() { _class_call_check(this, Point); }, Line = function Line(start, end) { _class_call_check(this, Line), this.start = start, this.end = end; -}, A1.fromOrigin = function(p) { +}, A.fromOrigin = function(p) { return new Line({ x: 0, y: 0 diff --git a/crates/swc/tests/tsc-references/ExportInterfaceWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.2.minified.js b/crates/swc/tests/tsc-references/ExportInterfaceWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.2.minified.js index a05953f0aa3d..5e2aa739e967 100644 --- a/crates/swc/tests/tsc-references/ExportInterfaceWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.2.minified.js +++ b/crates/swc/tests/tsc-references/ExportInterfaceWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.2.minified.js @@ -1,9 +1,9 @@ //// [ExportInterfaceWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.ts] -var A, A1; -(A1 = A || (A = {})).Origin = { +var A; +(A = {}).Origin = { x: 0, y: 0 -}, A1.Origin3d = { +}, A.Origin3d = { x: 0, y: 0, z: 0 diff --git a/crates/swc/tests/tsc-references/ExportInterfaceWithInaccessibleTypeInTypeParameterConstraint.2.minified.js b/crates/swc/tests/tsc-references/ExportInterfaceWithInaccessibleTypeInTypeParameterConstraint.2.minified.js index 5e95ec7acb69..0177a3a4e5fa 100644 --- a/crates/swc/tests/tsc-references/ExportInterfaceWithInaccessibleTypeInTypeParameterConstraint.2.minified.js +++ b/crates/swc/tests/tsc-references/ExportInterfaceWithInaccessibleTypeInTypeParameterConstraint.2.minified.js @@ -1,9 +1,9 @@ //// [ExportInterfaceWithInaccessibleTypeInTypeParameterConstraint.ts] -var A, A1; -(A1 = A || (A = {})).Origin = { +var A; +(A = {}).Origin = { x: 0, y: 0 -}, A1.Origin3d = { +}, A.Origin3d = { x: 0, y: 0, z: 0 diff --git a/crates/swc/tests/tsc-references/ExportModuleWithAccessibleTypesOnItsExportedMembers.2.minified.js b/crates/swc/tests/tsc-references/ExportModuleWithAccessibleTypesOnItsExportedMembers.2.minified.js index c47fbbeeeb19..54d936acb5b0 100644 --- a/crates/swc/tests/tsc-references/ExportModuleWithAccessibleTypesOnItsExportedMembers.2.minified.js +++ b/crates/swc/tests/tsc-references/ExportModuleWithAccessibleTypesOnItsExportedMembers.2.minified.js @@ -1,9 +1,9 @@ //// [ExportModuleWithAccessibleTypesOnItsExportedMembers.ts] -var A, A1, Point, B, Line; +var A, Point, B, Line; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -A1 = A || (A = {}), Point = function Point(x, y) { +A = {}, Point = function Point(x, y) { _class_call_check(this, Point), this.x = x, this.y = y; -}, A1.Point = Point, (B = A1.B || (A1.B = {})).Origin = new Point(0, 0), Line = function() { +}, A.Point = Point, (B = A.B || (A.B = {})).Origin = new Point(0, 0), Line = function() { function Line(start, end) { _class_call_check(this, Line); } diff --git a/crates/swc/tests/tsc-references/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInMemberTypeAnnotations.2.minified.js b/crates/swc/tests/tsc-references/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInMemberTypeAnnotations.2.minified.js index c02904af1e03..484d315a72b2 100644 --- a/crates/swc/tests/tsc-references/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInMemberTypeAnnotations.2.minified.js +++ b/crates/swc/tests/tsc-references/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInMemberTypeAnnotations.2.minified.js @@ -1,12 +1,12 @@ //// [ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInMemberTypeAnnotations.ts] -var A, A1, Point; +var A, Point; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -A1 = A || (A = {}), Point = function Point(x, y) { +A = {}, Point = function Point(x, y) { _class_call_check(this, Point), this.x = x, this.y = y; -}, A1.Origin = { +}, A.Origin = { x: 0, y: 0 -}, A1.Unity = { +}, A.Unity = { start: new Point(0, 0), end: new Point(1, 0) }; diff --git a/crates/swc/tests/tsc-references/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.2.minified.js b/crates/swc/tests/tsc-references/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.2.minified.js index ced4f3dd2d0f..2127113e0207 100644 --- a/crates/swc/tests/tsc-references/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.2.minified.js +++ b/crates/swc/tests/tsc-references/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.2.minified.js @@ -1,4 +1,2 @@ //// [ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.ts] -var A; import "@swc/helpers/_/_class_call_check"; -(A || (A = {})).UnitSquare = null; diff --git a/crates/swc/tests/tsc-references/ExportVariableOfGenericTypeWithInaccessibleTypeAsTypeArgument.2.minified.js b/crates/swc/tests/tsc-references/ExportVariableOfGenericTypeWithInaccessibleTypeAsTypeArgument.2.minified.js index 795d32dce1a3..93aff2b23c99 100644 --- a/crates/swc/tests/tsc-references/ExportVariableOfGenericTypeWithInaccessibleTypeAsTypeArgument.2.minified.js +++ b/crates/swc/tests/tsc-references/ExportVariableOfGenericTypeWithInaccessibleTypeAsTypeArgument.2.minified.js @@ -1,4 +1,2 @@ //// [ExportVariableOfGenericTypeWithInaccessibleTypeAsTypeArgument.ts] -var A; import "@swc/helpers/_/_class_call_check"; -(A || (A = {})).beez2 = []; diff --git a/crates/swc/tests/tsc-references/ExportVariableWithAccessibleTypeInTypeAnnotation.2.minified.js b/crates/swc/tests/tsc-references/ExportVariableWithAccessibleTypeInTypeAnnotation.2.minified.js index ee06c32ca683..adb277d0c1b4 100644 --- a/crates/swc/tests/tsc-references/ExportVariableWithAccessibleTypeInTypeAnnotation.2.minified.js +++ b/crates/swc/tests/tsc-references/ExportVariableWithAccessibleTypeInTypeAnnotation.2.minified.js @@ -1,6 +1 @@ //// [ExportVariableWithAccessibleTypeInTypeAnnotation.ts] -var A; -(A || (A = {})).Origin = { - x: 0, - y: 0 -}; diff --git a/crates/swc/tests/tsc-references/ExportVariableWithInaccessibleTypeInTypeAnnotation.2.minified.js b/crates/swc/tests/tsc-references/ExportVariableWithInaccessibleTypeInTypeAnnotation.2.minified.js index d4edf5ae2b28..b101ef713692 100644 --- a/crates/swc/tests/tsc-references/ExportVariableWithInaccessibleTypeInTypeAnnotation.2.minified.js +++ b/crates/swc/tests/tsc-references/ExportVariableWithInaccessibleTypeInTypeAnnotation.2.minified.js @@ -1,9 +1,9 @@ //// [ExportVariableWithInaccessibleTypeInTypeAnnotation.ts] -var A, A1; -(A1 = A || (A = {})).Origin = { +var A; +(A = {}).Origin = { x: 0, y: 0 -}, A1.Origin3d = { +}, A.Origin3d = { x: 0, y: 0, z: 0 diff --git a/crates/swc/tests/tsc-references/FunctionAndModuleWithSameNameAndCommonRoot.2.minified.js b/crates/swc/tests/tsc-references/FunctionAndModuleWithSameNameAndCommonRoot.2.minified.js index 7c76f63c05b6..3d8880ca7edb 100644 --- a/crates/swc/tests/tsc-references/FunctionAndModuleWithSameNameAndCommonRoot.2.minified.js +++ b/crates/swc/tests/tsc-references/FunctionAndModuleWithSameNameAndCommonRoot.2.minified.js @@ -1,14 +1,7 @@ //// [function.ts] -var A; -(A || (A = {})).Point = function() { - return { - x: 0, - y: 0 - }; -}; //// [module.ts] -var A, A1; -((A1 = A || (A = {})).Point || (A1.Point = {})).Origin = { +var A; +((A = {}).Point || (A.Point = {})).Origin = { x: 0, y: 0 }; @@ -27,4 +20,4 @@ var B; x: 0, y: 0 }; -}(B || (B = {})), B.Point, B.Point(), B.Point.Origin; +}(B = {}), B.Point, B.Point(), B.Point.Origin; diff --git a/crates/swc/tests/tsc-references/FunctionAndModuleWithSameNameAndDifferentCommonRoot.2.minified.js b/crates/swc/tests/tsc-references/FunctionAndModuleWithSameNameAndDifferentCommonRoot.2.minified.js index a8159472db87..c0f35cc1d60d 100644 --- a/crates/swc/tests/tsc-references/FunctionAndModuleWithSameNameAndDifferentCommonRoot.2.minified.js +++ b/crates/swc/tests/tsc-references/FunctionAndModuleWithSameNameAndDifferentCommonRoot.2.minified.js @@ -1,14 +1,7 @@ //// [function.ts] -var A; -(A || (A = {})).Point = function() { - return { - x: 0, - y: 0 - }; -}; //// [module.ts] -var B, B1; -((B1 = B || (B = {})).Point || (B1.Point = {})).Origin = { +var B; +((B = {}).Point || (B.Point = {})).Origin = { x: 0, y: 0 }; diff --git a/crates/swc/tests/tsc-references/ModuleAndClassWithSameNameAndCommonRoot.2.minified.js b/crates/swc/tests/tsc-references/ModuleAndClassWithSameNameAndCommonRoot.2.minified.js index 9c0b459b41d6..a671f1585e81 100644 --- a/crates/swc/tests/tsc-references/ModuleAndClassWithSameNameAndCommonRoot.2.minified.js +++ b/crates/swc/tests/tsc-references/ModuleAndClassWithSameNameAndCommonRoot.2.minified.js @@ -1,10 +1,10 @@ //// [module.ts] -var X, X1, Y, Point; -(Point = (Y = (X1 = X || (X = {})).Y || (X1.Y = {})).Point || (Y.Point = {})).Origin = new Point(0, 0); +var X, Y, Point; +(Point = (Y = (X = {}).Y || (X.Y = {})).Point || (Y.Point = {})).Origin = new Point(0, 0); //// [classPoint.ts] -var X, X1; +var X; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -((X1 = X || (X = {})).Y || (X1.Y = {})).Point = function Point(x, y) { +((X = {}).Y || (X.Y = {})).Point = function Point(x, y) { _class_call_check(this, Point), this.x = x, this.y = y; }; //// [simple.ts] diff --git a/crates/swc/tests/tsc-references/ModuleAndFunctionWithSameNameAndCommonRoot.2.minified.js b/crates/swc/tests/tsc-references/ModuleAndFunctionWithSameNameAndCommonRoot.2.minified.js index 1d05c3db0844..411ce7f68f1e 100644 --- a/crates/swc/tests/tsc-references/ModuleAndFunctionWithSameNameAndCommonRoot.2.minified.js +++ b/crates/swc/tests/tsc-references/ModuleAndFunctionWithSameNameAndCommonRoot.2.minified.js @@ -1,19 +1,11 @@ //// [module.ts] -var A, A1; -((A1 = A || (A = {})).Point || (A1.Point = {})).Origin = { +var A; +((A = {}).Point || (A.Point = {})).Origin = { x: 0, y: 0 }; //// [function.ts] -var A; -(A || (A = {})).Point = function() { - return { - x: 0, - y: 0 - }; -}; //// [simple.ts] -var B; !function(B) { var Point; function Point() { @@ -26,4 +18,4 @@ var B; x: 0, y: 0 }, B.Point = Point; -}(B || (B = {})); +}({}); diff --git a/crates/swc/tests/tsc-references/ModuleWithExportedAndNonExportedClasses.2.minified.js b/crates/swc/tests/tsc-references/ModuleWithExportedAndNonExportedClasses.2.minified.js index b36880df4bed..4d339ae858cb 100644 --- a/crates/swc/tests/tsc-references/ModuleWithExportedAndNonExportedClasses.2.minified.js +++ b/crates/swc/tests/tsc-references/ModuleWithExportedAndNonExportedClasses.2.minified.js @@ -1,7 +1,7 @@ //// [ModuleWithExportedAndNonExportedClasses.ts] var A, A1; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -(A1 = A || (A = {})).A = function A() { +(A1 = A = {}).A = function A() { _class_call_check(this, A); }, A1.AG = function AG() { _class_call_check(this, AG); diff --git a/crates/swc/tests/tsc-references/ModuleWithExportedAndNonExportedEnums.2.minified.js b/crates/swc/tests/tsc-references/ModuleWithExportedAndNonExportedEnums.2.minified.js index fd9fe60bbfb1..11caba9db3f5 100644 --- a/crates/swc/tests/tsc-references/ModuleWithExportedAndNonExportedEnums.2.minified.js +++ b/crates/swc/tests/tsc-references/ModuleWithExportedAndNonExportedEnums.2.minified.js @@ -1,3 +1,3 @@ //// [ModuleWithExportedAndNonExportedEnums.ts] -var A, A1, Day, Color, Day1; -(Color = (A1 = A || (A = {})).Color || (A1.Color = {}))[Color.Red = 0] = "Red", Color[Color.Blue = 1] = "Blue", (Day1 = Day || (Day = {}))[Day1.Monday = 0] = "Monday", Day1[Day1.Tuesday = 1] = "Tuesday", A.Color.Red, A.Day.Monday; +var A, A1, Color, Day; +(Color = (A1 = A = {}).Color || (A1.Color = {}))[Color.Red = 0] = "Red", Color[Color.Blue = 1] = "Blue", (Day = {})[Day.Monday = 0] = "Monday", Day[Day.Tuesday = 1] = "Tuesday", A.Color.Red, A.Day.Monday; diff --git a/crates/swc/tests/tsc-references/ModuleWithExportedAndNonExportedFunctions.2.minified.js b/crates/swc/tests/tsc-references/ModuleWithExportedAndNonExportedFunctions.2.minified.js index c174c7f76102..bff8ded6174a 100644 --- a/crates/swc/tests/tsc-references/ModuleWithExportedAndNonExportedFunctions.2.minified.js +++ b/crates/swc/tests/tsc-references/ModuleWithExportedAndNonExportedFunctions.2.minified.js @@ -1,6 +1,6 @@ //// [ModuleWithExportedAndNonExportedFunctions.ts] var A, A1; -(A1 = A || (A = {})).fn = function(s) { +(A1 = A = {}).fn = function(s) { return !0; }, A1.fng = function(s) { return null; diff --git a/crates/swc/tests/tsc-references/ModuleWithExportedAndNonExportedImportAlias.2.minified.js b/crates/swc/tests/tsc-references/ModuleWithExportedAndNonExportedImportAlias.2.minified.js index 1cd2a3bdfa8e..b81b31769e37 100644 --- a/crates/swc/tests/tsc-references/ModuleWithExportedAndNonExportedImportAlias.2.minified.js +++ b/crates/swc/tests/tsc-references/ModuleWithExportedAndNonExportedImportAlias.2.minified.js @@ -1,12 +1,12 @@ //// [ModuleWithExportedAndNonExportedImportAlias.ts] -var B, Geometry, Geometry1, Lines; +var B, Geometry, Geometry1; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -(B || (B = {})).Line = function Line(start, end) { +(B = {}).Line = function Line(start, end) { _class_call_check(this, Line), this.start = start, this.end = end; -}, (Geometry1 = Geometry || (Geometry = {})).Points = A, Lines = B, Geometry1.Origin = { +}, (Geometry1 = Geometry = {}).Points = A, Geometry1.Origin = { x: 0, y: 0 -}, Geometry1.Unit = new Lines.Line(Geometry1.Origin, { +}, Geometry1.Unit = new B.Line(Geometry1.Origin, { x: 1, y: 0 }), Geometry.Origin, Geometry.Unit, Geometry.Lines.Line; diff --git a/crates/swc/tests/tsc-references/ModuleWithExportedAndNonExportedVariables.2.minified.js b/crates/swc/tests/tsc-references/ModuleWithExportedAndNonExportedVariables.2.minified.js index 2e53de418e59..8dab1810f6a1 100644 --- a/crates/swc/tests/tsc-references/ModuleWithExportedAndNonExportedVariables.2.minified.js +++ b/crates/swc/tests/tsc-references/ModuleWithExportedAndNonExportedVariables.2.minified.js @@ -1,3 +1,3 @@ //// [ModuleWithExportedAndNonExportedVariables.ts] var A; -(A || (A = {})).x = 'hello world', A.x, A.y; +(A = {}).x = 'hello world', A.x, A.y; diff --git a/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName.2.minified.js b/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName.2.minified.js index 1407b86efb25..7d35fad4cd41 100644 --- a/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName.2.minified.js +++ b/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedAndNonExportedLocalVarsOfTheSameName.2.minified.js @@ -1,18 +1,18 @@ //// [part1.ts] -var A, A1; -((A1 = A || (A = {})).Utils || (A1.Utils = {})).mirror = function(p) { +var A; +((A = {}).Utils || (A.Utils = {})).mirror = function(p) { return { x: p.y, y: p.x }; -}, A1.Origin = { +}, A.Origin = { x: 0, y: 0 }; //// [part2.ts] -var A, A1; +var A; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -((A1 = A || (A = {})).Utils || (A1.Utils = {})).Plane = function Plane(tl, br) { +((A = {}).Utils || (A.Utils = {})).Plane = function Plane(tl, br) { _class_call_check(this, Plane), this.tl = tl, this.br = br; }; //// [part3.ts] diff --git a/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.2.minified.js b/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.2.minified.js index b44ebe0916a5..91df4e1d8bef 100644 --- a/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.2.minified.js +++ b/crates/swc/tests/tsc-references/TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.2.minified.js @@ -1,8 +1,6 @@ //// [TwoInternalModulesThatMergeEachWithExportedModulesOfTheSameName.ts] -var A, X, A1, B, X1, Y, X2, Z; +var A, X, A1, X1, Y, X2; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -(A1 = A || (A = {})).B || (A1.B = {}), A || (A = {}), B || (B = {}), A.B.x, ((Y = (X1 = X || (X = {})).Y || (X1.Y = {})).Z || (Y.Z = {})).Line = function Line() { +(A1 = A || (A = {})).B || (A1.B = {}), A || (A = {}), A.B.x, ((Y = (X1 = X || (X = {})).Y || (X1.Y = {})).Z || (Y.Z = {})).Line = function Line() { _class_call_check(this, Line); -}, (X2 = X || (X = {})).Y || (X2.Y = {}), (Z || (Z = {})).Line = function Line() { - _class_call_check(this, Line); -}; +}, (X2 = X || (X = {})).Y || (X2.Y = {}); diff --git a/crates/swc/tests/tsc-references/TwoInternalModulesWithTheSameNameAndDifferentCommonRoot.2.minified.js b/crates/swc/tests/tsc-references/TwoInternalModulesWithTheSameNameAndDifferentCommonRoot.2.minified.js index c049162e2b3d..769f0754dbed 100644 --- a/crates/swc/tests/tsc-references/TwoInternalModulesWithTheSameNameAndDifferentCommonRoot.2.minified.js +++ b/crates/swc/tests/tsc-references/TwoInternalModulesWithTheSameNameAndDifferentCommonRoot.2.minified.js @@ -1,15 +1,15 @@ //// [part1.ts] -var Root, Root1, A; -((A = (Root1 = Root || (Root = {})).A || (Root1.A = {})).Utils || (A.Utils = {})).mirror = function(p) { +var Root, A; +((A = (Root = {}).A || (Root.A = {})).Utils || (A.Utils = {})).mirror = function(p) { return { x: p.y, y: p.x }; }; //// [part2.ts] -var otherRoot, otherRoot1, A; +var otherRoot, A; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -(A = (otherRoot1 = otherRoot || (otherRoot = {})).A || (otherRoot1.A = {})).Origin = { +(A = (otherRoot = {}).A || (otherRoot.A = {})).Origin = { x: 0, y: 0 }, (A.Utils || (A.Utils = {})).Plane = function Plane(tl, br) { diff --git a/crates/swc/tests/tsc-references/TwoInternalModulesWithTheSameNameAndSameCommonRoot.2.minified.js b/crates/swc/tests/tsc-references/TwoInternalModulesWithTheSameNameAndSameCommonRoot.2.minified.js index adf1fe174cd1..60401826d55e 100644 --- a/crates/swc/tests/tsc-references/TwoInternalModulesWithTheSameNameAndSameCommonRoot.2.minified.js +++ b/crates/swc/tests/tsc-references/TwoInternalModulesWithTheSameNameAndSameCommonRoot.2.minified.js @@ -1,18 +1,18 @@ //// [part1.ts] -var A, A1; -((A1 = A || (A = {})).Utils || (A1.Utils = {})).mirror = function(p) { +var A; +((A = {}).Utils || (A.Utils = {})).mirror = function(p) { return { x: p.y, y: p.x }; }; //// [part2.ts] -var A, A1; +var A; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -(A1 = A || (A = {})).Origin = { +(A = {}).Origin = { x: 0, y: 0 -}, (A1.Utils || (A1.Utils = {})).Plane = function Plane(tl, br) { +}, (A.Utils || (A.Utils = {})).Plane = function Plane(tl, br) { _class_call_check(this, Plane), this.tl = tl, this.br = br; }; //// [part3.ts] diff --git a/crates/swc/tests/tsc-references/TypeGuardWithEnumUnion.2.minified.js b/crates/swc/tests/tsc-references/TypeGuardWithEnumUnion.2.minified.js index d94cc1dcc4cc..63f06ecced4a 100644 --- a/crates/swc/tests/tsc-references/TypeGuardWithEnumUnion.2.minified.js +++ b/crates/swc/tests/tsc-references/TypeGuardWithEnumUnion.2.minified.js @@ -1,4 +1,4 @@ //// [TypeGuardWithEnumUnion.ts] -var Color, Color1; +var Color; import "@swc/helpers/_/_type_of"; -(Color1 = Color || (Color = {}))[Color1.R = 0] = "R", Color1[Color1.G = 1] = "G", Color1[Color1.B = 2] = "B"; +(Color = {})[Color.R = 0] = "R", Color[Color.G = 1] = "G", Color[Color.B = 2] = "B"; diff --git a/crates/swc/tests/tsc-references/additionOperatorWithAnyAndEveryType.2.minified.js b/crates/swc/tests/tsc-references/additionOperatorWithAnyAndEveryType.2.minified.js index 93576bbf0776..e1d2d6ae002e 100644 --- a/crates/swc/tests/tsc-references/additionOperatorWithAnyAndEveryType.2.minified.js +++ b/crates/swc/tests/tsc-references/additionOperatorWithAnyAndEveryType.2.minified.js @@ -1,9 +1,9 @@ //// [additionOperatorWithAnyAndEveryType.ts] import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -var E, E1, M, C = function() { +var E, C = function() { function C() { _class_call_check(this, C); } return C.foo = function() {}, C; }(); -(E = E1 || (E1 = {}))[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c", M || (M = {}), new C(); +(E = {})[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c", new C(); diff --git a/crates/swc/tests/tsc-references/additionOperatorWithInvalidOperands.2.minified.js b/crates/swc/tests/tsc-references/additionOperatorWithInvalidOperands.2.minified.js index 096dc6787b99..8ba74080303c 100644 --- a/crates/swc/tests/tsc-references/additionOperatorWithInvalidOperands.2.minified.js +++ b/crates/swc/tests/tsc-references/additionOperatorWithInvalidOperands.2.minified.js @@ -1,9 +1,9 @@ //// [additionOperatorWithInvalidOperands.ts] import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -var E, E1, M, C = function() { +var E, C = function() { function C() { _class_call_check(this, C); } return C.foo = function() {}, C; }(); -(E = E1 || (E1 = {}))[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c", M || (M = {}), new C(), C.foo(); +(E = {})[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c", new C(), C.foo(); diff --git a/crates/swc/tests/tsc-references/additionOperatorWithNullValueAndValidOperator.2.minified.js b/crates/swc/tests/tsc-references/additionOperatorWithNullValueAndValidOperator.2.minified.js index f529f9cafce3..0cb1aba66e6d 100644 --- a/crates/swc/tests/tsc-references/additionOperatorWithNullValueAndValidOperator.2.minified.js +++ b/crates/swc/tests/tsc-references/additionOperatorWithNullValueAndValidOperator.2.minified.js @@ -1,3 +1,3 @@ //// [additionOperatorWithNullValueAndValidOperator.ts] -var E, E1; -(E1 = E || (E = {}))[E1.a = 0] = "a", E1[E1.b = 1] = "b", E1[E1.c = 2] = "c"; +var E; +(E = {})[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c"; diff --git a/crates/swc/tests/tsc-references/additionOperatorWithNumberAndEnum.2.minified.js b/crates/swc/tests/tsc-references/additionOperatorWithNumberAndEnum.2.minified.js index 4ae8f17e89ef..4f840aefd51a 100644 --- a/crates/swc/tests/tsc-references/additionOperatorWithNumberAndEnum.2.minified.js +++ b/crates/swc/tests/tsc-references/additionOperatorWithNumberAndEnum.2.minified.js @@ -1,3 +1,3 @@ //// [additionOperatorWithNumberAndEnum.ts] -var E, F, E1, F1; -(E1 = E || (E = {}))[E1.a = 0] = "a", E1[E1.b = 1] = "b", (F1 = F || (F = {}))[F1.c = 0] = "c", F1[F1.d = 1] = "d"; +var E, F; +(E = {})[E.a = 0] = "a", E[E.b = 1] = "b", (F = {})[F.c = 0] = "c", F[F.d = 1] = "d"; diff --git a/crates/swc/tests/tsc-references/additionOperatorWithStringAndEveryType.2.minified.js b/crates/swc/tests/tsc-references/additionOperatorWithStringAndEveryType.2.minified.js index 489e001a73fa..29dbceaffc9e 100644 --- a/crates/swc/tests/tsc-references/additionOperatorWithStringAndEveryType.2.minified.js +++ b/crates/swc/tests/tsc-references/additionOperatorWithStringAndEveryType.2.minified.js @@ -1,3 +1,3 @@ //// [additionOperatorWithStringAndEveryType.ts] -var E, E1; -(E1 = E || (E = {}))[E1.a = 0] = "a", E1[E1.b = 1] = "b", E1[E1.c = 2] = "c"; +var E; +(E = {})[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c"; diff --git a/crates/swc/tests/tsc-references/additionOperatorWithTypeParameter.2.minified.js b/crates/swc/tests/tsc-references/additionOperatorWithTypeParameter.2.minified.js index 74d02f97faad..c1e545ff418d 100644 --- a/crates/swc/tests/tsc-references/additionOperatorWithTypeParameter.2.minified.js +++ b/crates/swc/tests/tsc-references/additionOperatorWithTypeParameter.2.minified.js @@ -1,3 +1,3 @@ //// [additionOperatorWithTypeParameter.ts] -var E, E1; -(E1 = E || (E = {}))[E1.a = 0] = "a", E1[E1.b = 1] = "b"; +var E; +(E = {})[E.a = 0] = "a", E[E.b = 1] = "b"; diff --git a/crates/swc/tests/tsc-references/additionOperatorWithUndefinedValueAndValidOperator.2.minified.js b/crates/swc/tests/tsc-references/additionOperatorWithUndefinedValueAndValidOperator.2.minified.js index 6d15ae843967..e0e6d97e0a59 100644 --- a/crates/swc/tests/tsc-references/additionOperatorWithUndefinedValueAndValidOperator.2.minified.js +++ b/crates/swc/tests/tsc-references/additionOperatorWithUndefinedValueAndValidOperator.2.minified.js @@ -1,3 +1,3 @@ //// [additionOperatorWithUndefinedValueAndValidOperator.ts] -var E, E1; -(E1 = E || (E = {}))[E1.a = 0] = "a", E1[E1.b = 1] = "b", E1[E1.c = 2] = "c"; +var E; +(E = {})[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c"; diff --git a/crates/swc/tests/tsc-references/ambientInsideNonAmbient.2.minified.js b/crates/swc/tests/tsc-references/ambientInsideNonAmbient.2.minified.js index b133fdd22be3..4d3f002e0b84 100644 --- a/crates/swc/tests/tsc-references/ambientInsideNonAmbient.2.minified.js +++ b/crates/swc/tests/tsc-references/ambientInsideNonAmbient.2.minified.js @@ -1,3 +1 @@ //// [ambientInsideNonAmbient.ts] -var M, M2; -M || (M = {}), M2 || (M2 = {}); diff --git a/crates/swc/tests/tsc-references/amdImportAsPrimaryExpression.2.minified.js b/crates/swc/tests/tsc-references/amdImportAsPrimaryExpression.2.minified.js index 0f4b82e04016..6c607a062185 100644 --- a/crates/swc/tests/tsc-references/amdImportAsPrimaryExpression.2.minified.js +++ b/crates/swc/tests/tsc-references/amdImportAsPrimaryExpression.2.minified.js @@ -11,7 +11,7 @@ define([ get: function() { return E1; } - }), (E11 = E1 || (E1 = {}))[E11.A = 0] = "A", E11[E11.B = 1] = "B", E11[E11.C = 2] = "C"; + }), (E11 = E1 = {})[E11.A = 0] = "A", E11[E11.B = 1] = "B", E11[E11.C = 2] = "C"; }); //// [foo_1.ts] define([ diff --git a/crates/swc/tests/tsc-references/amdImportNotAsPrimaryExpression.2.minified.js b/crates/swc/tests/tsc-references/amdImportNotAsPrimaryExpression.2.minified.js index 8ff118e13278..4b643367929b 100644 --- a/crates/swc/tests/tsc-references/amdImportNotAsPrimaryExpression.2.minified.js +++ b/crates/swc/tests/tsc-references/amdImportNotAsPrimaryExpression.2.minified.js @@ -22,7 +22,7 @@ define([ var E1, E11, C1 = function C1() { _class_call_check._(this, C1), this.m1 = 42; }; - C1.s1 = !0, (E1 = E11 || (E11 = {}))[E1.A = 0] = "A", E1[E1.B = 1] = "B", E1[E1.C = 2] = "C"; + C1.s1 = !0, (E1 = E11 = {})[E1.A = 0] = "A", E1[E1.B = 1] = "B", E1[E1.C = 2] = "C"; }); //// [foo_1.ts] define([ diff --git a/crates/swc/tests/tsc-references/anyAssignabilityInInheritance.2.minified.js b/crates/swc/tests/tsc-references/anyAssignabilityInInheritance.2.minified.js index a8e23114ebf1..ab786f84bcca 100644 --- a/crates/swc/tests/tsc-references/anyAssignabilityInInheritance.2.minified.js +++ b/crates/swc/tests/tsc-references/anyAssignabilityInInheritance.2.minified.js @@ -1,8 +1,8 @@ //// [anyAssignabilityInInheritance.ts] import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; function f() {} -foo2(a), foo3(a), foo3(a), foo3(a), foo3(a), foo3(a), foo3(a), foo3(a), foo3(a), foo3(a), foo3(a), foo3(a), (E = E1 || (E1 = {}))[E.A = 0] = "A", foo3(a), (f || (f = {})).bar = 1, foo3(a); -var E, a, E1, CC = function CC() { +foo2(a), foo3(a), foo3(a), foo3(a), foo3(a), foo3(a), foo3(a), foo3(a), foo3(a), foo3(a), foo3(a), foo3(a), (E = {})[E.A = 0] = "A", foo3(a), (f || (f = {})).bar = 1, foo3(a); +var E, a, CC = function CC() { _class_call_check(this, CC); }; (CC || (CC = {})).bar = 1, foo3(a), foo3(a), foo3(a); diff --git a/crates/swc/tests/tsc-references/anyAssignableToEveryType.2.minified.js b/crates/swc/tests/tsc-references/anyAssignableToEveryType.2.minified.js index 440abe140c87..a6aa6e5846cf 100644 --- a/crates/swc/tests/tsc-references/anyAssignableToEveryType.2.minified.js +++ b/crates/swc/tests/tsc-references/anyAssignableToEveryType.2.minified.js @@ -1,4 +1,4 @@ //// [anyAssignableToEveryType.ts] -var E, E1; +var E; import "@swc/helpers/_/_class_call_check"; -(E1 = E || (E = {}))[E1.A = 0] = "A"; +(E = {})[E.A = 0] = "A"; diff --git a/crates/swc/tests/tsc-references/anyAssignableToEveryType2.2.minified.js b/crates/swc/tests/tsc-references/anyAssignableToEveryType2.2.minified.js index b25ab2e6f67b..58f57a9e715d 100644 --- a/crates/swc/tests/tsc-references/anyAssignableToEveryType2.2.minified.js +++ b/crates/swc/tests/tsc-references/anyAssignableToEveryType2.2.minified.js @@ -1,8 +1,8 @@ //// [anyAssignableToEveryType2.ts] import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; function f() {} -(E = E1 || (E1 = {}))[E.A = 0] = "A", (f || (f = {})).bar = 1; -var E, E1, c = function c() { +(E = {})[E.A = 0] = "A", (f || (f = {})).bar = 1; +var E, c = function c() { _class_call_check(this, c); }; (c || (c = {})).bar = 1; diff --git a/crates/swc/tests/tsc-references/arithmeticOperatorWithEnum.2.minified.js b/crates/swc/tests/tsc-references/arithmeticOperatorWithEnum.2.minified.js index 9fb293eb4cfe..81d561b5ff38 100644 --- a/crates/swc/tests/tsc-references/arithmeticOperatorWithEnum.2.minified.js +++ b/crates/swc/tests/tsc-references/arithmeticOperatorWithEnum.2.minified.js @@ -1,3 +1,3 @@ //// [arithmeticOperatorWithEnum.ts] -var E, E1; -(E1 = E || (E = {}))[E1.a = 0] = "a", E1[E1.b = 1] = "b"; +var E; +(E = {})[E.a = 0] = "a", E[E.b = 1] = "b"; diff --git a/crates/swc/tests/tsc-references/arithmeticOperatorWithEnumUnion.2.minified.js b/crates/swc/tests/tsc-references/arithmeticOperatorWithEnumUnion.2.minified.js index fa30ce503a73..beca90b88ee1 100644 --- a/crates/swc/tests/tsc-references/arithmeticOperatorWithEnumUnion.2.minified.js +++ b/crates/swc/tests/tsc-references/arithmeticOperatorWithEnumUnion.2.minified.js @@ -1,3 +1,3 @@ //// [arithmeticOperatorWithEnumUnion.ts] -var E, F, E1, F1; -(E1 = E || (E = {}))[E1.a = 0] = "a", E1[E1.b = 1] = "b", (F1 = F || (F = {}))[F1.c = 0] = "c", F1[F1.d = 1] = "d"; +var E, F; +(E = {})[E.a = 0] = "a", E[E.b = 1] = "b", (F = {})[F.c = 0] = "c", F[F.d = 1] = "d"; diff --git a/crates/swc/tests/tsc-references/arithmeticOperatorWithInvalidOperands.2.minified.js b/crates/swc/tests/tsc-references/arithmeticOperatorWithInvalidOperands.2.minified.js index 02d31a648031..aca8587964e4 100644 --- a/crates/swc/tests/tsc-references/arithmeticOperatorWithInvalidOperands.2.minified.js +++ b/crates/swc/tests/tsc-references/arithmeticOperatorWithInvalidOperands.2.minified.js @@ -1,3 +1,3 @@ //// [arithmeticOperatorWithInvalidOperands.ts] -var E, E1; -(E1 = E || (E = {}))[E1.a = 0] = "a", E1[E1.b = 1] = "b", E1[E1.c = 2] = "c"; +var E; +(E = {})[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c"; diff --git a/crates/swc/tests/tsc-references/asiPreventsParsingAsAmbientExternalModule02.2.minified.js b/crates/swc/tests/tsc-references/asiPreventsParsingAsAmbientExternalModule02.2.minified.js index 3164b75a6fca..010a6de07091 100644 --- a/crates/swc/tests/tsc-references/asiPreventsParsingAsAmbientExternalModule02.2.minified.js +++ b/crates/swc/tests/tsc-references/asiPreventsParsingAsAmbientExternalModule02.2.minified.js @@ -1,3 +1 @@ //// [asiPreventsParsingAsAmbientExternalModule02.ts] -var container; -container || (container = {}); diff --git a/crates/swc/tests/tsc-references/asiPreventsParsingAsNamespace05.2.minified.js b/crates/swc/tests/tsc-references/asiPreventsParsingAsNamespace05.2.minified.js index ccd6bbb0cfdf..a725b438b979 100644 --- a/crates/swc/tests/tsc-references/asiPreventsParsingAsNamespace05.2.minified.js +++ b/crates/swc/tests/tsc-references/asiPreventsParsingAsNamespace05.2.minified.js @@ -1,3 +1,3 @@ //// [asiPreventsParsingAsNamespace05.ts] -var a, a1; -((a1 = a || (a = {})).b || (a1.b = {})).c = 20; +var a; +((a = {}).b || (a.b = {})).c = 20; diff --git a/crates/swc/tests/tsc-references/asiPreventsParsingAsTypeAlias02.2.minified.js b/crates/swc/tests/tsc-references/asiPreventsParsingAsTypeAlias02.2.minified.js index c59a44614d05..15a823074d52 100644 --- a/crates/swc/tests/tsc-references/asiPreventsParsingAsTypeAlias02.2.minified.js +++ b/crates/swc/tests/tsc-references/asiPreventsParsingAsTypeAlias02.2.minified.js @@ -1,3 +1 @@ //// [asiPreventsParsingAsTypeAlias02.ts] -var container; -container || (container = {}); diff --git a/crates/swc/tests/tsc-references/assignAnyToEveryType.2.minified.js b/crates/swc/tests/tsc-references/assignAnyToEveryType.2.minified.js index eebb9a998b87..e444a86d8844 100644 --- a/crates/swc/tests/tsc-references/assignAnyToEveryType.2.minified.js +++ b/crates/swc/tests/tsc-references/assignAnyToEveryType.2.minified.js @@ -1,4 +1,4 @@ //// [assignAnyToEveryType.ts] -var E, M, E1; +var E; import "@swc/helpers/_/_class_call_check"; -(E1 = E || (E = {}))[E1.A = 0] = "A", (M || (M = {})).foo = 1; +(E = {})[E.A = 0] = "A"; diff --git a/crates/swc/tests/tsc-references/assignEveryTypeToAny.2.minified.js b/crates/swc/tests/tsc-references/assignEveryTypeToAny.2.minified.js index 82710f897f3f..a1684ee8ffba 100644 --- a/crates/swc/tests/tsc-references/assignEveryTypeToAny.2.minified.js +++ b/crates/swc/tests/tsc-references/assignEveryTypeToAny.2.minified.js @@ -1,4 +1,4 @@ //// [assignEveryTypeToAny.ts] -var E, E1; +var E; import "@swc/helpers/_/_class_call_check"; -(E1 = E || (E = {}))[E1.A = 0] = "A"; +(E = {})[E.A = 0] = "A"; diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithCallSignatures4.2.minified.js b/crates/swc/tests/tsc-references/assignmentCompatWithCallSignatures4.2.minified.js index de211216c678..6d69e0731b64 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithCallSignatures4.2.minified.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithCallSignatures4.2.minified.js @@ -1,6 +1,4 @@ //// [assignmentCompatWithCallSignatures4.ts] -var Errors, WithNonGenericSignaturesInBaseType, WithGenericSignaturesInBaseType; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _create_super } from "@swc/helpers/_/_create_super"; -Errors || (Errors = {}), WithNonGenericSignaturesInBaseType || (WithNonGenericSignaturesInBaseType = {}), WithGenericSignaturesInBaseType || (WithGenericSignaturesInBaseType = {}); diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithConstructSignatures4.2.minified.js b/crates/swc/tests/tsc-references/assignmentCompatWithConstructSignatures4.2.minified.js index 2b94e7e9abd9..2316c4f7afa0 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithConstructSignatures4.2.minified.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithConstructSignatures4.2.minified.js @@ -1,6 +1,4 @@ //// [assignmentCompatWithConstructSignatures4.ts] -var Errors, WithNonGenericSignaturesInBaseType, WithGenericSignaturesInBaseType; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _create_super } from "@swc/helpers/_/_create_super"; -Errors || (Errors = {}), WithNonGenericSignaturesInBaseType || (WithNonGenericSignaturesInBaseType = {}), WithGenericSignaturesInBaseType || (WithGenericSignaturesInBaseType = {}); diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithDiscriminatedUnion.2.minified.js b/crates/swc/tests/tsc-references/assignmentCompatWithDiscriminatedUnion.2.minified.js index 347ed618413b..83f8703b5855 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithDiscriminatedUnion.2.minified.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithDiscriminatedUnion.2.minified.js @@ -1,8 +1,8 @@ //// [assignmentCompatWithDiscriminatedUnion.ts] -var Example1, Example2, Example3, Example4, Example5, GH14865, GH30170, GH12052, GH18421, GH15907, GH20889, GH39357, b1; -Example1 || (Example1 = {}), t = s, Example2 || (Example2 = {}), t = s, Example3 || (Example3 = {}), t = s, Example4 || (Example4 = {}), t = s, Example5 || (Example5 = {}), t = s, GH14865 || (GH14865 = {}), b1.type, GH30170 || (GH30170 = {}), function(GH12052) { +var b1; +t = s, t = s, t = s, t = s, t = s, b1.type, function(GH12052) { function getAxisType() { return "categorical"; } getAxisType(), getAxisType(); -}(GH12052 || (GH12052 = {})), GH18421 || (GH18421 = {}), GH15907 || (GH15907 = {}), GH20889 || (GH20889 = {}), GH39357 || (GH39357 = {}), ("a" === b || "b" === b) && b; +}(0), ("a" === b || "b" === b) && b; diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithEnumIndexer.2.minified.js b/crates/swc/tests/tsc-references/assignmentCompatWithEnumIndexer.2.minified.js index d139595fc8cd..7ba726fdea94 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithEnumIndexer.2.minified.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithEnumIndexer.2.minified.js @@ -1,3 +1,3 @@ //// [assignmentCompatWithEnumIndexer.ts] -var E, E1; -(E1 = E || (E = {}))[E1.A = 0] = "A"; +var E; +(E = {})[E.A = 0] = "A"; diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.2.minified.js b/crates/swc/tests/tsc-references/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.2.minified.js index dce09b422706..630f325a1348 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.2.minified.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithGenericCallSignaturesWithOptionalParameters.2.minified.js @@ -1,4 +1,2 @@ //// [assignmentCompatWithGenericCallSignaturesWithOptionalParameters.ts] -var ClassTypeParam, GenericSignaturesInvalid, GenericSignaturesValid; import "@swc/helpers/_/_class_call_check"; -ClassTypeParam || (ClassTypeParam = {}), GenericSignaturesInvalid || (GenericSignaturesInvalid = {}), GenericSignaturesValid || (GenericSignaturesValid = {}); diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithNumericIndexer.2.minified.js b/crates/swc/tests/tsc-references/assignmentCompatWithNumericIndexer.2.minified.js index 545834755797..5e1508b1a129 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithNumericIndexer.2.minified.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithNumericIndexer.2.minified.js @@ -1,6 +1,4 @@ //// [assignmentCompatWithNumericIndexer.ts] -var Generics; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _create_super } from "@swc/helpers/_/_create_super"; -Generics || (Generics = {}); diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithNumericIndexer2.2.minified.js b/crates/swc/tests/tsc-references/assignmentCompatWithNumericIndexer2.2.minified.js index 2db32e558def..6fecb224246d 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithNumericIndexer2.2.minified.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithNumericIndexer2.2.minified.js @@ -1,3 +1 @@ //// [assignmentCompatWithNumericIndexer2.ts] -var Generics; -Generics || (Generics = {}); diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithNumericIndexer3.2.minified.js b/crates/swc/tests/tsc-references/assignmentCompatWithNumericIndexer3.2.minified.js index 6ec041eb4155..cc1e2e5fbae0 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithNumericIndexer3.2.minified.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithNumericIndexer3.2.minified.js @@ -1,6 +1,4 @@ //// [assignmentCompatWithNumericIndexer3.ts] -var Generics; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _create_super } from "@swc/helpers/_/_create_super"; -Generics || (Generics = {}); diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembers.2.minified.js b/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembers.2.minified.js index fe7d91980b26..109e02cc84e2 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembers.2.minified.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembers.2.minified.js @@ -1,7 +1,7 @@ //// [assignmentCompatWithObjectMembers.ts] -var SimpleTypes, ObjectTypes, a2, b2; +var a2, b2; import "@swc/helpers/_/_class_call_check"; -SimpleTypes || (SimpleTypes = {}), ObjectTypes || (ObjectTypes = {}), a2 = { +a2 = { foo: a2 }, b2 = a2 = b2 = { foo: b2 diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembers4.2.minified.js b/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembers4.2.minified.js index 09c99aa56f68..1d7b3090af8e 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembers4.2.minified.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembers4.2.minified.js @@ -1,9 +1,9 @@ //// [assignmentCompatWithObjectMembers4.ts] -var OnlyDerived, WithBase, Base, Derived, Derived2, Base1, Derived21; +var Base, Derived, Derived2, Base1, Derived21; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _create_super } from "@swc/helpers/_/_create_super"; -OnlyDerived || (OnlyDerived = {}), Derived = function(Base) { +Derived = function(Base) { _inherits(Derived, Base); var _super = _create_super(Derived); function Derived() { @@ -19,7 +19,7 @@ OnlyDerived || (OnlyDerived = {}), Derived = function(Base) { return _class_call_check(this, Derived2), _super.apply(this, arguments); } return Derived2; -}(Base), new Derived(), new Derived2(), WithBase || (WithBase = {}), Derived21 = function(Base) { +}(Base), new Derived(), new Derived2(), Derived21 = function(Base) { _inherits(Derived2, Base); var _super = _create_super(Derived2); function Derived2() { diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembersOptionality.2.minified.js b/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembersOptionality.2.minified.js index 8970370ca3cf..ea1647e61e17 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembersOptionality.2.minified.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembersOptionality.2.minified.js @@ -2,7 +2,7 @@ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _create_super } from "@swc/helpers/_/_create_super"; -var TargetHasOptional, SourceHasOptional, Base = function Base() { +var Base = function Base() { _class_call_check(this, Base); }; -TargetHasOptional || (TargetHasOptional = {}), new Base(), SourceHasOptional || (SourceHasOptional = {}), new Base(); +new Base(), new Base(); diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembersOptionality2.2.minified.js b/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembersOptionality2.2.minified.js index 751993de81d0..bcd6d95292d3 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembersOptionality2.2.minified.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembersOptionality2.2.minified.js @@ -2,7 +2,7 @@ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _create_super } from "@swc/helpers/_/_create_super"; -var TargetHasOptional, SourceHasOptional, Base = function Base() { +var Base = function Base() { _class_call_check(this, Base); }; -TargetHasOptional || (TargetHasOptional = {}), new Base(), SourceHasOptional || (SourceHasOptional = {}), new Base(); +new Base(), new Base(); diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembersStringNumericNames.2.minified.js b/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembersStringNumericNames.2.minified.js index e49fc71893a6..66819eccf3d7 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembersStringNumericNames.2.minified.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithObjectMembersStringNumericNames.2.minified.js @@ -1,4 +1,2 @@ //// [assignmentCompatWithObjectMembersStringNumericNames.ts] -var JustStrings, NumbersAndStrings; import "@swc/helpers/_/_class_call_check"; -JustStrings || (JustStrings = {}), NumbersAndStrings || (NumbersAndStrings = {}); diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithStringIndexer.2.minified.js b/crates/swc/tests/tsc-references/assignmentCompatWithStringIndexer.2.minified.js index a8f7f0fc6668..4117c8dfff3d 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithStringIndexer.2.minified.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithStringIndexer.2.minified.js @@ -1,6 +1,4 @@ //// [assignmentCompatWithStringIndexer.ts] -var Generics; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _create_super } from "@swc/helpers/_/_create_super"; -Generics || (Generics = {}); diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithStringIndexer2.2.minified.js b/crates/swc/tests/tsc-references/assignmentCompatWithStringIndexer2.2.minified.js index 59616c7b1721..472895263608 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithStringIndexer2.2.minified.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithStringIndexer2.2.minified.js @@ -1,3 +1 @@ //// [assignmentCompatWithStringIndexer2.ts] -var Generics; -Generics || (Generics = {}); diff --git a/crates/swc/tests/tsc-references/assignmentCompatWithStringIndexer3.2.minified.js b/crates/swc/tests/tsc-references/assignmentCompatWithStringIndexer3.2.minified.js index 1fb7f1fdabe1..116c9b449fe0 100644 --- a/crates/swc/tests/tsc-references/assignmentCompatWithStringIndexer3.2.minified.js +++ b/crates/swc/tests/tsc-references/assignmentCompatWithStringIndexer3.2.minified.js @@ -1,4 +1,2 @@ //// [assignmentCompatWithStringIndexer3.ts] -var Generics; import "@swc/helpers/_/_class_call_check"; -Generics || (Generics = {}); diff --git a/crates/swc/tests/tsc-references/assignmentToParenthesizedIdentifiers.2.minified.js b/crates/swc/tests/tsc-references/assignmentToParenthesizedIdentifiers.2.minified.js index 8c72491cd01b..f78a78260127 100644 --- a/crates/swc/tests/tsc-references/assignmentToParenthesizedIdentifiers.2.minified.js +++ b/crates/swc/tests/tsc-references/assignmentToParenthesizedIdentifiers.2.minified.js @@ -1,11 +1,11 @@ //// [assignmentToParenthesizedIdentifiers.ts] -var M, M2, E, M21, E1; +var M, M2, M21, E; import "@swc/helpers/_/_class_call_check"; M || (M = {}), M.y = 3, M.y = 3, M.y = 3, M.y = '', M.y = '', M.y = '', M = { y: 3 }, M = { y: 3 -}, (M21 = M2 || (M2 = {})).M3 || (M21.M3 = {}), M2.M3 = { +}, (M21 = M2 = {}).M3 || (M21.M3 = {}), M2.M3 = { x: 3 }, M2.M3 = { x: 3 @@ -17,4 +17,4 @@ M || (M = {}), M.y = 3, M.y = 3, M.y = 3, M.y = '', M.y = '', M.y = '', M = { x: '' }, M2.M3 = { x: '' -}, (E1 = E || (E = {}))[E1.A = 0] = "A"; +}, (E = {})[E.A = 0] = "A"; diff --git a/crates/swc/tests/tsc-references/asyncAwaitIsolatedModules_es2017.2.minified.js b/crates/swc/tests/tsc-references/asyncAwaitIsolatedModules_es2017.2.minified.js index 9d52dfa2b2f8..77436db3e5bf 100644 --- a/crates/swc/tests/tsc-references/asyncAwaitIsolatedModules_es2017.2.minified.js +++ b/crates/swc/tests/tsc-references/asyncAwaitIsolatedModules_es2017.2.minified.js @@ -1,7 +1,6 @@ //// [asyncAwaitIsolatedModules_es2017.ts] -var M; !function(M) { async function f1() {} M.f1 = f1; -}(M || (M = {})); +}({}); export { }; diff --git a/crates/swc/tests/tsc-references/asyncAwaitIsolatedModules_es5.2.minified.js b/crates/swc/tests/tsc-references/asyncAwaitIsolatedModules_es5.2.minified.js index efcffa015520..5cf85bd8daa5 100644 --- a/crates/swc/tests/tsc-references/asyncAwaitIsolatedModules_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/asyncAwaitIsolatedModules_es5.2.minified.js @@ -1,5 +1,4 @@ //// [asyncAwaitIsolatedModules_es5.ts] -var M; import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator"; @@ -80,4 +79,4 @@ _async_to_generator(function() { M.f1 = function() { return _f1.apply(this, arguments); }; -}(M || (M = {})); +}({}); diff --git a/crates/swc/tests/tsc-references/asyncAwaitIsolatedModules_es6.2.minified.js b/crates/swc/tests/tsc-references/asyncAwaitIsolatedModules_es6.2.minified.js index 16c603790e70..0efdde027098 100644 --- a/crates/swc/tests/tsc-references/asyncAwaitIsolatedModules_es6.2.minified.js +++ b/crates/swc/tests/tsc-references/asyncAwaitIsolatedModules_es6.2.minified.js @@ -1,5 +1,4 @@ //// [asyncAwaitIsolatedModules_es6.ts] -var M; import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator"; _async_to_generator(function*() {}), _async_to_generator(function*() {}), _async_to_generator(function*() {}), _async_to_generator(function*() {}), _async_to_generator(function*() {}), _async_to_generator(function*() {}), _async_to_generator(function*() { return p; @@ -16,4 +15,4 @@ _async_to_generator(function*() {}), _async_to_generator(function*() {}), _async M.f1 = function() { return _f1.apply(this, arguments); }; -}(M || (M = {})); +}({}); diff --git a/crates/swc/tests/tsc-references/asyncAwait_es2017.2.minified.js b/crates/swc/tests/tsc-references/asyncAwait_es2017.2.minified.js index e025d688800f..628a82a95310 100644 --- a/crates/swc/tests/tsc-references/asyncAwait_es2017.2.minified.js +++ b/crates/swc/tests/tsc-references/asyncAwait_es2017.2.minified.js @@ -1,6 +1,5 @@ //// [asyncAwait_es2017.ts] -var M; !function(M) { async function f1() {} M.f1 = f1; -}(M || (M = {})); +}({}); diff --git a/crates/swc/tests/tsc-references/asyncAwait_es5.2.minified.js b/crates/swc/tests/tsc-references/asyncAwait_es5.2.minified.js index 329c20b0d5c8..febf4c5ff02c 100644 --- a/crates/swc/tests/tsc-references/asyncAwait_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/asyncAwait_es5.2.minified.js @@ -1,5 +1,4 @@ //// [asyncAwait_es5.ts] -var M; import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator"; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator"; @@ -80,4 +79,4 @@ _async_to_generator(function() { M.f1 = function() { return _f1.apply(this, arguments); }; -}(M || (M = {})); +}({}); diff --git a/crates/swc/tests/tsc-references/asyncAwait_es6.2.minified.js b/crates/swc/tests/tsc-references/asyncAwait_es6.2.minified.js index 854a0c852f3f..d4643fe2e5e3 100644 --- a/crates/swc/tests/tsc-references/asyncAwait_es6.2.minified.js +++ b/crates/swc/tests/tsc-references/asyncAwait_es6.2.minified.js @@ -1,5 +1,4 @@ //// [asyncAwait_es6.ts] -var M; import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator"; _async_to_generator(function*() {}), _async_to_generator(function*() {}), _async_to_generator(function*() {}), _async_to_generator(function*() {}), _async_to_generator(function*() {}), _async_to_generator(function*() {}), _async_to_generator(function*() { return p; @@ -16,4 +15,4 @@ _async_to_generator(function*() {}), _async_to_generator(function*() {}), _async M.f1 = function() { return _f1.apply(this, arguments); }; -}(M || (M = {})); +}({}); diff --git a/crates/swc/tests/tsc-references/bestCommonTypeOfTuple.2.minified.js b/crates/swc/tests/tsc-references/bestCommonTypeOfTuple.2.minified.js index e35b17296053..245d3b09211f 100644 --- a/crates/swc/tests/tsc-references/bestCommonTypeOfTuple.2.minified.js +++ b/crates/swc/tests/tsc-references/bestCommonTypeOfTuple.2.minified.js @@ -1,3 +1,3 @@ //// [bestCommonTypeOfTuple.ts] -var E1, E2, E11, E21; -(E11 = E1 || (E1 = {}))[E11.one = 0] = "one", (E21 = E2 || (E2 = {}))[E21.two = 0] = "two"; +var E1, E2; +(E1 = {})[E1.one = 0] = "one", (E2 = {})[E2.two = 0] = "two"; diff --git a/crates/swc/tests/tsc-references/bitwiseNotOperatorWithBooleanType.2.minified.js b/crates/swc/tests/tsc-references/bitwiseNotOperatorWithBooleanType.2.minified.js index 89baac5fa269..8289d08e76c1 100644 --- a/crates/swc/tests/tsc-references/bitwiseNotOperatorWithBooleanType.2.minified.js +++ b/crates/swc/tests/tsc-references/bitwiseNotOperatorWithBooleanType.2.minified.js @@ -8,6 +8,6 @@ var M, A = function() { return !1; }, A; }(); -M || (M = {}); +M = {}; var objA = new A(); objA.a, M.n, A.foo(), objA.a, M.n; diff --git a/crates/swc/tests/tsc-references/bitwiseNotOperatorWithEnumType.2.minified.js b/crates/swc/tests/tsc-references/bitwiseNotOperatorWithEnumType.2.minified.js index fd3ca88bf317..bfba6a29d6a9 100644 --- a/crates/swc/tests/tsc-references/bitwiseNotOperatorWithEnumType.2.minified.js +++ b/crates/swc/tests/tsc-references/bitwiseNotOperatorWithEnumType.2.minified.js @@ -1,3 +1,3 @@ //// [bitwiseNotOperatorWithEnumType.ts] -var ENUM1, ENUM11; -(ENUM11 = ENUM1 || (ENUM1 = {}))[ENUM11.A = 0] = "A", ENUM11[ENUM11.B = 1] = "B", ENUM11[ENUM11[""] = 2] = ""; +var ENUM1; +(ENUM1 = {})[ENUM1.A = 0] = "A", ENUM1[ENUM1.B = 1] = "B", ENUM1[ENUM1[""] = 2] = ""; diff --git a/crates/swc/tests/tsc-references/bitwiseNotOperatorWithNumberType.2.minified.js b/crates/swc/tests/tsc-references/bitwiseNotOperatorWithNumberType.2.minified.js index 6fc3e57c74f6..9e3d05797e83 100644 --- a/crates/swc/tests/tsc-references/bitwiseNotOperatorWithNumberType.2.minified.js +++ b/crates/swc/tests/tsc-references/bitwiseNotOperatorWithNumberType.2.minified.js @@ -8,6 +8,6 @@ var M, A = function() { return 1; }, A; }(); -M || (M = {}); +M = {}; var objA = new A(); objA.a, M.n, A.foo(), objA.a, M.n, objA.a, M.n; diff --git a/crates/swc/tests/tsc-references/bitwiseNotOperatorWithStringType.2.minified.js b/crates/swc/tests/tsc-references/bitwiseNotOperatorWithStringType.2.minified.js index 09729de23798..debd016a6f83 100644 --- a/crates/swc/tests/tsc-references/bitwiseNotOperatorWithStringType.2.minified.js +++ b/crates/swc/tests/tsc-references/bitwiseNotOperatorWithStringType.2.minified.js @@ -8,6 +8,6 @@ var STRING, M, A = function() { return ""; }, A; }(); -M || (M = {}); +M = {}; var objA = new A(); objA.a, M.n, A.foo(), STRING.charAt(0), objA.a, M.n; diff --git a/crates/swc/tests/tsc-references/callSignatureAssignabilityInInheritance3.2.minified.js b/crates/swc/tests/tsc-references/callSignatureAssignabilityInInheritance3.2.minified.js index 2678c24f21bf..32e27c45d4b9 100644 --- a/crates/swc/tests/tsc-references/callSignatureAssignabilityInInheritance3.2.minified.js +++ b/crates/swc/tests/tsc-references/callSignatureAssignabilityInInheritance3.2.minified.js @@ -1,6 +1,4 @@ //// [callSignatureAssignabilityInInheritance3.ts] -var Errors; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _create_super } from "@swc/helpers/_/_create_super"; -Errors || (Errors = {}); diff --git a/crates/swc/tests/tsc-references/callSignatureWithoutReturnTypeAnnotationInference.2.minified.js b/crates/swc/tests/tsc-references/callSignatureWithoutReturnTypeAnnotationInference.2.minified.js index f7abb1637091..a14f4168847d 100644 --- a/crates/swc/tests/tsc-references/callSignatureWithoutReturnTypeAnnotationInference.2.minified.js +++ b/crates/swc/tests/tsc-references/callSignatureWithoutReturnTypeAnnotationInference.2.minified.js @@ -6,10 +6,10 @@ function m1() { } !function foo3() { return foo3(); -}(), _type_of(1), (M = M1 || (M1 = {})).x = 1, M.C = function C() { +}(), _type_of(1), (M = {}).x = 1, M.C = function C() { _class_call_check(this, C); }, (m1 || (m1 = {})).y = 2; -var e1, M, M1, e11, c1 = function c1(x) { +var e1, M, e11, c1 = function c1(x) { _class_call_check(this, c1); }; (c1 || (c1 = {})).x = 1, (e1 = e11 || (e11 = {}))[e1.A = 0] = "A", (e11 || (e11 = {})).y = 1; diff --git a/crates/swc/tests/tsc-references/castingTuple.2.minified.js b/crates/swc/tests/tsc-references/castingTuple.2.minified.js index 784003d3fea0..1e1db180261f 100644 --- a/crates/swc/tests/tsc-references/castingTuple.2.minified.js +++ b/crates/swc/tests/tsc-references/castingTuple.2.minified.js @@ -2,12 +2,12 @@ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _create_super } from "@swc/helpers/_/_create_super"; -var E1, E2, E11, E21, C = function C() { +var E1, E2, C = function C() { _class_call_check(this, C); }, D = function D() { _class_call_check(this, D); }; -(E11 = E1 || (E1 = {}))[E11.one = 0] = "one", (E21 = E2 || (E2 = {}))[E21.one = 0] = "one"; +(E1 = {})[E1.one = 0] = "one", (E2 = {})[E2.one = 0] = "one"; var classCDTuple = [ new C(), new D() diff --git a/crates/swc/tests/tsc-references/circularImportAlias.2.minified.js b/crates/swc/tests/tsc-references/circularImportAlias.2.minified.js index bdc33259e9b5..07c9815e27e2 100644 --- a/crates/swc/tests/tsc-references/circularImportAlias.2.minified.js +++ b/crates/swc/tests/tsc-references/circularImportAlias.2.minified.js @@ -3,13 +3,13 @@ var B, A, B1, D, A1; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _create_super } from "@swc/helpers/_/_create_super"; -(B1 = B || (B = {})).a = A, D = function(_B_a_C) { +(B1 = B = {}).a = A, D = function(_B_a_C) { _inherits(D, _B_a_C); var _super = _create_super(D); function D() { return _class_call_check(this, D), _super.apply(this, arguments); } return D; -}(B1.a.C), B1.D = D, (A1 = A || (A = {})).C = function C() { +}(B1.a.C), B1.D = D, (A1 = A = {}).C = function C() { _class_call_check(this, C); }, A1.b = B, new B.a.C(); diff --git a/crates/swc/tests/tsc-references/classAbstractImportInstantiation.2.minified.js b/crates/swc/tests/tsc-references/classAbstractImportInstantiation.2.minified.js index 2be563d02dc3..1275cf7640b4 100644 --- a/crates/swc/tests/tsc-references/classAbstractImportInstantiation.2.minified.js +++ b/crates/swc/tests/tsc-references/classAbstractImportInstantiation.2.minified.js @@ -1,6 +1,6 @@ //// [classAbstractImportInstantiation.ts] var M, A, M1; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -M = M1 || (M1 = {}), A = function A() { +M = M1 = {}, A = function A() { _class_call_check(this, A); }, M.A = A, new A, new M1.A; diff --git a/crates/swc/tests/tsc-references/classAbstractInAModule.2.minified.js b/crates/swc/tests/tsc-references/classAbstractInAModule.2.minified.js index b379811fea8a..92a9191c5fa6 100644 --- a/crates/swc/tests/tsc-references/classAbstractInAModule.2.minified.js +++ b/crates/swc/tests/tsc-references/classAbstractInAModule.2.minified.js @@ -3,7 +3,7 @@ var M, M1, A, B; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _create_super } from "@swc/helpers/_/_create_super"; -M1 = M || (M = {}), A = function A() { +M1 = M = {}, A = function A() { _class_call_check(this, A); }, M1.A = A, B = function(A) { _inherits(B, A); diff --git a/crates/swc/tests/tsc-references/classAndInterfaceWithSameName.2.minified.js b/crates/swc/tests/tsc-references/classAndInterfaceWithSameName.2.minified.js index dc4f705dbd39..1a6d842318fd 100644 --- a/crates/swc/tests/tsc-references/classAndInterfaceWithSameName.2.minified.js +++ b/crates/swc/tests/tsc-references/classAndInterfaceWithSameName.2.minified.js @@ -1,4 +1,2 @@ //// [classAndInterfaceWithSameName.ts] -var M; import "@swc/helpers/_/_class_call_check"; -M || (M = {}); diff --git a/crates/swc/tests/tsc-references/classConstructorAccessibility.2.minified.js b/crates/swc/tests/tsc-references/classConstructorAccessibility.2.minified.js index 225e19c7ad89..b7a0fb1f1f2a 100644 --- a/crates/swc/tests/tsc-references/classConstructorAccessibility.2.minified.js +++ b/crates/swc/tests/tsc-references/classConstructorAccessibility.2.minified.js @@ -1,5 +1,4 @@ //// [classConstructorAccessibility.ts] -var Generic; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; new function C(x) { _class_call_check(this, C), this.x = x; @@ -7,7 +6,7 @@ new function C(x) { _class_call_check(this, D), this.x = x; }(1), new function E(x) { _class_call_check(this, E), this.x = x; -}(1), Generic || (Generic = {}), new function C(x) { +}(1), new function C(x) { _class_call_check(this, C), this.x = x; }(1), new function D(x) { _class_call_check(this, D), this.x = x; diff --git a/crates/swc/tests/tsc-references/classDoesNotDependOnPrivateMember.2.minified.js b/crates/swc/tests/tsc-references/classDoesNotDependOnPrivateMember.2.minified.js index 379c2d3ea27b..9f6290df0551 100644 --- a/crates/swc/tests/tsc-references/classDoesNotDependOnPrivateMember.2.minified.js +++ b/crates/swc/tests/tsc-references/classDoesNotDependOnPrivateMember.2.minified.js @@ -1,6 +1,2 @@ //// [classDoesNotDependOnPrivateMember.ts] -var M; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -(M || (M = {})).C = function C() { - _class_call_check(this, C); -}; diff --git a/crates/swc/tests/tsc-references/classExpression.2.minified.js b/crates/swc/tests/tsc-references/classExpression.2.minified.js index 6e9cfdcbcc09..2c293eec9a29 100644 --- a/crates/swc/tests/tsc-references/classExpression.2.minified.js +++ b/crates/swc/tests/tsc-references/classExpression.2.minified.js @@ -1,4 +1,2 @@ //// [classExpression.ts] -var M; import "@swc/helpers/_/_class_call_check"; -M || (M = {}); diff --git a/crates/swc/tests/tsc-references/classExtendsItselfIndirectly2.2.minified.js b/crates/swc/tests/tsc-references/classExtendsItselfIndirectly2.2.minified.js index 17695e5cc4ce..f333f50e2c65 100644 --- a/crates/swc/tests/tsc-references/classExtendsItselfIndirectly2.2.minified.js +++ b/crates/swc/tests/tsc-references/classExtendsItselfIndirectly2.2.minified.js @@ -2,7 +2,7 @@ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _create_super } from "@swc/helpers/_/_create_super"; -var M, D, N, E, P, Q, C2, P1, D2, Q1, E2, M1, N1, O, C = function(_N_E) { +var M, D, N, E, P, Q, C2, P1, D2, Q1, E2, M1, N1, C = function(_N_E) { _inherits(C, _N_E); var _super = _create_super(C); function C() { @@ -10,35 +10,35 @@ var M, D, N, E, P, Q, C2, P1, D2, Q1, E2, M1, N1, O, C = function(_N_E) { } return C; }(N1.E); -M = M1 || (M1 = {}), D = function(C) { +M = M1 = {}, D = function(C) { _inherits(D, C); var _super = _create_super(D); function D() { return _class_call_check(this, D), _super.apply(this, arguments); } return D; -}(C), M.D = D, N = N1 || (N1 = {}), E = function(_M_D) { +}(C), M.D = D, N = N1 = {}, E = function(_M_D) { _inherits(E, _M_D); var _super = _create_super(E); function E() { return _class_call_check(this, E), _super.apply(this, arguments); } return E; -}(M1.D), N.E = E, O || (O = {}), C2 = function(_Q_E2) { +}(M1.D), N.E = E, C2 = function(_Q_E2) { _inherits(C2, _Q_E2); var _super = _create_super(C2); function C2() { return _class_call_check(this, C2), _super.apply(this, arguments); } return C2; -}(Q.E2), P1 = P || (P = {}), D2 = function(C2) { +}(Q.E2), P1 = P = {}, D2 = function(C2) { _inherits(D2, C2); var _super = _create_super(D2); function D2() { return _class_call_check(this, D2), _super.apply(this, arguments); } return D2; -}(C2), P1.D2 = D2, Q1 = Q || (Q = {}), E2 = function(_P_D2) { +}(C2), P1.D2 = D2, Q1 = Q = {}, E2 = function(_P_D2) { _inherits(E2, _P_D2); var _super = _create_super(E2); function E2() { diff --git a/crates/swc/tests/tsc-references/classExtendsShadowedConstructorFunction.2.minified.js b/crates/swc/tests/tsc-references/classExtendsShadowedConstructorFunction.2.minified.js index 4a58207d8123..a1d7657d909b 100644 --- a/crates/swc/tests/tsc-references/classExtendsShadowedConstructorFunction.2.minified.js +++ b/crates/swc/tests/tsc-references/classExtendsShadowedConstructorFunction.2.minified.js @@ -1,6 +1,4 @@ //// [classExtendsShadowedConstructorFunction.ts] -var M; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _create_super } from "@swc/helpers/_/_create_super"; -M || (M = {}); diff --git a/crates/swc/tests/tsc-references/classWithConstructors.2.minified.js b/crates/swc/tests/tsc-references/classWithConstructors.2.minified.js index 416cb7392c10..b9397eceaa47 100644 --- a/crates/swc/tests/tsc-references/classWithConstructors.2.minified.js +++ b/crates/swc/tests/tsc-references/classWithConstructors.2.minified.js @@ -1,9 +1,9 @@ //// [classWithConstructors.ts] -var NonGeneric, Generics, C, C2, D, C1, C21, D1; +var C, C2, D, C1, C21, D1; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _create_super } from "@swc/helpers/_/_create_super"; -NonGeneric || (NonGeneric = {}), new (C = function C(x) { +new (C = function C(x) { _class_call_check(this, C); })(), new C(''), new (C2 = function C2(x) { _class_call_check(this, C2); @@ -14,7 +14,7 @@ NonGeneric || (NonGeneric = {}), new (C = function C(x) { return _class_call_check(this, D), _super.apply(this, arguments); } return D; -}(C2))(), new D(1), new D(''), Generics || (Generics = {}), new (C1 = function C(x) { +}(C2))(), new D(1), new D(''), new (C1 = function C(x) { _class_call_check(this, C); })(), new C1(''), new (C21 = function C2(x) { _class_call_check(this, C2); diff --git a/crates/swc/tests/tsc-references/commonJSImportNotAsPrimaryExpression.2.minified.js b/crates/swc/tests/tsc-references/commonJSImportNotAsPrimaryExpression.2.minified.js index c18d2b9820d4..d78a7944866a 100644 --- a/crates/swc/tests/tsc-references/commonJSImportNotAsPrimaryExpression.2.minified.js +++ b/crates/swc/tests/tsc-references/commonJSImportNotAsPrimaryExpression.2.minified.js @@ -17,7 +17,7 @@ Object.defineProperty(exports, "__esModule", { var E1, E11, _class_call_check = require("@swc/helpers/_/_class_call_check"), C1 = function C1() { _class_call_check._(this, C1), this.m1 = 42; }; -C1.s1 = !0, (E1 = E11 || (E11 = {}))[E1.A = 0] = "A", E1[E1.B = 1] = "B", E1[E1.C = 2] = "C"; +C1.s1 = !0, (E1 = E11 = {})[E1.A = 0] = "A", E1[E1.B = 1] = "B", E1[E1.C = 2] = "C"; //// [foo_1.ts] Object.defineProperty(exports, "__esModule", { value: !0 diff --git a/crates/swc/tests/tsc-references/comparisonOperatorWithNoRelationshipPrimitiveType.2.minified.js b/crates/swc/tests/tsc-references/comparisonOperatorWithNoRelationshipPrimitiveType.2.minified.js index aa63e51eda85..7dd4a21be2a3 100644 --- a/crates/swc/tests/tsc-references/comparisonOperatorWithNoRelationshipPrimitiveType.2.minified.js +++ b/crates/swc/tests/tsc-references/comparisonOperatorWithNoRelationshipPrimitiveType.2.minified.js @@ -1,3 +1,3 @@ //// [comparisonOperatorWithNoRelationshipPrimitiveType.ts] -var E, E1; -(E1 = E || (E = {}))[E1.a = 0] = "a", E1[E1.b = 1] = "b", E1[E1.c = 2] = "c"; +var E; +(E = {})[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c"; diff --git a/crates/swc/tests/tsc-references/comparisonOperatorWithNoRelationshipTypeParameter.2.minified.js b/crates/swc/tests/tsc-references/comparisonOperatorWithNoRelationshipTypeParameter.2.minified.js index 17c17241fa66..49a884766ff8 100644 --- a/crates/swc/tests/tsc-references/comparisonOperatorWithNoRelationshipTypeParameter.2.minified.js +++ b/crates/swc/tests/tsc-references/comparisonOperatorWithNoRelationshipTypeParameter.2.minified.js @@ -1,3 +1,3 @@ //// [comparisonOperatorWithNoRelationshipTypeParameter.ts] -var E, E1; -(E1 = E || (E = {}))[E1.a = 0] = "a", E1[E1.b = 1] = "b", E1[E1.c = 2] = "c"; +var E; +(E = {})[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c"; diff --git a/crates/swc/tests/tsc-references/comparisonOperatorWithOneOperandIsAny.2.minified.js b/crates/swc/tests/tsc-references/comparisonOperatorWithOneOperandIsAny.2.minified.js index 67b426464867..744a53149ee4 100644 --- a/crates/swc/tests/tsc-references/comparisonOperatorWithOneOperandIsAny.2.minified.js +++ b/crates/swc/tests/tsc-references/comparisonOperatorWithOneOperandIsAny.2.minified.js @@ -1,3 +1,3 @@ //// [comparisonOperatorWithOneOperandIsAny.ts] -var E, E1; -(E1 = E || (E = {}))[E1.a = 0] = "a", E1[E1.b = 1] = "b", E1[E1.c = 2] = "c"; +var E; +(E = {})[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c"; diff --git a/crates/swc/tests/tsc-references/comparisonOperatorWithOneOperandIsUndefined.2.minified.js b/crates/swc/tests/tsc-references/comparisonOperatorWithOneOperandIsUndefined.2.minified.js index 4112127cf614..82faa09c6cf5 100644 --- a/crates/swc/tests/tsc-references/comparisonOperatorWithOneOperandIsUndefined.2.minified.js +++ b/crates/swc/tests/tsc-references/comparisonOperatorWithOneOperandIsUndefined.2.minified.js @@ -1,3 +1,3 @@ //// [comparisonOperatorWithOneOperandIsUndefined.ts] -var E, E1; -(E1 = E || (E = {}))[E1.a = 0] = "a", E1[E1.b = 1] = "b", E1[E1.c = 2] = "c"; +var E; +(E = {})[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c"; diff --git a/crates/swc/tests/tsc-references/comparisonOperatorWithSubtypeEnumAndNumber.2.minified.js b/crates/swc/tests/tsc-references/comparisonOperatorWithSubtypeEnumAndNumber.2.minified.js index 7794dd7f9aec..89086c09d00e 100644 --- a/crates/swc/tests/tsc-references/comparisonOperatorWithSubtypeEnumAndNumber.2.minified.js +++ b/crates/swc/tests/tsc-references/comparisonOperatorWithSubtypeEnumAndNumber.2.minified.js @@ -1,3 +1,3 @@ //// [comparisonOperatorWithSubtypeEnumAndNumber.ts] -var E, E1; -(E1 = E || (E = {}))[E1.a = 0] = "a", E1[E1.b = 1] = "b", E1[E1.c = 2] = "c"; +var E; +(E = {})[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c"; diff --git a/crates/swc/tests/tsc-references/compoundAdditionAssignmentLHSCanBeAssigned.2.minified.js b/crates/swc/tests/tsc-references/compoundAdditionAssignmentLHSCanBeAssigned.2.minified.js index b3fceee5d403..8ddd15192595 100644 --- a/crates/swc/tests/tsc-references/compoundAdditionAssignmentLHSCanBeAssigned.2.minified.js +++ b/crates/swc/tests/tsc-references/compoundAdditionAssignmentLHSCanBeAssigned.2.minified.js @@ -1,3 +1,3 @@ //// [compoundAdditionAssignmentLHSCanBeAssigned.ts] -var E, E1; -(E1 = E || (E = {}))[E1.a = 0] = "a", E1[E1.b = 1] = "b"; +var E; +(E = {})[E.a = 0] = "a", E[E.b = 1] = "b"; diff --git a/crates/swc/tests/tsc-references/compoundAdditionAssignmentLHSCannotBeAssigned.2.minified.js b/crates/swc/tests/tsc-references/compoundAdditionAssignmentLHSCannotBeAssigned.2.minified.js index fb2a1b6cdbc5..346b9b8a9656 100644 --- a/crates/swc/tests/tsc-references/compoundAdditionAssignmentLHSCannotBeAssigned.2.minified.js +++ b/crates/swc/tests/tsc-references/compoundAdditionAssignmentLHSCannotBeAssigned.2.minified.js @@ -1,3 +1,3 @@ //// [compoundAdditionAssignmentLHSCannotBeAssigned.ts] -var E, E1; -(E1 = E || (E = {}))[E1.a = 0] = "a", E1[E1.b = 1] = "b", E1[E1.c = 2] = "c"; +var E; +(E = {})[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c"; diff --git a/crates/swc/tests/tsc-references/compoundAdditionAssignmentWithInvalidOperands.2.minified.js b/crates/swc/tests/tsc-references/compoundAdditionAssignmentWithInvalidOperands.2.minified.js index 8cdd8fee4bd1..0ad94623e7e2 100644 --- a/crates/swc/tests/tsc-references/compoundAdditionAssignmentWithInvalidOperands.2.minified.js +++ b/crates/swc/tests/tsc-references/compoundAdditionAssignmentWithInvalidOperands.2.minified.js @@ -1,3 +1,3 @@ //// [compoundAdditionAssignmentWithInvalidOperands.ts] -var E, E1; -(E1 = E || (E = {}))[E1.a = 0] = "a", E1[E1.b = 1] = "b"; +var E; +(E = {})[E.a = 0] = "a", E[E.b = 1] = "b"; diff --git a/crates/swc/tests/tsc-references/computedPropertyNames19_ES5.2.minified.js b/crates/swc/tests/tsc-references/computedPropertyNames19_ES5.2.minified.js index db8c3813778f..9997c7777b31 100644 --- a/crates/swc/tests/tsc-references/computedPropertyNames19_ES5.2.minified.js +++ b/crates/swc/tests/tsc-references/computedPropertyNames19_ES5.2.minified.js @@ -1,6 +1,5 @@ //// [computedPropertyNames19_ES5.ts] -var M; import { _ as _define_property } from "@swc/helpers/_/_define_property"; !function(M) { _define_property({}, this.bar, 0); -}(M || (M = {})); +}(0); diff --git a/crates/swc/tests/tsc-references/computedPropertyNames19_ES6.2.minified.js b/crates/swc/tests/tsc-references/computedPropertyNames19_ES6.2.minified.js index 20b2b1d03754..a7d57994e515 100644 --- a/crates/swc/tests/tsc-references/computedPropertyNames19_ES6.2.minified.js +++ b/crates/swc/tests/tsc-references/computedPropertyNames19_ES6.2.minified.js @@ -1,5 +1,4 @@ //// [computedPropertyNames19_ES6.ts] -var M; !function(M) { this.bar; -}(M || (M = {})); +}(0); diff --git a/crates/swc/tests/tsc-references/computedPropertyNames47_ES5.2.minified.js b/crates/swc/tests/tsc-references/computedPropertyNames47_ES5.2.minified.js index 04fcbe64ec3f..1410bc1b5ce5 100644 --- a/crates/swc/tests/tsc-references/computedPropertyNames47_ES5.2.minified.js +++ b/crates/swc/tests/tsc-references/computedPropertyNames47_ES5.2.minified.js @@ -1,4 +1,4 @@ //// [computedPropertyNames47_ES5.ts] -var E1, E2, E11, E21; +var E1, E2; import { _ as _define_property } from "@swc/helpers/_/_define_property"; -(E11 = E1 || (E1 = {}))[E11.x = 0] = "x", (E21 = E2 || (E2 = {}))[E21.x = 0] = "x", _define_property({}, 0, 0); +(E1 = {})[E1.x = 0] = "x", (E2 = {})[E2.x = 0] = "x", _define_property({}, 0, 0); diff --git a/crates/swc/tests/tsc-references/computedPropertyNames47_ES6.2.minified.js b/crates/swc/tests/tsc-references/computedPropertyNames47_ES6.2.minified.js index 21cd63781374..27bedc1cf396 100644 --- a/crates/swc/tests/tsc-references/computedPropertyNames47_ES6.2.minified.js +++ b/crates/swc/tests/tsc-references/computedPropertyNames47_ES6.2.minified.js @@ -1,3 +1,3 @@ //// [computedPropertyNames47_ES6.ts] -var E1, E2, E11, E21; -(E11 = E1 || (E1 = {}))[E11.x = 0] = "x", (E21 = E2 || (E2 = {}))[E21.x = 0] = "x"; +var E1, E2; +(E1 = {})[E1.x = 0] = "x", (E2 = {})[E2.x = 0] = "x"; diff --git a/crates/swc/tests/tsc-references/computedPropertyNames48_ES5.2.minified.js b/crates/swc/tests/tsc-references/computedPropertyNames48_ES5.2.minified.js index 69a37aa0b49c..854435487c61 100644 --- a/crates/swc/tests/tsc-references/computedPropertyNames48_ES5.2.minified.js +++ b/crates/swc/tests/tsc-references/computedPropertyNames48_ES5.2.minified.js @@ -1,4 +1,4 @@ //// [computedPropertyNames48_ES5.ts] -var E, a, E1; +var a, E; import { _ as _define_property } from "@swc/helpers/_/_define_property"; -(E1 = E || (E = {}))[E1.x = 0] = "x", extractIndexer(_define_property({}, a, "")), extractIndexer(_define_property({}, 0, "")), extractIndexer(_define_property({}, 0, "")); +(E = {})[E.x = 0] = "x", extractIndexer(_define_property({}, a, "")), extractIndexer(_define_property({}, 0, "")), extractIndexer(_define_property({}, 0, "")); diff --git a/crates/swc/tests/tsc-references/computedPropertyNames48_ES6.2.minified.js b/crates/swc/tests/tsc-references/computedPropertyNames48_ES6.2.minified.js index 1b8ed78fd5a7..e801120b851e 100644 --- a/crates/swc/tests/tsc-references/computedPropertyNames48_ES6.2.minified.js +++ b/crates/swc/tests/tsc-references/computedPropertyNames48_ES6.2.minified.js @@ -1,6 +1,6 @@ //// [computedPropertyNames48_ES6.ts] -var E, a, E1; -(E1 = E || (E = {}))[E1.x = 0] = "x", extractIndexer({ +var a, E; +(E = {})[E.x = 0] = "x", extractIndexer({ [a]: "" }), extractIndexer({ 0: "" diff --git a/crates/swc/tests/tsc-references/computedPropertyNames7_ES5.2.minified.js b/crates/swc/tests/tsc-references/computedPropertyNames7_ES5.2.minified.js index ad39adae6361..8865b81a09c0 100644 --- a/crates/swc/tests/tsc-references/computedPropertyNames7_ES5.2.minified.js +++ b/crates/swc/tests/tsc-references/computedPropertyNames7_ES5.2.minified.js @@ -1,4 +1,4 @@ //// [computedPropertyNames7_ES5.ts] -var E, E1; +var E; import { _ as _define_property } from "@swc/helpers/_/_define_property"; -(E1 = E || (E = {}))[E1.member = 0] = "member", _define_property({}, 0, 0); +(E = {})[E.member = 0] = "member", _define_property({}, 0, 0); diff --git a/crates/swc/tests/tsc-references/computedPropertyNames7_ES6.2.minified.js b/crates/swc/tests/tsc-references/computedPropertyNames7_ES6.2.minified.js index 05c4be82d83f..17fd73d81800 100644 --- a/crates/swc/tests/tsc-references/computedPropertyNames7_ES6.2.minified.js +++ b/crates/swc/tests/tsc-references/computedPropertyNames7_ES6.2.minified.js @@ -1,3 +1,3 @@ //// [computedPropertyNames7_ES6.ts] -var E, E1; -(E1 = E || (E = {}))[E1.member = 0] = "member"; +var E; +(E = {})[E.member = 0] = "member"; diff --git a/crates/swc/tests/tsc-references/constEnum2.2.minified.js b/crates/swc/tests/tsc-references/constEnum2.2.minified.js index c0d8d1a52917..a27a7adae19b 100644 --- a/crates/swc/tests/tsc-references/constEnum2.2.minified.js +++ b/crates/swc/tests/tsc-references/constEnum2.2.minified.js @@ -1,3 +1,3 @@ //// [constEnum2.ts] -var D, D1; -(D1 = D || (D = {}))[D1.e = 199 * Math.floor(1000 * Math.random())] = "e", D1[D1.f = 10 - 100 * Math.floor(Math.random() % 8)] = "f", D1[D1.g = 0] = "g"; +var D; +(D = {})[D.e = 199 * Math.floor(1000 * Math.random())] = "e", D[D.f = 10 - 100 * Math.floor(Math.random() % 8)] = "f", D[D.g = 0] = "g"; diff --git a/crates/swc/tests/tsc-references/constructSignatureAssignabilityInInheritance.2.minified.js b/crates/swc/tests/tsc-references/constructSignatureAssignabilityInInheritance.2.minified.js index 7f871b5b0893..d158ae2ec3ea 100644 --- a/crates/swc/tests/tsc-references/constructSignatureAssignabilityInInheritance.2.minified.js +++ b/crates/swc/tests/tsc-references/constructSignatureAssignabilityInInheritance.2.minified.js @@ -1,3 +1,2 @@ //// [constructSignatureAssignabilityInInheritance.ts] -var MemberWithConstructSignature; -MemberWithConstructSignature || (MemberWithConstructSignature = {}), new (void 0).a(1); +new (void 0).a(1); diff --git a/crates/swc/tests/tsc-references/constructSignatureAssignabilityInInheritance3.2.minified.js b/crates/swc/tests/tsc-references/constructSignatureAssignabilityInInheritance3.2.minified.js index 6d607befadfb..9f6d00598a1f 100644 --- a/crates/swc/tests/tsc-references/constructSignatureAssignabilityInInheritance3.2.minified.js +++ b/crates/swc/tests/tsc-references/constructSignatureAssignabilityInInheritance3.2.minified.js @@ -1,6 +1,4 @@ //// [constructSignatureAssignabilityInInheritance3.ts] -var Errors; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _create_super } from "@swc/helpers/_/_create_super"; -Errors || (Errors = {}); diff --git a/crates/swc/tests/tsc-references/constructorHasPrototypeProperty.2.minified.js b/crates/swc/tests/tsc-references/constructorHasPrototypeProperty.2.minified.js index e1775c24769c..7739a199a9ec 100644 --- a/crates/swc/tests/tsc-references/constructorHasPrototypeProperty.2.minified.js +++ b/crates/swc/tests/tsc-references/constructorHasPrototypeProperty.2.minified.js @@ -1,9 +1,9 @@ //// [constructorHasPrototypeProperty.ts] -var NonGeneric, Generic, C, D, C1, D1; +var C, D, C1, D1; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _create_super } from "@swc/helpers/_/_create_super"; -NonGeneric || (NonGeneric = {}), D = function(C) { +D = function(C) { _inherits(D, C); var _super = _create_super(D); function D() { @@ -12,7 +12,7 @@ NonGeneric || (NonGeneric = {}), D = function(C) { return D; }(C = function C() { _class_call_check(this, C); -}), C.prototype.foo, D.prototype.bar, Generic || (Generic = {}), D1 = function(C) { +}), C.prototype.foo, D.prototype.bar, D1 = function(C) { _inherits(D, C); var _super = _create_super(D); function D() { diff --git a/crates/swc/tests/tsc-references/declarationsAndAssignments.2.minified.js b/crates/swc/tests/tsc-references/declarationsAndAssignments.2.minified.js index 16ebbe31be5b..d3431e528cab 100644 --- a/crates/swc/tests/tsc-references/declarationsAndAssignments.2.minified.js +++ b/crates/swc/tests/tsc-references/declarationsAndAssignments.2.minified.js @@ -1,5 +1,5 @@ //// [declarationsAndAssignments.ts] -var M, M1; +var M; import "@swc/helpers/_/_object_destructuring_empty"; import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array"; import "@swc/helpers/_/_to_array"; @@ -35,7 +35,7 @@ f14([ y: !1 } ] -]), (M1 = M || (M = {})).a = 1, M1.b = 2, f17({}), f17({ +]), (M = {}).a = 1, M.b = 2, f17({}), f17({ a: "hello" }), f17({ c: !0 diff --git a/crates/swc/tests/tsc-references/decoratorOnClassMethod11.2.minified.js b/crates/swc/tests/tsc-references/decoratorOnClassMethod11.2.minified.js index ccf5586923dd..bddbff911a8d 100644 --- a/crates/swc/tests/tsc-references/decoratorOnClassMethod11.2.minified.js +++ b/crates/swc/tests/tsc-references/decoratorOnClassMethod11.2.minified.js @@ -1,5 +1,4 @@ //// [decoratorOnClassMethod11.ts] -var M; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate"; !function(M) { @@ -13,4 +12,4 @@ import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate"; _ts_decorate([ this.decorator ], C.prototype, "method", null); -}(M || (M = {})); +}(0); diff --git a/crates/swc/tests/tsc-references/decoratorOnClassMethod12.2.minified.js b/crates/swc/tests/tsc-references/decoratorOnClassMethod12.2.minified.js index cd29930ef76e..413e1a736a51 100644 --- a/crates/swc/tests/tsc-references/decoratorOnClassMethod12.2.minified.js +++ b/crates/swc/tests/tsc-references/decoratorOnClassMethod12.2.minified.js @@ -1,10 +1,10 @@ //// [decoratorOnClassMethod12.ts] -var M, C; +var C; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _create_super } from "@swc/helpers/_/_create_super"; import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate"; -M || (M = {}), C = function(S) { +C = function(S) { _inherits(C, S); var _super = _create_super(C); function C() { diff --git a/crates/swc/tests/tsc-references/decrementOperatorWithAnyOtherType.2.minified.js b/crates/swc/tests/tsc-references/decrementOperatorWithAnyOtherType.2.minified.js index bfe4e4119650..0066448d2047 100644 --- a/crates/swc/tests/tsc-references/decrementOperatorWithAnyOtherType.2.minified.js +++ b/crates/swc/tests/tsc-references/decrementOperatorWithAnyOtherType.2.minified.js @@ -7,7 +7,7 @@ var ANY, ANY1, M, ANY2 = [ x: 1, y: null }; -M || (M = {}); +M = {}; var objA = new function A() { _class_call_check(this, A); }(); diff --git a/crates/swc/tests/tsc-references/decrementOperatorWithEnumType.2.minified.js b/crates/swc/tests/tsc-references/decrementOperatorWithEnumType.2.minified.js index 5946247a8de7..23f35f0fbc26 100644 --- a/crates/swc/tests/tsc-references/decrementOperatorWithEnumType.2.minified.js +++ b/crates/swc/tests/tsc-references/decrementOperatorWithEnumType.2.minified.js @@ -1,3 +1,3 @@ //// [decrementOperatorWithEnumType.ts] var ENUM1, ENUM11; -(ENUM11 = ENUM1 || (ENUM1 = {}))[ENUM11.A = 0] = "A", ENUM11[ENUM11.B = 1] = "B", ENUM11[ENUM11[""] = 2] = "", --ENUM1.A, ENUM1.A--, --ENUM1.A, ENUM1[A]--; +(ENUM11 = ENUM1 = {})[ENUM11.A = 0] = "A", ENUM11[ENUM11.B = 1] = "B", ENUM11[ENUM11[""] = 2] = "", --ENUM1.A, ENUM1.A--, --ENUM1.A, ENUM1[A]--; diff --git a/crates/swc/tests/tsc-references/decrementOperatorWithNumberType.2.minified.js b/crates/swc/tests/tsc-references/decrementOperatorWithNumberType.2.minified.js index faac5ac6d9a9..0f393327ca43 100644 --- a/crates/swc/tests/tsc-references/decrementOperatorWithNumberType.2.minified.js +++ b/crates/swc/tests/tsc-references/decrementOperatorWithNumberType.2.minified.js @@ -4,7 +4,7 @@ var NUMBER, M, NUMBER1 = [ 1, 2 ]; -M || (M = {}); +M = {}; var objA = new function A() { _class_call_check(this, A); }(); diff --git a/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment7(target=es5).2.minified.js b/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment7(target=es5).2.minified.js index 4e9eeb790eee..dc96c0608074 100644 --- a/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment7(target=es5).2.minified.js +++ b/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment7(target=es5).2.minified.js @@ -1,5 +1,5 @@ //// [destructuringObjectBindingPatternAndAssignment7.ts] import { _ as _define_property } from "@swc/helpers/_/_define_property"; -(K = K1 || (K1 = {})).a = "a", K.b = "b"; -var K, _obj, K1, _ref = (_define_property(_obj = {}, "a", 1), _define_property(_obj, "b", 1), _obj); +(K = {}).a = "a", K.b = "b"; +var K, _obj, _ref = (_define_property(_obj = {}, "a", 1), _define_property(_obj, "b", 1), _obj); console.log(_ref.a, _ref.b); 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 index 70138587b574..fc97d01c4b1b 100644 --- a/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment7(target=esnext).2.minified.js +++ b/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment7(target=esnext).2.minified.js @@ -1,6 +1,6 @@ //// [destructuringObjectBindingPatternAndAssignment7.ts] -var K, K1; -(K1 = K || (K = {})).a = "a", K1.b = "b"; +var K; +(K = {}).a = "a", K.b = "b"; const { a: aVal, b: bVal } = { a: 1, b: 1 diff --git a/crates/swc/tests/tsc-references/destructuringParameterDeclaration3ES5.2.minified.js b/crates/swc/tests/tsc-references/destructuringParameterDeclaration3ES5.2.minified.js index c535e0778345..5ddcd1af188e 100644 --- a/crates/swc/tests/tsc-references/destructuringParameterDeclaration3ES5.2.minified.js +++ b/crates/swc/tests/tsc-references/destructuringParameterDeclaration3ES5.2.minified.js @@ -1,5 +1,5 @@ //// [destructuringParameterDeclaration3ES5.ts] -var E, E1, array = [ +var E, array = [ 1, 2, 3 @@ -19,4 +19,4 @@ var E, E1, array = [ ]), function([a, b, c, ...x]) {}([ 1, 2 -]), (E = E1 || (E1 = {}))[E.a = 0] = "a", E[E.b = 1] = "b"; +]), (E = {})[E.a = 0] = "a", E[E.b = 1] = "b"; diff --git a/crates/swc/tests/tsc-references/destructuringParameterDeclaration3ES5iterable.2.minified.js b/crates/swc/tests/tsc-references/destructuringParameterDeclaration3ES5iterable.2.minified.js index fd3f62c15878..973f9d18f198 100644 --- a/crates/swc/tests/tsc-references/destructuringParameterDeclaration3ES5iterable.2.minified.js +++ b/crates/swc/tests/tsc-references/destructuringParameterDeclaration3ES5iterable.2.minified.js @@ -6,7 +6,7 @@ function a10(param) { var _param = _to_array(param), _param_ = (_param[0], _param[1], _sliced_to_array(_param[2], 1)); _sliced_to_array(_param_[0], 1)[0], _param.slice(3); } -var _param, _param_, _param1, E, E1, array = [ +var _param, _param_, _param1, E, array = [ 1, 2, 3 @@ -53,4 +53,4 @@ function foo1() { ]), (_param1 = _to_array([ 1, 2 -]))[0], _param1[1], _param1[2], _param1.slice(3), foo("hello", 1, 2), foo("hello", "world"), (E = E1 || (E1 = {}))[E.a = 0] = "a", E[E.b = 1] = "b", foo1(1, 2, 3, 0), foo1(1, 2, 3, 0, 1); +]))[0], _param1[1], _param1[2], _param1.slice(3), foo("hello", 1, 2), foo("hello", "world"), (E = {})[E.a = 0] = "a", E[E.b = 1] = "b", foo1(1, 2, 3, 0), foo1(1, 2, 3, 0, 1); diff --git a/crates/swc/tests/tsc-references/destructuringParameterDeclaration3ES6.2.minified.js b/crates/swc/tests/tsc-references/destructuringParameterDeclaration3ES6.2.minified.js index b95d9e1d8b75..40d095820722 100644 --- a/crates/swc/tests/tsc-references/destructuringParameterDeclaration3ES6.2.minified.js +++ b/crates/swc/tests/tsc-references/destructuringParameterDeclaration3ES6.2.minified.js @@ -1,5 +1,5 @@ //// [destructuringParameterDeclaration3ES6.ts] -var E, E1, array = [ +var E, array = [ 1, 2, 3 @@ -19,4 +19,4 @@ var E, E1, array = [ ]), function([a, b, c, ...x]) {}([ 1, 2 -]), (E = E1 || (E1 = {}))[E.a = 0] = "a", E[E.b = 1] = "b"; +]), (E = {})[E.a = 0] = "a", E[E.b = 1] = "b"; diff --git a/crates/swc/tests/tsc-references/duplicateStringIndexers.2.minified.js b/crates/swc/tests/tsc-references/duplicateStringIndexers.2.minified.js index 9eef58876446..970896b52a5e 100644 --- a/crates/swc/tests/tsc-references/duplicateStringIndexers.2.minified.js +++ b/crates/swc/tests/tsc-references/duplicateStringIndexers.2.minified.js @@ -1,4 +1,2 @@ //// [duplicateStringIndexers.ts] -var test; import "@swc/helpers/_/_class_call_check"; -test || (test = {}); diff --git a/crates/swc/tests/tsc-references/enumAssignability.2.minified.js b/crates/swc/tests/tsc-references/enumAssignability.2.minified.js index 819663176ecc..060b33da3a7a 100644 --- a/crates/swc/tests/tsc-references/enumAssignability.2.minified.js +++ b/crates/swc/tests/tsc-references/enumAssignability.2.minified.js @@ -1,4 +1,4 @@ //// [enumAssignability.ts] -var E, F, E1, F1, Others; +var E, F; import "@swc/helpers/_/_class_call_check"; -(E = E1 || (E1 = {}))[E.A = 0] = "A", (F = F1 || (F1 = {}))[F.B = 0] = "B", Others || (Others = {}); +(E = {})[E.A = 0] = "A", (F = {})[F.B = 0] = "B"; diff --git a/crates/swc/tests/tsc-references/enumAssignabilityInInheritance.2.minified.js b/crates/swc/tests/tsc-references/enumAssignabilityInInheritance.2.minified.js index 0ea39c8e77fc..c58dcc974f75 100644 --- a/crates/swc/tests/tsc-references/enumAssignabilityInInheritance.2.minified.js +++ b/crates/swc/tests/tsc-references/enumAssignabilityInInheritance.2.minified.js @@ -1,8 +1,8 @@ //// [enumAssignabilityInInheritance.ts] import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; function f() {} -(E = E1 || (E1 = {}))[E.A = 0] = "A", foo(0), foo(1), foo(null), foo2(0), foo3(0), foo4(0), foo5(0), foo6(0), foo7(0), foo8(0), foo9(0), foo10(0), foo11(0), foo12(0), (E2 = E21 || (E21 = {}))[E2.A = 0] = "A", foo13(0), (f || (f = {})).bar = 1, foo14(0); -var E, E2, E1, E21, CC = function CC() { +(E = {})[E.A = 0] = "A", foo(0), foo(1), foo(null), foo2(0), foo3(0), foo4(0), foo5(0), foo6(0), foo7(0), foo8(0), foo9(0), foo10(0), foo11(0), foo12(0), (E2 = {})[E2.A = 0] = "A", foo13(0), (f || (f = {})).bar = 1, foo14(0); +var E, E2, CC = function CC() { _class_call_check(this, CC); }; (CC || (CC = {})).bar = 1, foo15(0), foo16(0), foo16(0); diff --git a/crates/swc/tests/tsc-references/enumBasics.2.minified.js b/crates/swc/tests/tsc-references/enumBasics.2.minified.js index c8e0e8e104e9..21e0fe1a7fb1 100644 --- a/crates/swc/tests/tsc-references/enumBasics.2.minified.js +++ b/crates/swc/tests/tsc-references/enumBasics.2.minified.js @@ -1,4 +1,3 @@ //// [enumBasics.ts] -(E1 = E11 || (E11 = {}))[E1.A = 0] = "A", E1[E1.B = 1] = "B", E1[E1.C = 2] = "C"; -var E2, E3, E4, E5, E6, E7, E8, E9, E1, E11, E21, E31, E41, E51, E61, E71, E81, E91, e = E11; -E11[e.A], (E2 = E21 || (E21 = {}))[E2.A = 1] = "A", E2[E2.B = 2] = "B", E2[E2.C = 3] = "C", (E3 = E31 || (E31 = {}))[E3.X = 3] = "X", E3[E3.Y = 7] = "Y", E3[E3.Z = NaN] = "Z", (E4 = E41 || (E41 = {}))[E4.X = 0] = "X", E4[E4.Y = 1] = "Y", E4[E4.Z = 3] = "Z", (E5 = E51 || (E51 = {}))[E5.A = 0] = "A", E5[E5.B = 3] = "B", E5[E5.C = 4] = "C", (E6 = E61 || (E61 = {}))[E6.A = 0] = "A", E6[E6.B = 0] = "B", E6[E6.C = 1] = "C", (E7 = E71 || (E71 = {}))[E7.A = 'foo'.foo] = "A", (E8 = E81 || (E81 = {}))[E8.B = 'foo'.foo] = "B", (E9 = E91 || (E91 = {}))[E9.A = 0] = "A", E9[E9.B = 0] = "B", E81.B, E71.A, E41.Z, E31.X, E31.Z; +var E2, E3, E4, E5, E6, E7, E8, E9, E1, E11, E31, E41, E71, E81; +(E1 = E11 = {})[E1.A = 0] = "A", E1[E1.B = 1] = "B", E1[E1.C = 2] = "C", E11[E11.A], (E2 = {})[E2.A = 1] = "A", E2[E2.B = 2] = "B", E2[E2.C = 3] = "C", (E3 = E31 = {})[E3.X = 3] = "X", E3[E3.Y = 7] = "Y", E3[E3.Z = NaN] = "Z", (E4 = E41 = {})[E4.X = 0] = "X", E4[E4.Y = 1] = "Y", E4[E4.Z = 3] = "Z", (E5 = {})[E5.A = 0] = "A", E5[E5.B = 3] = "B", E5[E5.C = 4] = "C", (E6 = {})[E6.A = 0] = "A", E6[E6.B = 0] = "B", E6[E6.C = 1] = "C", (E7 = E71 = {})[E7.A = 'foo'.foo] = "A", (E8 = E81 = {})[E8.B = 'foo'.foo] = "B", (E9 = {})[E9.A = 0] = "A", E9[E9.B = 0] = "B", E81.B, E71.A, E41.Z, E31.X, E31.Z; diff --git a/crates/swc/tests/tsc-references/enumClassification.2.minified.js b/crates/swc/tests/tsc-references/enumClassification.2.minified.js index c503e75ba576..ce3d70f0c9a4 100644 --- a/crates/swc/tests/tsc-references/enumClassification.2.minified.js +++ b/crates/swc/tests/tsc-references/enumClassification.2.minified.js @@ -1,3 +1,3 @@ //// [enumClassification.ts] -var E01, E02, E03, E04, E05, E06, E07, E08, E10, E11, E12, E20, E011, E021, E041, E051, E061, E071, E081, E111, E121, E201; -(E011 = E01 || (E01 = {}))[E011.A = 0] = "A", (E021 = E02 || (E02 = {}))[E021.A = 123] = "A", (E03 || (E03 = {})).A = "hello", (E041 = E04 || (E04 = {}))[E041.A = 0] = "A", E041[E041.B = 1] = "B", E041[E041.C = 2] = "C", (E051 = E05 || (E05 = {}))[E051.A = 0] = "A", E051[E051.B = 10] = "B", E051[E051.C = 11] = "C", (E061 = E06 || (E06 = {})).A = "one", E061.B = "two", E061.C = "three", (E071 = E07 || (E07 = {}))[E071.A = 0] = "A", E071[E071.B = 1] = "B", E071.C = "hi", E071[E071.D = 10] = "D", E071[E071.E = 11] = "E", E071.F = "bye", (E081 = E08 || (E08 = {}))[E081.A = 10] = "A", E081.B = "hello", E081[E081.C = 10] = "C", E081.D = "hello", E081[E081.E = 10] = "E", E10 || (E10 = {}), (E111 = E11 || (E11 = {}))[E111.A = 0] = "A", E111[E111.B = 1] = "B", E111[E111.C = 2] = "C", (E121 = E12 || (E12 = {}))[E121.A = 1] = "A", E121[E121.B = 2] = "B", E121[E121.C = 4] = "C", (E201 = E20 || (E20 = {}))[E201.A = 3] = "A", E201[E201.B = E201.A + 1] = "B", E201[E201.C = 123] = "C", E201[E201.D = 0.8414709848078965] = "D"; +var E01, E02, E04, E05, E06, E07, E08, E11, E12, E20; +(E01 = {})[E01.A = 0] = "A", (E02 = {})[E02.A = 123] = "A", (E04 = {})[E04.A = 0] = "A", E04[E04.B = 1] = "B", E04[E04.C = 2] = "C", (E05 = {})[E05.A = 0] = "A", E05[E05.B = 10] = "B", E05[E05.C = 11] = "C", (E06 = {}).A = "one", E06.B = "two", E06.C = "three", (E07 = {})[E07.A = 0] = "A", E07[E07.B = 1] = "B", E07.C = "hi", E07[E07.D = 10] = "D", E07[E07.E = 11] = "E", E07.F = "bye", (E08 = {})[E08.A = 10] = "A", E08.B = "hello", E08[E08.C = 10] = "C", E08.D = "hello", E08[E08.E = 10] = "E", (E11 = {})[E11.A = 0] = "A", E11[E11.B = 1] = "B", E11[E11.C = 2] = "C", (E12 = {})[E12.A = 1] = "A", E12[E12.B = 2] = "B", E12[E12.C = 4] = "C", (E20 = {})[E20.A = 3] = "A", E20[E20.B = E20.A + 1] = "B", E20[E20.C = 123] = "C", E20[E20.D = 0.8414709848078965] = "D"; diff --git a/crates/swc/tests/tsc-references/enumConstantMemberWithString.2.minified.js b/crates/swc/tests/tsc-references/enumConstantMemberWithString.2.minified.js index 79e3fbf55c30..43ce6de10212 100644 --- a/crates/swc/tests/tsc-references/enumConstantMemberWithString.2.minified.js +++ b/crates/swc/tests/tsc-references/enumConstantMemberWithString.2.minified.js @@ -1,3 +1,3 @@ //// [enumConstantMemberWithString.ts] -var T1, T2, T3, T4, T5, T11, T21, T31; -(T11 = T1 || (T1 = {})).a = "1", T11.b = "12", T11.c = "123", T11[T11.d = NaN] = "d", T11.e = "a1", (T21 = T2 || (T2 = {})).a = "1", T21.b = "12", (T31 = T3 || (T3 = {})).a = "1", T31.b = "12", T31[T31.c = 1] = "c", T31[T31.d = 3] = "d", (T4 || (T4 = {})).a = "1", (T5 || (T5 = {})).a = "12"; +var T1, T2, T3; +(T1 = {}).a = "1", T1.b = "12", T1.c = "123", T1[T1.d = NaN] = "d", T1.e = "a1", (T2 = {}).a = "1", T2.b = "12", (T3 = {}).a = "1", T3.b = "12", T3[T3.c = 1] = "c", T3[T3.d = 3] = "d"; diff --git a/crates/swc/tests/tsc-references/enumConstantMemberWithStringEmitDeclaration.2.minified.js b/crates/swc/tests/tsc-references/enumConstantMemberWithStringEmitDeclaration.2.minified.js index 3faa6e625d4e..35f4b12257db 100644 --- a/crates/swc/tests/tsc-references/enumConstantMemberWithStringEmitDeclaration.2.minified.js +++ b/crates/swc/tests/tsc-references/enumConstantMemberWithStringEmitDeclaration.2.minified.js @@ -1,3 +1,3 @@ //// [enumConstantMemberWithStringEmitDeclaration.ts] -var T1, T2, T3, T4, T5, T11, T21, T31; -(T11 = T1 || (T1 = {})).a = "1", T11.b = "12", T11.c = "123", (T21 = T2 || (T2 = {})).a = "1", T21.b = "12", (T31 = T3 || (T3 = {})).a = "1", T31.b = "12", (T4 || (T4 = {})).a = "1", (T5 || (T5 = {})).a = "12"; +var T1, T2, T3; +(T1 = {}).a = "1", T1.b = "12", T1.c = "123", (T2 = {}).a = "1", T2.b = "12", (T3 = {}).a = "1", T3.b = "12"; diff --git a/crates/swc/tests/tsc-references/enumConstantMemberWithTemplateLiterals.2.minified.js b/crates/swc/tests/tsc-references/enumConstantMemberWithTemplateLiterals.2.minified.js index ce6ef711efa9..3b75176ba9ff 100644 --- a/crates/swc/tests/tsc-references/enumConstantMemberWithTemplateLiterals.2.minified.js +++ b/crates/swc/tests/tsc-references/enumConstantMemberWithTemplateLiterals.2.minified.js @@ -1,3 +1,3 @@ //// [enumConstantMemberWithTemplateLiterals.ts] -var T1, T2, T3, T4, T5, T6, T21, T41, T51, T61; -(T1 || (T1 = {})).a = "1", (T21 = T2 || (T2 = {})).a = "1", T21.b = "2", T21[T21.c = 3] = "c", (T3 || (T3 = {})).a = "11", (T41 = T4 || (T4 = {})).a = "1", T41.b = "11", T41.c = "12", T41.d = "21", T41.e = "211", (T51 = T5 || (T5 = {})).a = "1", T51.b = "12", T51.c = "123", T51[T51.d = 1] = "d", T51[T51.e = 0] = "e", T51.f = "11", T51.g = "123", T51[T51.h = 1] = "h", (T61 = T6 || (T6 = {}))[T61.a = 1] = "a", T61[T61.b = 2] = "b"; +var T2, T4, T5, T6; +(T2 = {}).a = "1", T2.b = "2", T2[T2.c = 3] = "c", (T4 = {}).a = "1", T4.b = "11", T4.c = "12", T4.d = "21", T4.e = "211", (T5 = {}).a = "1", T5.b = "12", T5.c = "123", T5[T5.d = 1] = "d", T5[T5.e = 0] = "e", T5.f = "11", T5.g = "123", T5[T5.h = 1] = "h", (T6 = {})[T6.a = 1] = "a", T6[T6.b = 2] = "b"; diff --git a/crates/swc/tests/tsc-references/enumConstantMemberWithTemplateLiteralsEmitDeclaration.2.minified.js b/crates/swc/tests/tsc-references/enumConstantMemberWithTemplateLiteralsEmitDeclaration.2.minified.js index 01de87abdd5d..c407e145a914 100644 --- a/crates/swc/tests/tsc-references/enumConstantMemberWithTemplateLiteralsEmitDeclaration.2.minified.js +++ b/crates/swc/tests/tsc-references/enumConstantMemberWithTemplateLiteralsEmitDeclaration.2.minified.js @@ -1,3 +1,3 @@ //// [enumConstantMemberWithTemplateLiteralsEmitDeclaration.ts] -var T1, T2, T3, T4, T5, T6, T21, T41, T51, T61; -(T1 || (T1 = {})).a = "1", (T21 = T2 || (T2 = {})).a = "1", T21.b = "2", T21[T21.c = 3] = "c", (T3 || (T3 = {})).a = "11", (T41 = T4 || (T4 = {})).a = "1", T41.b = "11", T41.c = "12", T41.d = "21", T41.e = "211", (T51 = T5 || (T5 = {})).a = "1", T51.b = "12", T51.c = "123", T51[T51.d = 1] = "d", (T61 = T6 || (T6 = {}))[T61.a = 1] = "a", T61[T61.b = 2] = "b"; +var T2, T4, T5, T6; +(T2 = {}).a = "1", T2.b = "2", T2[T2.c = 3] = "c", (T4 = {}).a = "1", T4.b = "11", T4.c = "12", T4.d = "21", T4.e = "211", (T5 = {}).a = "1", T5.b = "12", T5.c = "123", T5[T5.d = 1] = "d", (T6 = {})[T6.a = 1] = "a", T6[T6.b = 2] = "b"; diff --git a/crates/swc/tests/tsc-references/enumIsNotASubtypeOfAnythingButNumber.2.minified.js b/crates/swc/tests/tsc-references/enumIsNotASubtypeOfAnythingButNumber.2.minified.js index 8bcec1ecd984..6c3350ac7ff6 100644 --- a/crates/swc/tests/tsc-references/enumIsNotASubtypeOfAnythingButNumber.2.minified.js +++ b/crates/swc/tests/tsc-references/enumIsNotASubtypeOfAnythingButNumber.2.minified.js @@ -1,8 +1,8 @@ //// [enumIsNotASubtypeOfAnythingButNumber.ts] import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; function f() {} -(E = E1 || (E1 = {}))[E.A = 0] = "A", (E2 = E21 || (E21 = {}))[E2.A = 0] = "A", (f || (f = {})).bar = 1; -var E, E2, E1, E21, c = function c() { +(E = {})[E.A = 0] = "A", (E2 = {})[E2.A = 0] = "A", (f || (f = {})).bar = 1; +var E, E2, c = function c() { _class_call_check(this, c); }; (c || (c = {})).bar = 1; diff --git a/crates/swc/tests/tsc-references/enumMerging.2.minified.js b/crates/swc/tests/tsc-references/enumMerging.2.minified.js index e389fba8c45e..73dc41e327c4 100644 --- a/crates/swc/tests/tsc-references/enumMerging.2.minified.js +++ b/crates/swc/tests/tsc-references/enumMerging.2.minified.js @@ -1,3 +1,3 @@ //// [enumMerging.ts] -var M1, M2, M3, M4, M5, M6, M11, EImpl1, EImpl11, EImpl12, EConst1, EConst11, M21, EComp2, EComp21, EComp22, EInit, EInit1, EInit2, M41, Color, M51, Color1, M61, A, Color2, M62, A1, Color3, A2; -M11 = M1 || (M1 = {}), (EImpl11 = EImpl1 || (EImpl1 = {}))[EImpl11.A = 0] = "A", EImpl11[EImpl11.B = 1] = "B", EImpl11[EImpl11.C = 2] = "C", (EImpl12 = EImpl1 || (EImpl1 = {}))[EImpl12.D = 1] = "D", EImpl12[EImpl12.E = 2] = "E", EImpl12[EImpl12.F = 3] = "F", (EConst1 = M11.EConst1 || (M11.EConst1 = {}))[EConst1.A = 3] = "A", EConst1[EConst1.B = 2] = "B", EConst1[EConst1.C = 1] = "C", (EConst11 = M11.EConst1 || (M11.EConst1 = {}))[EConst11.D = 7] = "D", EConst11[EConst11.E = 9] = "E", EConst11[EConst11.F = 8] = "F", (EComp21 = EComp2 = (M21 = M2 || (M2 = {})).EComp2 || (M21.EComp2 = {}))[EComp21.A = 3] = "A", EComp21[EComp21.B = 3] = "B", EComp21[EComp21.C = 3] = "C", (EComp22 = EComp2 = M21.EComp2 || (M21.EComp2 = {}))[EComp22.D = 3] = "D", EComp22[EComp22.E = 3] = "E", EComp22[EComp22.F = 3] = "F", EComp2.A, EComp2.B, EComp2.C, EComp2.D, EComp2.E, EComp2.F, M3 || (M3 = {}), (EInit1 = EInit || (EInit = {}))[EInit1.A = 0] = "A", EInit1[EInit1.B = 1] = "B", (EInit2 = EInit || (EInit = {}))[EInit2.C = 1] = "C", EInit2[EInit2.D = 2] = "D", EInit2[EInit2.E = 3] = "E", (Color = (M41 = M4 || (M4 = {})).Color || (M41.Color = {}))[Color.Red = 0] = "Red", Color[Color.Green = 1] = "Green", Color[Color.Blue = 2] = "Blue", (Color1 = (M51 = M5 || (M5 = {})).Color || (M51.Color = {}))[Color1.Red = 0] = "Red", Color1[Color1.Green = 1] = "Green", Color1[Color1.Blue = 2] = "Blue", (Color2 = (A = (M61 = M6 || (M6 = {})).A || (M61.A = {})).Color || (A.Color = {}))[Color2.Red = 0] = "Red", Color2[Color2.Green = 1] = "Green", Color2[Color2.Blue = 2] = "Blue", (Color3 = (A1 = A2 = (M62 = M6 || (M6 = {})).A || (M62.A = {})).Color || (A1.Color = {}))[Color3.Yellow = 1] = "Yellow", A2.Color.Yellow, A2.Color.Red; +var M6, M1, EImpl1, EImpl11, EImpl12, EConst1, EConst11, M2, EComp2, EComp21, EComp22, EInit, EInit1, EInit2, M4, Color, M5, Color1, M61, A, Color2, M62, A1, Color3, A2; +M1 = {}, (EImpl11 = EImpl1 || (EImpl1 = {}))[EImpl11.A = 0] = "A", EImpl11[EImpl11.B = 1] = "B", EImpl11[EImpl11.C = 2] = "C", (EImpl12 = EImpl1 || (EImpl1 = {}))[EImpl12.D = 1] = "D", EImpl12[EImpl12.E = 2] = "E", EImpl12[EImpl12.F = 3] = "F", (EConst1 = M1.EConst1 || (M1.EConst1 = {}))[EConst1.A = 3] = "A", EConst1[EConst1.B = 2] = "B", EConst1[EConst1.C = 1] = "C", (EConst11 = M1.EConst1 || (M1.EConst1 = {}))[EConst11.D = 7] = "D", EConst11[EConst11.E = 9] = "E", EConst11[EConst11.F = 8] = "F", (EComp21 = EComp2 = (M2 = {}).EComp2 || (M2.EComp2 = {}))[EComp21.A = 3] = "A", EComp21[EComp21.B = 3] = "B", EComp21[EComp21.C = 3] = "C", (EComp22 = EComp2 = M2.EComp2 || (M2.EComp2 = {}))[EComp22.D = 3] = "D", EComp22[EComp22.E = 3] = "E", EComp22[EComp22.F = 3] = "F", EComp2.A, EComp2.B, EComp2.C, EComp2.D, EComp2.E, EComp2.F, (EInit1 = EInit || (EInit = {}))[EInit1.A = 0] = "A", EInit1[EInit1.B = 1] = "B", (EInit2 = EInit || (EInit = {}))[EInit2.C = 1] = "C", EInit2[EInit2.D = 2] = "D", EInit2[EInit2.E = 3] = "E", (Color = (M4 = {}).Color || (M4.Color = {}))[Color.Red = 0] = "Red", Color[Color.Green = 1] = "Green", Color[Color.Blue = 2] = "Blue", (Color1 = (M5 = {}).Color || (M5.Color = {}))[Color1.Red = 0] = "Red", Color1[Color1.Green = 1] = "Green", Color1[Color1.Blue = 2] = "Blue", (Color2 = (A = (M61 = M6 || (M6 = {})).A || (M61.A = {})).Color || (A.Color = {}))[Color2.Red = 0] = "Red", Color2[Color2.Green = 1] = "Green", Color2[Color2.Blue = 2] = "Blue", (Color3 = (A1 = A2 = (M62 = M6 || (M6 = {})).A || (M62.A = {})).Color || (A1.Color = {}))[Color3.Yellow = 1] = "Yellow", A2.Color.Yellow, A2.Color.Red; diff --git a/crates/swc/tests/tsc-references/enums.2.minified.js b/crates/swc/tests/tsc-references/enums.2.minified.js index 55b616c85228..f61050160588 100644 --- a/crates/swc/tests/tsc-references/enums.2.minified.js +++ b/crates/swc/tests/tsc-references/enums.2.minified.js @@ -1,6 +1,6 @@ //// [/a.ts] -var SyntaxKind, SymbolFlags, SyntaxKind1, SymbolFlags1; -(SyntaxKind1 = SyntaxKind || (SyntaxKind = {}))[SyntaxKind1.ImportClause = 0] = "ImportClause", SyntaxKind1[SyntaxKind1.ExportDeclaration = 1] = "ExportDeclaration", (SymbolFlags1 = SymbolFlags || (SymbolFlags = {})).Type = "Type", SymbolFlags1.Value = "Value"; +var SymbolFlags, SyntaxKind, SymbolFlags1; +(SyntaxKind = {})[SyntaxKind.ImportClause = 0] = "ImportClause", SyntaxKind[SyntaxKind.ExportDeclaration = 1] = "ExportDeclaration", (SymbolFlags1 = SymbolFlags = {}).Type = "Type", SymbolFlags1.Value = "Value"; export { SymbolFlags }; //// [/b.ts] SyntaxKind.ImportClause, SymbolFlags.Type; diff --git a/crates/swc/tests/tsc-references/equalityWithEnumTypes.2.minified.js b/crates/swc/tests/tsc-references/equalityWithEnumTypes.2.minified.js index 08857fc806b6..1539a3d7a0a4 100644 --- a/crates/swc/tests/tsc-references/equalityWithEnumTypes.2.minified.js +++ b/crates/swc/tests/tsc-references/equalityWithEnumTypes.2.minified.js @@ -1,3 +1,3 @@ //// [equalityWithEnumTypes.ts] -var E1, E2, E11, E21; -(E11 = E1 || (E1 = {}))[E11.a = 1] = "a", E11[E11.b = 2] = "b", (E21 = E2 || (E2 = {}))[E21.a = 1] = "a", E21[E21.b = 2] = "b"; +var E1, E2; +(E1 = {})[E1.a = 1] = "a", E1[E1.b = 2] = "b", (E2 = {})[E2.a = 1] = "a", E2[E2.b = 2] = "b"; diff --git a/crates/swc/tests/tsc-references/everyTypeAssignableToAny.2.minified.js b/crates/swc/tests/tsc-references/everyTypeAssignableToAny.2.minified.js index 698b1ee53aa4..a639585b9664 100644 --- a/crates/swc/tests/tsc-references/everyTypeAssignableToAny.2.minified.js +++ b/crates/swc/tests/tsc-references/everyTypeAssignableToAny.2.minified.js @@ -1,4 +1,4 @@ //// [everyTypeAssignableToAny.ts] -var E, E1; +var E; import "@swc/helpers/_/_class_call_check"; -(E1 = E || (E = {}))[E1.A = 0] = "A"; +(E = {})[E.A = 0] = "A"; diff --git a/crates/swc/tests/tsc-references/everyTypeWithAnnotationAndInitializer.2.minified.js b/crates/swc/tests/tsc-references/everyTypeWithAnnotationAndInitializer.2.minified.js index bc89db106549..d53662099f11 100644 --- a/crates/swc/tests/tsc-references/everyTypeWithAnnotationAndInitializer.2.minified.js +++ b/crates/swc/tests/tsc-references/everyTypeWithAnnotationAndInitializer.2.minified.js @@ -3,7 +3,7 @@ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var M, M1, C = function C() { _class_call_check(this, C); }; -(M = M1 || (M1 = {})).A = function A() { +(M = M1 = {}).A = function A() { _class_call_check(this, A); }, M.F2 = function(x) { return x.toString(); diff --git a/crates/swc/tests/tsc-references/everyTypeWithAnnotationAndInvalidInitializer.2.minified.js b/crates/swc/tests/tsc-references/everyTypeWithAnnotationAndInvalidInitializer.2.minified.js index 8396bc6a8fe2..1c56c7cd2451 100644 --- a/crates/swc/tests/tsc-references/everyTypeWithAnnotationAndInvalidInitializer.2.minified.js +++ b/crates/swc/tests/tsc-references/everyTypeWithAnnotationAndInvalidInitializer.2.minified.js @@ -1,15 +1,15 @@ //// [everyTypeWithAnnotationAndInvalidInitializer.ts] import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -var M, N, M1, N1, C = function C() { +var M, N, N1, C = function C() { _class_call_check(this, C); }, D = function D() { _class_call_check(this, D); }; -(M = M1 || (M1 = {})).A = function A() { +(M = {}).A = function A() { _class_call_check(this, A); }, M.F2 = function(x) { return x.toString(); -}, (N = N1 || (N1 = {})).A = function A() { +}, (N = N1 = {}).A = function A() { _class_call_check(this, A); }, N.F2 = function(x) { return x.toString(); diff --git a/crates/swc/tests/tsc-references/everyTypeWithInitializer.2.minified.js b/crates/swc/tests/tsc-references/everyTypeWithInitializer.2.minified.js index ab324fb0f9b2..570a6c5a5dfc 100644 --- a/crates/swc/tests/tsc-references/everyTypeWithInitializer.2.minified.js +++ b/crates/swc/tests/tsc-references/everyTypeWithInitializer.2.minified.js @@ -3,7 +3,7 @@ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var M, M1, C = function C() { _class_call_check(this, C); }; -(M = M1 || (M1 = {})).A = function A() { +(M = M1 = {}).A = function A() { _class_call_check(this, A); }, M.F2 = function(x) { return x.toString(); diff --git a/crates/swc/tests/tsc-references/exhaustiveSwitchStatements1.2.minified.js b/crates/swc/tests/tsc-references/exhaustiveSwitchStatements1.2.minified.js index b64d0c2ef220..e9e98ed6a585 100644 --- a/crates/swc/tests/tsc-references/exhaustiveSwitchStatements1.2.minified.js +++ b/crates/swc/tests/tsc-references/exhaustiveSwitchStatements1.2.minified.js @@ -1,3 +1,3 @@ //// [exhaustiveSwitchStatements1.ts] -var E, MyEnum, Level, Animal, E1, MyEnum1, Level1, Animal1; -(E1 = E || (E = {}))[E1.A = 0] = "A", E1[E1.B = 1] = "B", (MyEnum1 = MyEnum || (MyEnum = {}))[MyEnum1.A = 0] = "A", MyEnum1[MyEnum1.B = 1] = "B", (Level1 = Level || (Level = {}))[Level1.One = 0] = "One", Level1[Level1.Two = 1] = "Two", (Animal1 = Animal || (Animal = {}))[Animal1.DOG = 0] = "DOG", Animal1[Animal1.CAT = 1] = "CAT"; +var E, MyEnum, Level, Animal; +(E = {})[E.A = 0] = "A", E[E.B = 1] = "B", (MyEnum = {})[MyEnum.A = 0] = "A", MyEnum[MyEnum.B = 1] = "B", (Level = {})[Level.One = 0] = "One", Level[Level.Two = 1] = "Two", (Animal = {})[Animal.DOG = 0] = "DOG", Animal[Animal.CAT = 1] = "CAT"; diff --git a/crates/swc/tests/tsc-references/exponentiationOperatorWithEnum.2.minified.js b/crates/swc/tests/tsc-references/exponentiationOperatorWithEnum.2.minified.js index cab6919535c6..005cdf958914 100644 --- a/crates/swc/tests/tsc-references/exponentiationOperatorWithEnum.2.minified.js +++ b/crates/swc/tests/tsc-references/exponentiationOperatorWithEnum.2.minified.js @@ -1,3 +1,3 @@ //// [exponentiationOperatorWithEnum.ts] -var E, E1; -(E1 = E || (E = {}))[E1.a = 0] = "a", E1[E1.b = 1] = "b"; +var E; +(E = {})[E.a = 0] = "a", E[E.b = 1] = "b"; diff --git a/crates/swc/tests/tsc-references/exponentiationOperatorWithEnumUnion.2.minified.js b/crates/swc/tests/tsc-references/exponentiationOperatorWithEnumUnion.2.minified.js index d045847b5614..6456f2f49e34 100644 --- a/crates/swc/tests/tsc-references/exponentiationOperatorWithEnumUnion.2.minified.js +++ b/crates/swc/tests/tsc-references/exponentiationOperatorWithEnumUnion.2.minified.js @@ -1,3 +1,3 @@ //// [exponentiationOperatorWithEnumUnion.ts] -var E, F, E1, F1; -(E1 = E || (E = {}))[E1.a = 0] = "a", E1[E1.b = 1] = "b", (F1 = F || (F = {}))[F1.c = 0] = "c", F1[F1.d = 1] = "d"; +var E, F; +(E = {})[E.a = 0] = "a", E[E.b = 1] = "b", (F = {})[F.c = 0] = "c", F[F.d = 1] = "d"; diff --git a/crates/swc/tests/tsc-references/exponentiationOperatorWithInvalidOperands.2.minified.js b/crates/swc/tests/tsc-references/exponentiationOperatorWithInvalidOperands.2.minified.js index 6f86587ee6e2..ce6451b6de2e 100644 --- a/crates/swc/tests/tsc-references/exponentiationOperatorWithInvalidOperands.2.minified.js +++ b/crates/swc/tests/tsc-references/exponentiationOperatorWithInvalidOperands.2.minified.js @@ -1,3 +1,3 @@ //// [exponentiationOperatorWithInvalidOperands.ts] -var E, E1; -(E1 = E || (E = {}))[E1.a = 0] = "a", E1[E1.b = 1] = "b", E1[E1.c = 2] = "c"; +var E; +(E = {})[E.a = 0] = "a", E[E.b = 1] = "b", E[E.c = 2] = "c"; diff --git a/crates/swc/tests/tsc-references/exportAssignmentAndDeclaration.2.minified.js b/crates/swc/tests/tsc-references/exportAssignmentAndDeclaration.2.minified.js index 57ebe9dfe0d8..fdeead9a64ed 100644 --- a/crates/swc/tests/tsc-references/exportAssignmentAndDeclaration.2.minified.js +++ b/crates/swc/tests/tsc-references/exportAssignmentAndDeclaration.2.minified.js @@ -3,8 +3,8 @@ define([ "require", "@swc/helpers/_/_class_call_check" ], function(require, _class_call_check) { - var E1, E11; - return (E1 = E11 || (E11 = {}))[E1.A = 0] = "A", E1[E1.B = 1] = "B", E1[E1.C = 2] = "C", function C1() { + var E1; + return (E1 = {})[E1.A = 0] = "A", E1[E1.B = 1] = "B", E1[E1.C = 2] = "C", function C1() { _class_call_check._(this, C1); }; }); diff --git a/crates/swc/tests/tsc-references/exportAssignmentCircularModules.2.minified.js b/crates/swc/tests/tsc-references/exportAssignmentCircularModules.2.minified.js index e8dfa47d707c..7bf72a0b6980 100644 --- a/crates/swc/tests/tsc-references/exportAssignmentCircularModules.2.minified.js +++ b/crates/swc/tests/tsc-references/exportAssignmentCircularModules.2.minified.js @@ -4,7 +4,7 @@ define([ "./foo_1" ], function(require, _foo_1) { var Foo; - return (Foo || (Foo = {})).x = _foo_1.x, Foo; + return (Foo = {}).x = _foo_1.x, Foo; }); //// [foo_1.ts] define([ @@ -12,7 +12,7 @@ define([ "./foo_2" ], function(require, _foo_2) { var Foo; - return (Foo || (Foo = {})).x = _foo_2.x, Foo; + return (Foo = {}).x = _foo_2.x, Foo; }); //// [foo_2.ts] define([ @@ -20,5 +20,5 @@ define([ "./foo_0" ], function(require, _foo_0) { var Foo; - return (Foo || (Foo = {})).x = _foo_0.x, Foo; + return (Foo = {}).x = _foo_0.x, Foo; }); diff --git a/crates/swc/tests/tsc-references/exportAssignmentTopLevelIdentifier.2.minified.js b/crates/swc/tests/tsc-references/exportAssignmentTopLevelIdentifier.2.minified.js index d0e6841759d1..0272105e5b67 100644 --- a/crates/swc/tests/tsc-references/exportAssignmentTopLevelIdentifier.2.minified.js +++ b/crates/swc/tests/tsc-references/exportAssignmentTopLevelIdentifier.2.minified.js @@ -3,7 +3,7 @@ define([ "require" ], function(require) { var Foo; - return (Foo || (Foo = {})).answer = 42, Foo; + return (Foo = {}).answer = 42, Foo; }); //// [foo_1.ts] define([ diff --git a/crates/swc/tests/tsc-references/exportCodeGen.2.minified.js b/crates/swc/tests/tsc-references/exportCodeGen.2.minified.js index fe1dbb74193d..62283c6b954d 100644 --- a/crates/swc/tests/tsc-references/exportCodeGen.2.minified.js +++ b/crates/swc/tests/tsc-references/exportCodeGen.2.minified.js @@ -1,8 +1,6 @@ //// [exportCodeGen.ts] -var A, B, C, D, E, F, E1, Color, Color1, M, Color2; +var E, Color, Color1; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -(A || (A = {})).x = 12, B || (B = {}), C || (C = {}), (D || (D = {})).yes = function() { - return !0; -}, (Color = (E1 = E || (E = {})).Color || (E1.Color = {}))[Color.Red = 0] = "Red", E1.fn = function() {}, E1.C = function C() { +(Color = (E = {}).Color || (E.Color = {}))[Color.Red = 0] = "Red", E.fn = function() {}, E.C = function C() { _class_call_check(this, C); -}, (E1.M || (E1.M = {})).x = 42, F || (F = {}), (Color2 = Color1 || (Color1 = {}))[Color2.Red = 0] = "Red", M || (M = {}); +}, (E.M || (E.M = {})).x = 42, (Color1 = {})[Color1.Red = 0] = "Red"; diff --git a/crates/swc/tests/tsc-references/exportImportAlias.2.minified.js b/crates/swc/tests/tsc-references/exportImportAlias.2.minified.js index 045e06badb65..3d3a8420b4ef 100644 --- a/crates/swc/tests/tsc-references/exportImportAlias.2.minified.js +++ b/crates/swc/tests/tsc-references/exportImportAlias.2.minified.js @@ -1,15 +1,15 @@ //// [exportImportAlias.ts] var A, C, X, Z, K, M, A1, K1, L; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -(A1 = A || (A = {})).x = 'hello world', A1.Point = function Point(x, y) { +(A1 = A = {}).x = 'hello world', A1.Point = function Point(x, y) { _class_call_check(this, Point), this.x = x, this.y = y; -}, (C || (C = {})).a = A, C.a.x, new C.a.Point(0, 0), function(X) { +}, (C = {}).a = A, C.a.x, new C.a.Point(0, 0), function(X) { function Y() { return 42; } X.Y = Y, (Y = X.Y || (X.Y = {})).Point = function Point(x, y) { _class_call_check(this, Point), this.x = x, this.y = y; }; -}(X || (X = {})), (Z || (Z = {})).y = X.Y, Z.y(), new Z.y.Point(0, 0), K1 = K || (K = {}), L = function L(name) { +}(X = {}), (Z = {}).y = X.Y, Z.y(), new Z.y.Point(0, 0), K1 = K = {}, L = function L(name) { _class_call_check(this, L), this.name = name; -}, K1.L = L, (L = K1.L || (K1.L = {})).y = 12, (M || (M = {})).D = K.L, new M.D('Hello'); +}, K1.L = L, (L = K1.L || (K1.L = {})).y = 12, (M = {}).D = K.L, new M.D('Hello'); diff --git a/crates/swc/tests/tsc-references/exportsAndImports1-amd.2.minified.js b/crates/swc/tests/tsc-references/exportsAndImports1-amd.2.minified.js index 923f31346f93..4753c8465573 100644 --- a/crates/swc/tests/tsc-references/exportsAndImports1-amd.2.minified.js +++ b/crates/swc/tests/tsc-references/exportsAndImports1-amd.2.minified.js @@ -43,8 +43,8 @@ define([ var C = function C() { _class_call_check._(this, C); }; - (E = E1 || (E1 = {}))[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C", (D = D1 || (D1 = {}))[D.A = 0] = "A", D[D.B = 1] = "B", D[D.C = 2] = "C", M || (M = {}); - var a = M.x; + (E = E1 = {})[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C", (D = D1 = {})[D.A = 0] = "A", D[D.B = 1] = "B", D[D.C = 2] = "C"; + var a = (M = {}).x; }); //// [t2.ts] define([ diff --git a/crates/swc/tests/tsc-references/exportsAndImports1-es6.2.minified.js b/crates/swc/tests/tsc-references/exportsAndImports1-es6.2.minified.js index 4de842a67260..e8a887cc866b 100644 --- a/crates/swc/tests/tsc-references/exportsAndImports1-es6.2.minified.js +++ b/crates/swc/tests/tsc-references/exportsAndImports1-es6.2.minified.js @@ -34,8 +34,8 @@ var E, D, E1, D1, M, v = 1; function f() {} class C { } -(E = E1 || (E1 = {}))[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C", (D = D1 || (D1 = {}))[D.A = 0] = "A", D[D.B = 1] = "B", D[D.C = 2] = "C", M || (M = {}); -const a = M.x; +(E = E1 = {})[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C", (D = D1 = {})[D.A = 0] = "A", D[D.B = 1] = "B", D[D.C = 2] = "C"; +const a = (M = {}).x; //// [t2.ts] Object.defineProperty(exports, "__esModule", { value: !0 diff --git a/crates/swc/tests/tsc-references/exportsAndImports1.2.minified.js b/crates/swc/tests/tsc-references/exportsAndImports1.2.minified.js index 59f99317d1f0..77861e00e498 100644 --- a/crates/swc/tests/tsc-references/exportsAndImports1.2.minified.js +++ b/crates/swc/tests/tsc-references/exportsAndImports1.2.minified.js @@ -35,8 +35,8 @@ function f() {} var C = function C() { _class_call_check._(this, C); }; -(E = E1 || (E1 = {}))[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C", (D = D1 || (D1 = {}))[D.A = 0] = "A", D[D.B = 1] = "B", D[D.C = 2] = "C", M || (M = {}); -var a = M.x; +(E = E1 = {})[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C", (D = D1 = {})[D.A = 0] = "A", D[D.B = 1] = "B", D[D.C = 2] = "C"; +var a = (M = {}).x; //// [t2.ts] Object.defineProperty(exports, "__esModule", { value: !0 diff --git a/crates/swc/tests/tsc-references/exportsAndImports3-amd.2.minified.js b/crates/swc/tests/tsc-references/exportsAndImports3-amd.2.minified.js index c249b4faba14..e4c7f2af8d2c 100644 --- a/crates/swc/tests/tsc-references/exportsAndImports3-amd.2.minified.js +++ b/crates/swc/tests/tsc-references/exportsAndImports3-amd.2.minified.js @@ -64,8 +64,8 @@ define([ var C = function C() { _class_call_check._(this, C); }; - (E = E1 || (E1 = {}))[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C", (D = D1 || (D1 = {}))[D.A = 0] = "A", D[D.B = 1] = "B", D[D.C = 2] = "C", M || (M = {}); - var a = M.x; + (E = E1 = {})[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C", (D = D1 = {})[D.A = 0] = "A", D[D.B = 1] = "B", D[D.C = 2] = "C"; + var a = (M = {}).x; }); //// [t2.ts] define([ diff --git a/crates/swc/tests/tsc-references/exportsAndImports3-es6.2.minified.js b/crates/swc/tests/tsc-references/exportsAndImports3-es6.2.minified.js index 7882bcc4b594..2fd6bb613d2a 100644 --- a/crates/swc/tests/tsc-references/exportsAndImports3-es6.2.minified.js +++ b/crates/swc/tests/tsc-references/exportsAndImports3-es6.2.minified.js @@ -55,8 +55,8 @@ var E, D, E1, D1, M, v = 1; function f() {} class C { } -(E = E1 || (E1 = {}))[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C", (D = D1 || (D1 = {}))[D.A = 0] = "A", D[D.B = 1] = "B", D[D.C = 2] = "C", M || (M = {}); -const a = M.x; +(E = E1 = {})[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C", (D = D1 = {})[D.A = 0] = "A", D[D.B = 1] = "B", D[D.C = 2] = "C"; +const a = (M = {}).x; //// [t2.ts] Object.defineProperty(exports, "__esModule", { value: !0 diff --git a/crates/swc/tests/tsc-references/exportsAndImports3.2.minified.js b/crates/swc/tests/tsc-references/exportsAndImports3.2.minified.js index 4baf9b58acc2..5119d4dd61b5 100644 --- a/crates/swc/tests/tsc-references/exportsAndImports3.2.minified.js +++ b/crates/swc/tests/tsc-references/exportsAndImports3.2.minified.js @@ -56,8 +56,8 @@ function f() {} var C = function C() { _class_call_check._(this, C); }; -(E = E1 || (E1 = {}))[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C", (D = D1 || (D1 = {}))[D.A = 0] = "A", D[D.B = 1] = "B", D[D.C = 2] = "C", M || (M = {}); -var a = M.x; +(E = E1 = {})[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C", (D = D1 = {})[D.A = 0] = "A", D[D.B = 1] = "B", D[D.C = 2] = "C"; +var a = (M = {}).x; //// [t2.ts] Object.defineProperty(exports, "__esModule", { value: !0 diff --git a/crates/swc/tests/tsc-references/filterNamespace_import.2.minified.js b/crates/swc/tests/tsc-references/filterNamespace_import.2.minified.js index 55d5becbbe1e..4a96acb4a5e8 100644 --- a/crates/swc/tests/tsc-references/filterNamespace_import.2.minified.js +++ b/crates/swc/tests/tsc-references/filterNamespace_import.2.minified.js @@ -1,7 +1,7 @@ //// [/ns.ts] var ns, ns1; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -(ns1 = ns || (ns = {})).Class = function Class() { +(ns1 = ns = {}).Class = function Class() { _class_call_check(this, Class); }, ns1.Value = "", (ns1.nested || (ns1.nested = {})).NestedClass = function NestedClass() { _class_call_check(this, NestedClass); diff --git a/crates/swc/tests/tsc-references/for-inStatements.2.minified.js b/crates/swc/tests/tsc-references/for-inStatements.2.minified.js index 52082d1fd236..86fddbadd143 100644 --- a/crates/swc/tests/tsc-references/for-inStatements.2.minified.js +++ b/crates/swc/tests/tsc-references/for-inStatements.2.minified.js @@ -33,9 +33,9 @@ for(var x in function(x, y) { return x + y; }); for(var x in i[42]); -for(var x in (M || (M = {})).X = function X() { +for(var x in (M = {}).X = function X() { _class_call_check(this, X); }, M); for(var x in M.X); -for(var x in (Color1 = Color || (Color = {}))[Color1.Red = 0] = "Red", Color1[Color1.Blue = 1] = "Blue", Color); +for(var x in (Color1 = Color = {})[Color1.Red = 0] = "Red", Color1[Color1.Blue = 1] = "Blue", Color); for(var x in 1); diff --git a/crates/swc/tests/tsc-references/for-of47.2.minified.js b/crates/swc/tests/tsc-references/for-of47.2.minified.js index 3e8b5bbe94a1..d127a4d53a7c 100644 --- a/crates/swc/tests/tsc-references/for-of47.2.minified.js +++ b/crates/swc/tests/tsc-references/for-of47.2.minified.js @@ -1,6 +1,6 @@ //// [for-of47.ts] -var x, y, E, E1; -for ({ x, y: y = 0 } of ((E1 = E || (E = {}))[E1.x = 0] = "x", [ +var x, y, E; +for ({ x, y: y = 0 } of ((E = {})[E.x = 0] = "x", [ { x: "", y: !0 diff --git a/crates/swc/tests/tsc-references/for-of48.2.minified.js b/crates/swc/tests/tsc-references/for-of48.2.minified.js index 29816636c65f..e4c309a062b2 100644 --- a/crates/swc/tests/tsc-references/for-of48.2.minified.js +++ b/crates/swc/tests/tsc-references/for-of48.2.minified.js @@ -1,6 +1,6 @@ //// [for-of48.ts] -var x, y, E, E1; -for ({ x, y = 0 } of ((E1 = E || (E = {}))[E1.x = 0] = "x", [ +var x, y, E; +for ({ x, y = 0 } of ((E = {})[E.x = 0] = "x", [ { x: "", y: !0 diff --git a/crates/swc/tests/tsc-references/forStatements.2.minified.js b/crates/swc/tests/tsc-references/forStatements.2.minified.js index d01d5eb8b480..390222fca853 100644 --- a/crates/swc/tests/tsc-references/forStatements.2.minified.js +++ b/crates/swc/tests/tsc-references/forStatements.2.minified.js @@ -3,7 +3,7 @@ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var M, M1, C = function C() { _class_call_check(this, C); }; -for((M = M1 || (M1 = {})).A = function A() { +for((M = M1 = {}).A = function A() { _class_call_check(this, A); }, M.F2 = function(x) { return x.toString(); diff --git a/crates/swc/tests/tsc-references/forStatementsMultipleInvalidDecl.2.minified.js b/crates/swc/tests/tsc-references/forStatementsMultipleInvalidDecl.2.minified.js index 5fe5cdffb636..fd64d2e2cd4f 100644 --- a/crates/swc/tests/tsc-references/forStatementsMultipleInvalidDecl.2.minified.js +++ b/crates/swc/tests/tsc-references/forStatementsMultipleInvalidDecl.2.minified.js @@ -14,7 +14,7 @@ var M, M1, a, b, arr, m, C = function C() { }(C), D = function D() { _class_call_check(this, D); }; -for((M = M1 || (M1 = {})).A = function A() { +for((M = M1 = {}).A = function A() { _class_call_check(this, A); }, M.F2 = function(x) { return x.toString(); diff --git a/crates/swc/tests/tsc-references/forgottenNew.2.minified.js b/crates/swc/tests/tsc-references/forgottenNew.2.minified.js index 5dff672efa93..156d368f5234 100644 --- a/crates/swc/tests/tsc-references/forgottenNew.2.minified.js +++ b/crates/swc/tests/tsc-references/forgottenNew.2.minified.js @@ -1,6 +1,6 @@ //// [forgottenNew.ts] var Tools; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -(Tools || (Tools = {})).NullLogger = function NullLogger() { +(Tools = {}).NullLogger = function NullLogger() { _class_call_check(this, NullLogger); }, Tools.NullLogger(); diff --git a/crates/swc/tests/tsc-references/functionExpressionContextualTyping1.2.minified.js b/crates/swc/tests/tsc-references/functionExpressionContextualTyping1.2.minified.js index 9179e7a3dd59..4263c1b0c336 100644 --- a/crates/swc/tests/tsc-references/functionExpressionContextualTyping1.2.minified.js +++ b/crates/swc/tests/tsc-references/functionExpressionContextualTyping1.2.minified.js @@ -1,4 +1,4 @@ //// [functionExpressionContextualTyping1.ts] -var E, E1; +var E; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -(E1 = E || (E = {}))[E1.red = 0] = "red", E1[E1.blue = 1] = "blue"; +(E = {})[E.red = 0] = "red", E[E.blue = 1] = "blue"; diff --git a/crates/swc/tests/tsc-references/generatedContextualTyping.2.minified.js b/crates/swc/tests/tsc-references/generatedContextualTyping.2.minified.js index 5066b1906118..99bd3161ebe2 100644 --- a/crates/swc/tests/tsc-references/generatedContextualTyping.2.minified.js +++ b/crates/swc/tests/tsc-references/generatedContextualTyping.2.minified.js @@ -2,7 +2,7 @@ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _create_super } from "@swc/helpers/_/_create_super"; -var x181, x182, x183, x184, x185, x186, x187, x188, x189, x190, x191, x192, x193, x194, x195, x196, x197, x198, x199, x200, x201, x202, x203, x204, Base = function Base() { +var Base = function Base() { _class_call_check(this, Base); }, Derived1 = function(Base) { _inherits(Derived1, Base); @@ -19,59 +19,4 @@ var x181, x182, x183, x184, x185, x186, x187, x188, x189, x190, x191, x192, x193 } return Derived2; }(Base); -new Base(); -var d1 = new Derived1(), d2 = new Derived2(); -x181 || (x181 = {}), x182 || (x182 = {}), x183 || (x183 = {}), x184 || (x184 = {}), x185 || (x185 = {}), x186 || (x186 = {}), x187 || (x187 = {}), x188 || (x188 = {}), x189 || (x189 = {}), x190 || (x190 = {}), x191 || (x191 = {}), x192 || (x192 = {}), (x193 || (x193 = {})).t = function() { - return [ - d1, - d2 - ]; -}, (x194 || (x194 = {})).t = function() { - return [ - d1, - d2 - ]; -}, (x195 || (x195 = {})).t = function() { - return [ - d1, - d2 - ]; -}, (x196 || (x196 = {})).t = function() { - return [ - d1, - d2 - ]; -}, (x197 || (x197 = {})).t = function() { - return [ - d1, - d2 - ]; -}, (x198 || (x198 = {})).t = function() { - return [ - d1, - d2 - ]; -}, (x199 || (x199 = {})).t = [ - d1, - d2 -], (x200 || (x200 = {})).t = [ - d1, - d2 -], (x201 || (x201 = {})).t = [ - d1, - d2 -], (x202 || (x202 = {})).t = { - n: [ - d1, - d2 - ] -}, (x203 || (x203 = {})).t = function(n) { - return null; -}, (x204 || (x204 = {})).t = { - func: function(n) { - return [ - d1, - d2 - ]; - } -}; +new Base(), new Derived1(), new Derived2(); diff --git a/crates/swc/tests/tsc-references/generatorInAmbientContext6.2.minified.js b/crates/swc/tests/tsc-references/generatorInAmbientContext6.2.minified.js index 3e0bfba3ab06..34e19c7142fd 100644 --- a/crates/swc/tests/tsc-references/generatorInAmbientContext6.2.minified.js +++ b/crates/swc/tests/tsc-references/generatorInAmbientContext6.2.minified.js @@ -1,3 +1 @@ //// [generatorInAmbientContext6.ts] -var M; -(M || (M = {})).generator = function*() {}; diff --git a/crates/swc/tests/tsc-references/generatorOverloads5.2.minified.js b/crates/swc/tests/tsc-references/generatorOverloads5.2.minified.js index 6494a1a5e0ff..febc2d208d1e 100644 --- a/crates/swc/tests/tsc-references/generatorOverloads5.2.minified.js +++ b/crates/swc/tests/tsc-references/generatorOverloads5.2.minified.js @@ -1,3 +1 @@ //// [generatorOverloads5.ts] -var M; -M || (M = {}); diff --git a/crates/swc/tests/tsc-references/generatorYieldContextualType.2.minified.js b/crates/swc/tests/tsc-references/generatorYieldContextualType.2.minified.js index c0b276873a85..823555ac9c6e 100644 --- a/crates/swc/tests/tsc-references/generatorYieldContextualType.2.minified.js +++ b/crates/swc/tests/tsc-references/generatorYieldContextualType.2.minified.js @@ -1,9 +1,9 @@ //// [generatorYieldContextualType.ts] -var Directive, StepResult, Directive1, Directive2; +var Directive, Directive1, Directive2; f1(function*() { return yield 0, 0; }), f2(async function*() { return yield 0, 0; }), (Directive1 = Directive || (Directive = {}))[Directive1.Back = 0] = "Back", Directive1[Directive1.Cancel = 1] = "Cancel", Directive1[Directive1.LoadMore = 2] = "LoadMore", Directive1[Directive1.Noop = 3] = "Noop", (Directive2 = Directive || (Directive = {})).is = function(value) { return "number" == typeof value && null != Directive2[value]; -}, (StepResult || (StepResult = {})).Break = Symbol("BreakStep"); +}, Symbol("BreakStep"); diff --git a/crates/swc/tests/tsc-references/genericCallToOverloadedMethodWithOverloadedArguments.2.minified.js b/crates/swc/tests/tsc-references/genericCallToOverloadedMethodWithOverloadedArguments.2.minified.js index 2ed73c6fc652..03ad914db7b7 100644 --- a/crates/swc/tests/tsc-references/genericCallToOverloadedMethodWithOverloadedArguments.2.minified.js +++ b/crates/swc/tests/tsc-references/genericCallToOverloadedMethodWithOverloadedArguments.2.minified.js @@ -1,3 +1,2 @@ //// [genericCallToOverloadedMethodWithOverloadedArguments.ts] -var m1, m2, m3, m4, m5, m6; -m1 || (m1 = {}), (void 0).then(testFunction), m2 || (m2 = {}), (void 0).then(testFunction), m3 || (m3 = {}), (void 0).then(testFunction), m4 || (m4 = {}), (void 0).then(testFunction), m5 || (m5 = {}), (void 0).then(testFunction), m6 || (m6 = {}), (void 0).then(testFunction); +(void 0).then(testFunction), (void 0).then(testFunction), (void 0).then(testFunction), (void 0).then(testFunction), (void 0).then(testFunction), (void 0).then(testFunction); diff --git a/crates/swc/tests/tsc-references/genericCallWithGenericSignatureArguments2.2.minified.js b/crates/swc/tests/tsc-references/genericCallWithGenericSignatureArguments2.2.minified.js index de11c4acaf93..9127b22910bb 100644 --- a/crates/swc/tests/tsc-references/genericCallWithGenericSignatureArguments2.2.minified.js +++ b/crates/swc/tests/tsc-references/genericCallWithGenericSignatureArguments2.2.minified.js @@ -1,3 +1,3 @@ //// [genericCallWithGenericSignatureArguments2.ts] -var onlyT, TU, E, F, E1, F1, E2, F2, E3, F3; -onlyT || (onlyT = {}), (E1 = E || (E = {}))[E1.A = 0] = "A", (F1 = F || (F = {}))[F1.A = 0] = "A", TU || (TU = {}), (E3 = E2 || (E2 = {}))[E3.A = 0] = "A", (F3 = F2 || (F2 = {}))[F3.A = 0] = "A"; +var E, F, E1, F1; +(E = {})[E.A = 0] = "A", (F = {})[F.A = 0] = "A", (E1 = {})[E1.A = 0] = "A", (F1 = {})[F1.A = 0] = "A"; diff --git a/crates/swc/tests/tsc-references/genericCallWithGenericSignatureArguments3.2.minified.js b/crates/swc/tests/tsc-references/genericCallWithGenericSignatureArguments3.2.minified.js index 36dc546b07a3..58b13e363a86 100644 --- a/crates/swc/tests/tsc-references/genericCallWithGenericSignatureArguments3.2.minified.js +++ b/crates/swc/tests/tsc-references/genericCallWithGenericSignatureArguments3.2.minified.js @@ -1,3 +1,3 @@ //// [genericCallWithGenericSignatureArguments3.ts] -var E, F, E1, F1; -(E1 = E || (E = {}))[E1.A = 0] = "A", (F1 = F || (F = {}))[F1.A = 0] = "A"; +var E, F; +(E = {})[E.A = 0] = "A", (F = {})[F.A = 0] = "A"; diff --git a/crates/swc/tests/tsc-references/genericCallWithOverloadedConstructorTypedArguments.2.minified.js b/crates/swc/tests/tsc-references/genericCallWithOverloadedConstructorTypedArguments.2.minified.js index c98ccd30510b..a5b0bd01a66a 100644 --- a/crates/swc/tests/tsc-references/genericCallWithOverloadedConstructorTypedArguments.2.minified.js +++ b/crates/swc/tests/tsc-references/genericCallWithOverloadedConstructorTypedArguments.2.minified.js @@ -1,3 +1,3 @@ //// [genericCallWithOverloadedConstructorTypedArguments.ts] -var NonGenericParameter, GenericParameter, b; -NonGenericParameter || (NonGenericParameter = {}), new (void 0)(null), new b(null), GenericParameter || (GenericParameter = {}); +var b; +new (void 0)(null), new b(null); diff --git a/crates/swc/tests/tsc-references/genericCallWithOverloadedConstructorTypedArguments2.2.minified.js b/crates/swc/tests/tsc-references/genericCallWithOverloadedConstructorTypedArguments2.2.minified.js index 7115202fb8ee..d60a600694fc 100644 --- a/crates/swc/tests/tsc-references/genericCallWithOverloadedConstructorTypedArguments2.2.minified.js +++ b/crates/swc/tests/tsc-references/genericCallWithOverloadedConstructorTypedArguments2.2.minified.js @@ -1,3 +1 @@ //// [genericCallWithOverloadedConstructorTypedArguments2.ts] -var NonGenericParameter, GenericParameter; -NonGenericParameter || (NonGenericParameter = {}), GenericParameter || (GenericParameter = {}); diff --git a/crates/swc/tests/tsc-references/genericCallWithOverloadedFunctionTypedArguments.2.minified.js b/crates/swc/tests/tsc-references/genericCallWithOverloadedFunctionTypedArguments.2.minified.js index ce06b1dfcf56..aaafc7472b5e 100644 --- a/crates/swc/tests/tsc-references/genericCallWithOverloadedFunctionTypedArguments.2.minified.js +++ b/crates/swc/tests/tsc-references/genericCallWithOverloadedFunctionTypedArguments.2.minified.js @@ -1,3 +1 @@ //// [genericCallWithOverloadedFunctionTypedArguments.ts] -var NonGenericParameter, GenericParameter; -NonGenericParameter || (NonGenericParameter = {}), GenericParameter || (GenericParameter = {}); diff --git a/crates/swc/tests/tsc-references/genericCallWithOverloadedFunctionTypedArguments2.2.minified.js b/crates/swc/tests/tsc-references/genericCallWithOverloadedFunctionTypedArguments2.2.minified.js index fc130cee876d..922b9727317a 100644 --- a/crates/swc/tests/tsc-references/genericCallWithOverloadedFunctionTypedArguments2.2.minified.js +++ b/crates/swc/tests/tsc-references/genericCallWithOverloadedFunctionTypedArguments2.2.minified.js @@ -1,3 +1 @@ //// [genericCallWithOverloadedFunctionTypedArguments2.ts] -var NonGenericParameter, GenericParameter; -NonGenericParameter || (NonGenericParameter = {}), GenericParameter || (GenericParameter = {}); diff --git a/crates/swc/tests/tsc-references/genericClassWithFunctionTypedMemberArguments.2.minified.js b/crates/swc/tests/tsc-references/genericClassWithFunctionTypedMemberArguments.2.minified.js index 2e6b78a5868a..4ce3f018726e 100644 --- a/crates/swc/tests/tsc-references/genericClassWithFunctionTypedMemberArguments.2.minified.js +++ b/crates/swc/tests/tsc-references/genericClassWithFunctionTypedMemberArguments.2.minified.js @@ -1,7 +1,7 @@ //// [genericClassWithFunctionTypedMemberArguments.ts] -var ImmediatelyFix, WithCandidates, c, c2, c1, c21; +var c, c2, c1, c21; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -ImmediatelyFix || (ImmediatelyFix = {}), (c = new (function() { +(c = new (function() { function C() { _class_call_check(this, C); } @@ -25,7 +25,7 @@ ImmediatelyFix || (ImmediatelyFix = {}), (c = new (function() { return 1; }), c2.foo(function(x) { return 1; -}), WithCandidates || (WithCandidates = {}), c1.foo2(1, function(a) { +}), c1.foo2(1, function(a) { return ''; }), c1.foo2(1, function(a) { return ''; diff --git a/crates/swc/tests/tsc-references/genericClassWithObjectTypeArgsAndConstraints.2.minified.js b/crates/swc/tests/tsc-references/genericClassWithObjectTypeArgsAndConstraints.2.minified.js index 711e7c4cdc37..ba1345049327 100644 --- a/crates/swc/tests/tsc-references/genericClassWithObjectTypeArgsAndConstraints.2.minified.js +++ b/crates/swc/tests/tsc-references/genericClassWithObjectTypeArgsAndConstraints.2.minified.js @@ -1,6 +1,6 @@ //// [genericClassWithObjectTypeArgsAndConstraints.ts] import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -var g, g2, c1, d1, g1, g21, c11, d11, Class, Interface, X = function X() { +var g, g2, c1, d1, g1, g21, c11, d11, X = function X() { _class_call_check(this, X); }; -Class || (Class = {}), c1 = new X(), d1 = new X(), g.foo(c1, d1), g.foo(c1, c1), g2.foo2(c1, d1), g2.foo2(c1, c1), Interface || (Interface = {}), c11 = new X(), d11 = new X(), g1.foo(c11, d11), g1.foo(c11, c11), g21.foo2(c11, d11), g21.foo2(c11, c11); +c1 = new X(), d1 = new X(), g.foo(c1, d1), g.foo(c1, c1), g2.foo2(c1, d1), g2.foo2(c1, c1), c11 = new X(), d11 = new X(), g1.foo(c11, d11), g1.foo(c11, c11), g21.foo2(c11, d11), g21.foo2(c11, c11); diff --git a/crates/swc/tests/tsc-references/genericSetterInClassType.2.minified.js b/crates/swc/tests/tsc-references/genericSetterInClassType.2.minified.js index 5d864ecac501..84f704623c4d 100644 --- a/crates/swc/tests/tsc-references/genericSetterInClassType.2.minified.js +++ b/crates/swc/tests/tsc-references/genericSetterInClassType.2.minified.js @@ -1,6 +1,6 @@ //// [genericSetterInClassType.ts] -var Generic, c; -Generic || (Generic = {}), (c = new class { +var c; +(c = new class { get y() { return 1; } diff --git a/crates/swc/tests/tsc-references/globalThisAmbientModules.2.minified.js b/crates/swc/tests/tsc-references/globalThisAmbientModules.2.minified.js index 7895bcc8abe5..9a540db40174 100644 --- a/crates/swc/tests/tsc-references/globalThisAmbientModules.2.minified.js +++ b/crates/swc/tests/tsc-references/globalThisAmbientModules.2.minified.js @@ -1,3 +1 @@ //// [globalThisAmbientModules.ts] -var valueModule; -(valueModule || (valueModule = {})).val = 1; diff --git a/crates/swc/tests/tsc-references/heterogeneousArrayLiterals.2.minified.js b/crates/swc/tests/tsc-references/heterogeneousArrayLiterals.2.minified.js index c5916a86b918..2989cd7acdfd 100644 --- a/crates/swc/tests/tsc-references/heterogeneousArrayLiterals.2.minified.js +++ b/crates/swc/tests/tsc-references/heterogeneousArrayLiterals.2.minified.js @@ -2,7 +2,7 @@ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _create_super } from "@swc/helpers/_/_create_super"; -var WithContextualType, Derived = function(Base) { +var Derived = function(Base) { _inherits(Derived, Base); var _super = _create_super(Derived); function Derived() { @@ -12,4 +12,4 @@ var WithContextualType, Derived = function(Base) { }(function Base() { _class_call_check(this, Base); }); -Derived || (Derived = {}), WithContextualType || (WithContextualType = {}); +Derived || (Derived = {}); diff --git a/crates/swc/tests/tsc-references/ifDoWhileStatements.2.minified.js b/crates/swc/tests/tsc-references/ifDoWhileStatements.2.minified.js index d504ad3ffa49..5424566017c2 100644 --- a/crates/swc/tests/tsc-references/ifDoWhileStatements.2.minified.js +++ b/crates/swc/tests/tsc-references/ifDoWhileStatements.2.minified.js @@ -2,16 +2,16 @@ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _create_super } from "@swc/helpers/_/_create_super"; -var M, N, M1, N1, C = function C() { +var M, N, C = function C() { _class_call_check(this, C); }, D = function D() { _class_call_check(this, D); }; -for((M = M1 || (M1 = {})).A = function A() { +for((M = {}).A = function A() { _class_call_check(this, A); }, M.F2 = function(x) { return x.toString(); -}, (N = N1 || (N1 = {})).A = function A() { +}, (N = {}).A = function A() { _class_call_check(this, A); }, N.F2 = function(x) { return x.toString(); diff --git a/crates/swc/tests/tsc-references/implementingAnInterfaceExtendingClassWithPrivates2.2.minified.js b/crates/swc/tests/tsc-references/implementingAnInterfaceExtendingClassWithPrivates2.2.minified.js index 3e0bd8a07bd1..6b67955e86b4 100644 --- a/crates/swc/tests/tsc-references/implementingAnInterfaceExtendingClassWithPrivates2.2.minified.js +++ b/crates/swc/tests/tsc-references/implementingAnInterfaceExtendingClassWithPrivates2.2.minified.js @@ -1,6 +1,6 @@ //// [implementingAnInterfaceExtendingClassWithPrivates2.ts] -var M, M2, b; +var b; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _create_super } from "@swc/helpers/_/_create_super"; -M || (M = {}), M2 || (M2 = {}), b.z, b.x, b.y; +b.z, b.x, b.y; diff --git a/crates/swc/tests/tsc-references/importAliasIdentifiers.2.minified.js b/crates/swc/tests/tsc-references/importAliasIdentifiers.2.minified.js index dc3d3c3a3690..e283bddb0ba7 100644 --- a/crates/swc/tests/tsc-references/importAliasIdentifiers.2.minified.js +++ b/crates/swc/tests/tsc-references/importAliasIdentifiers.2.minified.js @@ -1,9 +1,6 @@ //// [importAliasIdentifiers.ts] import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -(moduleA || (moduleA = {})).Point = function Point(x, y) { - _class_call_check(this, Point), this.x = x, this.y = y; -}; -var moduleA, clodule = function clodule() { +var clodule = function clodule() { _class_call_check(this, clodule); }; function fundule() { diff --git a/crates/swc/tests/tsc-references/importNonExternalModule.2.minified.js b/crates/swc/tests/tsc-references/importNonExternalModule.2.minified.js index b9f0b096328b..1666496012b3 100644 --- a/crates/swc/tests/tsc-references/importNonExternalModule.2.minified.js +++ b/crates/swc/tests/tsc-references/importNonExternalModule.2.minified.js @@ -1,10 +1,7 @@ //// [foo_0.ts] define([ "require" -], function(require) { - var foo; - (foo || (foo = {})).answer = 42; -}); +], function(require) {}); //// [foo_1.ts] define([ "require", diff --git a/crates/swc/tests/tsc-references/importStatements.2.minified.js b/crates/swc/tests/tsc-references/importStatements.2.minified.js index 72fa124ea34b..1d4ca8db80af 100644 --- a/crates/swc/tests/tsc-references/importStatements.2.minified.js +++ b/crates/swc/tests/tsc-references/importStatements.2.minified.js @@ -1,8 +1,6 @@ //// [importStatements.ts] -var A, C, D, E, A1, Point, E1, a; +var A, A1, Point; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -A1 = A || (A = {}), Point = function Point(x, y) { +A1 = A = {}, Point = function Point(x, y) { _class_call_check(this, Point), this.x = x, this.y = y; -}, A1.Point = Point, A1.Origin = new Point(0, 0), C || (C = {}), D || (D = {}), new A.Point(1, 1), E1 = E || (E = {}), a = A, E1.xDist = function(x) { - return a.Origin.x - x.x; -}; +}, A1.Point = Point, A1.Origin = new Point(0, 0), new A.Point(1, 1); diff --git a/crates/swc/tests/tsc-references/importStatementsInterfaces.2.minified.js b/crates/swc/tests/tsc-references/importStatementsInterfaces.2.minified.js index e5f6534008e4..769abace3d4a 100644 --- a/crates/swc/tests/tsc-references/importStatementsInterfaces.2.minified.js +++ b/crates/swc/tests/tsc-references/importStatementsInterfaces.2.minified.js @@ -1,5 +1,2 @@ //// [importStatementsInterfaces.ts] -var C, D, E; -C || (C = {}), A, D || (D = {}), (E || (E = {})).xDist = function(x) { - return 0 - x.x; -}; +A; diff --git a/crates/swc/tests/tsc-references/incrementOperatorWithAnyOtherType.2.minified.js b/crates/swc/tests/tsc-references/incrementOperatorWithAnyOtherType.2.minified.js index d2c807a85bff..906da95948e5 100644 --- a/crates/swc/tests/tsc-references/incrementOperatorWithAnyOtherType.2.minified.js +++ b/crates/swc/tests/tsc-references/incrementOperatorWithAnyOtherType.2.minified.js @@ -7,7 +7,7 @@ var ANY, ANY1, M, ANY2 = [ x: 1, y: null }; -M || (M = {}); +M = {}; var objA = new function A() { _class_call_check(this, A); }(); diff --git a/crates/swc/tests/tsc-references/incrementOperatorWithEnumType.2.minified.js b/crates/swc/tests/tsc-references/incrementOperatorWithEnumType.2.minified.js index 273c41d74842..1cb596cb79e9 100644 --- a/crates/swc/tests/tsc-references/incrementOperatorWithEnumType.2.minified.js +++ b/crates/swc/tests/tsc-references/incrementOperatorWithEnumType.2.minified.js @@ -1,3 +1,3 @@ //// [incrementOperatorWithEnumType.ts] var ENUM1, ENUM11; -(ENUM11 = ENUM1 || (ENUM1 = {}))[ENUM11.A = 0] = "A", ENUM11[ENUM11.B = 1] = "B", ENUM11[ENUM11[""] = 2] = "", ++ENUM1.B, ENUM1.B++, ++ENUM1.B, ENUM1.B++; +(ENUM11 = ENUM1 = {})[ENUM11.A = 0] = "A", ENUM11[ENUM11.B = 1] = "B", ENUM11[ENUM11[""] = 2] = "", ++ENUM1.B, ENUM1.B++, ++ENUM1.B, ENUM1.B++; diff --git a/crates/swc/tests/tsc-references/incrementOperatorWithNumberType.2.minified.js b/crates/swc/tests/tsc-references/incrementOperatorWithNumberType.2.minified.js index 399c6e46c1c2..27aa6a611be7 100644 --- a/crates/swc/tests/tsc-references/incrementOperatorWithNumberType.2.minified.js +++ b/crates/swc/tests/tsc-references/incrementOperatorWithNumberType.2.minified.js @@ -4,7 +4,7 @@ var NUMBER, M, NUMBER1 = [ 1, 2 ]; -M || (M = {}); +M = {}; var objA = new function A() { _class_call_check(this, A); }(); diff --git a/crates/swc/tests/tsc-references/instancePropertiesInheritedIntoClassType.2.minified.js b/crates/swc/tests/tsc-references/instancePropertiesInheritedIntoClassType.2.minified.js index cf2cd885c7f7..e66bcdb88c27 100644 --- a/crates/swc/tests/tsc-references/instancePropertiesInheritedIntoClassType.2.minified.js +++ b/crates/swc/tests/tsc-references/instancePropertiesInheritedIntoClassType.2.minified.js @@ -1,10 +1,10 @@ //// [instancePropertiesInheritedIntoClassType.ts] -var NonGeneric, Generic, d, r, d1, r1; +var d, r, d1, r1; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _create_class } from "@swc/helpers/_/_create_class"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _create_super } from "@swc/helpers/_/_create_super"; -NonGeneric || (NonGeneric = {}), (r = (d = new (function(C) { +(r = (d = new (function(C) { _inherits(D, C); var _super = _create_super(D); function D() { @@ -26,7 +26,7 @@ NonGeneric || (NonGeneric = {}), (r = (d = new (function(C) { set: function(v) {} } ]), C; -}()))(1, 2)).fn()).x, r.y, r.y = 4, d.y(), Generic || (Generic = {}), (r1 = (d1 = new (function(C) { +}()))(1, 2)).fn()).x, r.y, r.y = 4, d.y(), (r1 = (d1 = new (function(C) { _inherits(D, C); var _super = _create_super(D); function D() { diff --git a/crates/swc/tests/tsc-references/instancePropertyInClassType.2.minified.js b/crates/swc/tests/tsc-references/instancePropertyInClassType.2.minified.js index 874d4df0d9a8..d78f97ebb69f 100644 --- a/crates/swc/tests/tsc-references/instancePropertyInClassType.2.minified.js +++ b/crates/swc/tests/tsc-references/instancePropertyInClassType.2.minified.js @@ -1,8 +1,8 @@ //// [instancePropertyInClassType.ts] -var NonGeneric, Generic, c, r, c1, r1; +var c, r, c1, r1; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _create_class } from "@swc/helpers/_/_create_class"; -NonGeneric || (NonGeneric = {}), (r = (c = new (function() { +(r = (c = new (function() { function C(a, b) { _class_call_check(this, C), this.a = a, this.b = b; } @@ -17,7 +17,7 @@ NonGeneric || (NonGeneric = {}), (r = (c = new (function() { set: function(v) {} } ]), C; -}())(1, 2)).fn()).x, r.y, r.y = 4, c.y(), Generic || (Generic = {}), (r1 = (c1 = new (function() { +}())(1, 2)).fn()).x, r.y, r.y = 4, c.y(), (r1 = (c1 = new (function() { function C(a, b) { _class_call_check(this, C), this.a = a, this.b = b; } diff --git a/crates/swc/tests/tsc-references/instantiatedModule.2.minified.js b/crates/swc/tests/tsc-references/instantiatedModule.2.minified.js index e07a75222b94..7cad8103b3c1 100644 --- a/crates/swc/tests/tsc-references/instantiatedModule.2.minified.js +++ b/crates/swc/tests/tsc-references/instantiatedModule.2.minified.js @@ -1,8 +1,7 @@ //// [instantiatedModule.ts] +var M2, Point, M3, Color, M, M21, M31; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -(M || (M = {})).Point = 1; -var M2, Point, M3, Color, M, M21, m2, a2, M31, m3, a3, m = M; -M.Point, m.Point, M2 = M21 || (M21 = {}), Point = function() { +(M = {}).Point = 1, M.Point, M.Point, M2 = M21 = {}, Point = function() { function Point() { _class_call_check(this, Point); } @@ -12,8 +11,4 @@ M.Point, m.Point, M2 = M21 || (M21 = {}), Point = function() { y: 0 }; }, Point; -}(), M2.Point = Point; -var m2 = M21, a2 = (m2.Point, M21.Point); -a2.Origin(), new m2.Point(), new M21.Point(), (Color = (M3 = M31 || (M31 = {})).Color || (M3.Color = {}))[Color.Blue = 0] = "Blue", Color[Color.Red = 1] = "Red"; -var m3 = M31, a3 = (m3.Color, M31.Color); -a3.Blue, M31.Color.Red, m3.Color.Blue; +}(), M2.Point = Point, (M21.Point, M21.Point).Origin(), new M21.Point(), new M21.Point(), (Color = (M3 = M31 = {}).Color || (M3.Color = {}))[Color.Blue = 0] = "Blue", Color[Color.Red = 1] = "Red", (M31.Color, M31.Color).Blue, M31.Color.Red, M31.Color.Blue; diff --git a/crates/swc/tests/tsc-references/interfaceWithPropertyOfEveryType.2.minified.js b/crates/swc/tests/tsc-references/interfaceWithPropertyOfEveryType.2.minified.js index b59e7fdff519..1d1e138a7904 100644 --- a/crates/swc/tests/tsc-references/interfaceWithPropertyOfEveryType.2.minified.js +++ b/crates/swc/tests/tsc-references/interfaceWithPropertyOfEveryType.2.minified.js @@ -1,6 +1,6 @@ //// [interfaceWithPropertyOfEveryType.ts] -var M, E, E1; +var E; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -(M || (M = {})).y = 1, (E1 = E || (E = {}))[E1.A = 0] = "A", new function C() { +(E = {})[E.A = 0] = "A", new function C() { _class_call_check(this, C); }(); diff --git a/crates/swc/tests/tsc-references/invalidAssignmentsToVoid.2.minified.js b/crates/swc/tests/tsc-references/invalidAssignmentsToVoid.2.minified.js index 7335125b9563..05c40d0a81e1 100644 --- a/crates/swc/tests/tsc-references/invalidAssignmentsToVoid.2.minified.js +++ b/crates/swc/tests/tsc-references/invalidAssignmentsToVoid.2.minified.js @@ -1,4 +1,2 @@ //// [invalidAssignmentsToVoid.ts] -var M; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -(M || (M = {})).x = 1; diff --git a/crates/swc/tests/tsc-references/invalidBooleanAssignments.2.minified.js b/crates/swc/tests/tsc-references/invalidBooleanAssignments.2.minified.js index 8068d7d74b21..6dbec08ce087 100644 --- a/crates/swc/tests/tsc-references/invalidBooleanAssignments.2.minified.js +++ b/crates/swc/tests/tsc-references/invalidBooleanAssignments.2.minified.js @@ -1,4 +1,4 @@ //// [invalidBooleanAssignments.ts] -var E, M, E1; +var E; import "@swc/helpers/_/_class_call_check"; -(E1 = E || (E = {}))[E1.A = 0] = "A", (M || (M = {})).a = 1; +(E = {})[E.A = 0] = "A"; diff --git a/crates/swc/tests/tsc-references/invalidEnumAssignments.2.minified.js b/crates/swc/tests/tsc-references/invalidEnumAssignments.2.minified.js index b609812f2af5..4c29489310fa 100644 --- a/crates/swc/tests/tsc-references/invalidEnumAssignments.2.minified.js +++ b/crates/swc/tests/tsc-references/invalidEnumAssignments.2.minified.js @@ -1,3 +1,3 @@ //// [invalidEnumAssignments.ts] -var E, E2, E1, E21; -(E1 = E || (E = {}))[E1.A = 0] = "A", E1[E1.B = 1] = "B", (E21 = E2 || (E2 = {}))[E21.A = 0] = "A", E21[E21.B = 1] = "B"; +var E, E2; +(E = {})[E.A = 0] = "A", E[E.B = 1] = "B", (E2 = {})[E2.A = 0] = "A", E2[E2.B = 1] = "B"; diff --git a/crates/swc/tests/tsc-references/invalidImportAliasIdentifiers.2.minified.js b/crates/swc/tests/tsc-references/invalidImportAliasIdentifiers.2.minified.js index ef780c44540e..2ec657aec5b1 100644 --- a/crates/swc/tests/tsc-references/invalidImportAliasIdentifiers.2.minified.js +++ b/crates/swc/tests/tsc-references/invalidImportAliasIdentifiers.2.minified.js @@ -1,4 +1,4 @@ //// [invalidImportAliasIdentifiers.ts] -var E, E1; +var E; import "@swc/helpers/_/_class_call_check"; -(E1 = E || (E = {}))[E1.Red = 0] = "Red", E1[E1.Blue = 1] = "Blue"; +(E = {})[E.Red = 0] = "Red", E[E.Blue = 1] = "Blue"; diff --git a/crates/swc/tests/tsc-references/invalidMultipleVariableDeclarations.2.minified.js b/crates/swc/tests/tsc-references/invalidMultipleVariableDeclarations.2.minified.js index 0f43453ee8ca..ad2239b4df2b 100644 --- a/crates/swc/tests/tsc-references/invalidMultipleVariableDeclarations.2.minified.js +++ b/crates/swc/tests/tsc-references/invalidMultipleVariableDeclarations.2.minified.js @@ -14,7 +14,7 @@ var M, M1, C = function C() { }(C), D = function D() { _class_call_check(this, D); }; -(M = M1 || (M1 = {})).A = function A() { +(M = M1 = {}).A = function A() { _class_call_check(this, A); }, M.F2 = function(x) { return x.toString(); diff --git a/crates/swc/tests/tsc-references/invalidNumberAssignments.2.minified.js b/crates/swc/tests/tsc-references/invalidNumberAssignments.2.minified.js index 7f7e5f5b7e6d..347fb8b1c72d 100644 --- a/crates/swc/tests/tsc-references/invalidNumberAssignments.2.minified.js +++ b/crates/swc/tests/tsc-references/invalidNumberAssignments.2.minified.js @@ -1,4 +1,2 @@ //// [invalidNumberAssignments.ts] -var M; import "@swc/helpers/_/_class_call_check"; -(M || (M = {})).x = 1; diff --git a/crates/swc/tests/tsc-references/invalidStringAssignments.2.minified.js b/crates/swc/tests/tsc-references/invalidStringAssignments.2.minified.js index 6600aaf3c18d..d966e0e9cac1 100644 --- a/crates/swc/tests/tsc-references/invalidStringAssignments.2.minified.js +++ b/crates/swc/tests/tsc-references/invalidStringAssignments.2.minified.js @@ -1,4 +1,4 @@ //// [invalidStringAssignments.ts] -var M, E, E1; +var M, E; import "@swc/helpers/_/_class_call_check"; -(M || (M = {})).x = 1, M = '', (E1 = E || (E = {}))[E1.A = 0] = "A"; +(M || (M = {})).x = 1, M = '', (E = {})[E.A = 0] = "A"; diff --git a/crates/swc/tests/tsc-references/invalidUndefinedAssignments.2.minified.js b/crates/swc/tests/tsc-references/invalidUndefinedAssignments.2.minified.js index 4d9a881b167c..45466d25f2e4 100644 --- a/crates/swc/tests/tsc-references/invalidUndefinedAssignments.2.minified.js +++ b/crates/swc/tests/tsc-references/invalidUndefinedAssignments.2.minified.js @@ -1,4 +1,4 @@ //// [invalidUndefinedAssignments.ts] -var x, E, M, E1; +var x, E, E1; import "@swc/helpers/_/_class_call_check"; -(E1 = E || (E = {}))[E1.A = 0] = "A", (E = x).A = x, I = x, (M || (M = {})).x = 1; +(E1 = E || (E = {}))[E1.A = 0] = "A", (E = x).A = x, I = x; diff --git a/crates/swc/tests/tsc-references/invalidUndefinedValues.2.minified.js b/crates/swc/tests/tsc-references/invalidUndefinedValues.2.minified.js index 41e2b4008711..bceec2ae5340 100644 --- a/crates/swc/tests/tsc-references/invalidUndefinedValues.2.minified.js +++ b/crates/swc/tests/tsc-references/invalidUndefinedValues.2.minified.js @@ -1,4 +1,4 @@ //// [invalidUndefinedValues.ts] -var M, E, E1; +var E; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -(M || (M = {})).x = 1, (E1 = E || (E = {}))[E1.A = 0] = "A"; +(E = {})[E.A = 0] = "A"; diff --git a/crates/swc/tests/tsc-references/invalidVoidAssignments.2.minified.js b/crates/swc/tests/tsc-references/invalidVoidAssignments.2.minified.js index 5056f2a5f73e..8bd51a444228 100644 --- a/crates/swc/tests/tsc-references/invalidVoidAssignments.2.minified.js +++ b/crates/swc/tests/tsc-references/invalidVoidAssignments.2.minified.js @@ -1,4 +1,4 @@ //// [invalidVoidAssignments.ts] -var x, M, E, E1; +var x, M, E; import "@swc/helpers/_/_class_call_check"; -(M || (M = {})).x = 1, M = x, (E1 = E || (E = {}))[E1.A = 0] = "A"; +(M || (M = {})).x = 1, M = x, (E = {})[E.A = 0] = "A"; diff --git a/crates/swc/tests/tsc-references/invalidVoidValues.2.minified.js b/crates/swc/tests/tsc-references/invalidVoidValues.2.minified.js index 4db853f97eb4..40c1a9f83fbc 100644 --- a/crates/swc/tests/tsc-references/invalidVoidValues.2.minified.js +++ b/crates/swc/tests/tsc-references/invalidVoidValues.2.minified.js @@ -1,4 +1,4 @@ //// [invalidVoidValues.ts] -var E, M, E1; +var E; import "@swc/helpers/_/_class_call_check"; -(E1 = E || (E = {}))[E1.A = 0] = "A", (M || (M = {})).x = 1; +(E = {})[E.A = 0] = "A"; diff --git a/crates/swc/tests/tsc-references/keyofAndIndexedAccess.2.minified.js b/crates/swc/tests/tsc-references/keyofAndIndexedAccess.2.minified.js index 0dad7e0fa50d..3c746d69b0c3 100644 --- a/crates/swc/tests/tsc-references/keyofAndIndexedAccess.2.minified.js +++ b/crates/swc/tests/tsc-references/keyofAndIndexedAccess.2.minified.js @@ -1,5 +1,5 @@ //// [keyofAndIndexedAccess.ts] -var Flag, Flag1; +var Flag; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _create_super } from "@swc/helpers/_/_create_super"; @@ -27,4 +27,4 @@ one(function() {}), on({ }, AnotherSampleClass; }(function SampleClass(props) { _class_call_check(this, SampleClass), this.props = Object.freeze(props); -}))({}), (Flag1 = Flag || (Flag = {})).FLAG_1 = "flag_1", Flag1.FLAG_2 = "flag_2"; +}))({}), (Flag = {}).FLAG_1 = "flag_1", Flag.FLAG_2 = "flag_2"; diff --git a/crates/swc/tests/tsc-references/literalTypeWidening.2.minified.js b/crates/swc/tests/tsc-references/literalTypeWidening.2.minified.js index cb7b3d319506..0f87c939f614 100644 --- a/crates/swc/tests/tsc-references/literalTypeWidening.2.minified.js +++ b/crates/swc/tests/tsc-references/literalTypeWidening.2.minified.js @@ -11,10 +11,10 @@ export function Set() { export function keys(obj) { return Object.keys(obj); } -var E, E1, langCodeSet = Set('fr', 'en', 'es', 'it', 'nl'); +var E, langCodeSet = Set('fr', 'en', 'es', 'it', 'nl'); export var langCodes = keys(langCodeSet); langCodes.map(function(code) { return { code: code }; -}), (E = E1 || (E1 = {}))[E.A = 0] = "A", E[E.B = 1] = "B", f(0); +}), (E = {})[E.A = 0] = "A", E[E.B = 1] = "B", f(0); diff --git a/crates/swc/tests/tsc-references/literalTypes2.2.minified.js b/crates/swc/tests/tsc-references/literalTypes2.2.minified.js index 14b4941fcf53..df779cc1cd7a 100644 --- a/crates/swc/tests/tsc-references/literalTypes2.2.minified.js +++ b/crates/swc/tests/tsc-references/literalTypes2.2.minified.js @@ -1,7 +1,7 @@ //// [literalTypes2.ts] import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -(E = E1 || (E1 = {}))[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C"; -var result, E, E1, a = [ +(E = {})[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C"; +var result, E, a = [ 1, 2 ]; diff --git a/crates/swc/tests/tsc-references/logicalNotOperatorWithAnyOtherType.2.minified.js b/crates/swc/tests/tsc-references/logicalNotOperatorWithAnyOtherType.2.minified.js index 2275f1495c7e..3ba4ceb62916 100644 --- a/crates/swc/tests/tsc-references/logicalNotOperatorWithAnyOtherType.2.minified.js +++ b/crates/swc/tests/tsc-references/logicalNotOperatorWithAnyOtherType.2.minified.js @@ -6,6 +6,6 @@ var M, A = function() { } return A.foo = function() {}, A; }(); -M || (M = {}); +M = {}; var objA = new A(); objA.a, M.n, A.foo(), objA.a, M.n; diff --git a/crates/swc/tests/tsc-references/logicalNotOperatorWithBooleanType.2.minified.js b/crates/swc/tests/tsc-references/logicalNotOperatorWithBooleanType.2.minified.js index c14c42c76324..04f05b1cc644 100644 --- a/crates/swc/tests/tsc-references/logicalNotOperatorWithBooleanType.2.minified.js +++ b/crates/swc/tests/tsc-references/logicalNotOperatorWithBooleanType.2.minified.js @@ -8,6 +8,6 @@ var M, A = function() { return !1; }, A; }(); -M || (M = {}); +M = {}; var objA = new A(); objA.a, M.n, A.foo(), objA.a, M.n; diff --git a/crates/swc/tests/tsc-references/logicalNotOperatorWithEnumType.2.minified.js b/crates/swc/tests/tsc-references/logicalNotOperatorWithEnumType.2.minified.js index 8c2e4f670e9c..4a6164275ef9 100644 --- a/crates/swc/tests/tsc-references/logicalNotOperatorWithEnumType.2.minified.js +++ b/crates/swc/tests/tsc-references/logicalNotOperatorWithEnumType.2.minified.js @@ -1,3 +1,3 @@ //// [logicalNotOperatorWithEnumType.ts] -var ENUM, ENUM1, ENUM2; -(ENUM2 = ENUM || (ENUM = {}))[ENUM2.A = 0] = "A", ENUM2[ENUM2.B = 1] = "B", ENUM2[ENUM2.C = 2] = "C", ENUM1 || (ENUM1 = {}); +var ENUM; +(ENUM = {})[ENUM.A = 0] = "A", ENUM[ENUM.B = 1] = "B", ENUM[ENUM.C = 2] = "C"; diff --git a/crates/swc/tests/tsc-references/logicalNotOperatorWithNumberType.2.minified.js b/crates/swc/tests/tsc-references/logicalNotOperatorWithNumberType.2.minified.js index e0f50c3374a8..19ce74d4d530 100644 --- a/crates/swc/tests/tsc-references/logicalNotOperatorWithNumberType.2.minified.js +++ b/crates/swc/tests/tsc-references/logicalNotOperatorWithNumberType.2.minified.js @@ -8,6 +8,6 @@ var M, A = function() { return 1; }, A; }(); -M || (M = {}); +M = {}; var objA = new A(); objA.a, M.n, A.foo(), objA.a, M.n, objA.a, M.n; diff --git a/crates/swc/tests/tsc-references/logicalNotOperatorWithStringType.2.minified.js b/crates/swc/tests/tsc-references/logicalNotOperatorWithStringType.2.minified.js index cc421e48e72f..82e9de07ec3a 100644 --- a/crates/swc/tests/tsc-references/logicalNotOperatorWithStringType.2.minified.js +++ b/crates/swc/tests/tsc-references/logicalNotOperatorWithStringType.2.minified.js @@ -8,6 +8,6 @@ var STRING, M, A = function() { return ""; }, A; }(); -M || (M = {}); +M = {}; var objA = new A(); objA.a, M.n, A.foo(), STRING.charAt(0), objA.a, M.n; diff --git a/crates/swc/tests/tsc-references/mappedTypeOverlappingStringEnumKeys.2.minified.js b/crates/swc/tests/tsc-references/mappedTypeOverlappingStringEnumKeys.2.minified.js index 87f4e7c57611..942e27337079 100644 --- a/crates/swc/tests/tsc-references/mappedTypeOverlappingStringEnumKeys.2.minified.js +++ b/crates/swc/tests/tsc-references/mappedTypeOverlappingStringEnumKeys.2.minified.js @@ -1,3 +1,3 @@ //// [mappedTypeOverlappingStringEnumKeys.ts] -var TerrestrialAnimalTypes, AlienAnimalTypes, TerrestrialAnimalTypes1; -(TerrestrialAnimalTypes1 = TerrestrialAnimalTypes || (TerrestrialAnimalTypes = {})).CAT = "cat", TerrestrialAnimalTypes1.DOG = "dog", (AlienAnimalTypes || (AlienAnimalTypes = {})).CAT = "cat"; +var TerrestrialAnimalTypes; +(TerrestrialAnimalTypes = {}).CAT = "cat", TerrestrialAnimalTypes.DOG = "dog"; diff --git a/crates/swc/tests/tsc-references/mergeThreeInterfaces.2.minified.js b/crates/swc/tests/tsc-references/mergeThreeInterfaces.2.minified.js index a9b533fceeae..d3f9bb0a2c8e 100644 --- a/crates/swc/tests/tsc-references/mergeThreeInterfaces.2.minified.js +++ b/crates/swc/tests/tsc-references/mergeThreeInterfaces.2.minified.js @@ -1,3 +1,3 @@ //// [mergeThreeInterfaces.ts] -var a, b, M, a1, b1; -a.foo, a.bar, a.baz, b.foo, b.bar, b.baz, M || (M = {}), a1.foo, a1.bar, a1.baz, b1.foo, b1.bar, b1.baz; +var a, b, a1, b1; +a.foo, a.bar, a.baz, b.foo, b.bar, b.baz, a1.foo, a1.bar, a1.baz, b1.foo, b1.bar, b1.baz; diff --git a/crates/swc/tests/tsc-references/mergeTwoInterfaces.2.minified.js b/crates/swc/tests/tsc-references/mergeTwoInterfaces.2.minified.js index 469c3435c07f..0bf188744188 100644 --- a/crates/swc/tests/tsc-references/mergeTwoInterfaces.2.minified.js +++ b/crates/swc/tests/tsc-references/mergeTwoInterfaces.2.minified.js @@ -1,3 +1,3 @@ //// [mergeTwoInterfaces.ts] -var a, b, M, a1, b1; -a.foo, a.bar, b.foo, b.bar, M || (M = {}), a1.foo, a1.bar, b1.foo, b1.bar; +var a, b, a1, b1; +a.foo, a.bar, b.foo, b.bar, a1.foo, a1.bar, b1.foo, b1.bar; diff --git a/crates/swc/tests/tsc-references/mergedInterfacesWithInheritedPrivates3.2.minified.js b/crates/swc/tests/tsc-references/mergedInterfacesWithInheritedPrivates3.2.minified.js index 4725871957a5..c7f78eefc445 100644 --- a/crates/swc/tests/tsc-references/mergedInterfacesWithInheritedPrivates3.2.minified.js +++ b/crates/swc/tests/tsc-references/mergedInterfacesWithInheritedPrivates3.2.minified.js @@ -1,6 +1,4 @@ //// [mergedInterfacesWithInheritedPrivates3.ts] -var M; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _create_super } from "@swc/helpers/_/_create_super"; -M || (M = {}); diff --git a/crates/swc/tests/tsc-references/mergedInterfacesWithMultipleBases.2.minified.js b/crates/swc/tests/tsc-references/mergedInterfacesWithMultipleBases.2.minified.js index f71a9ecef288..c5e2e6a72ecc 100644 --- a/crates/swc/tests/tsc-references/mergedInterfacesWithMultipleBases.2.minified.js +++ b/crates/swc/tests/tsc-references/mergedInterfacesWithMultipleBases.2.minified.js @@ -1,4 +1,4 @@ //// [mergedInterfacesWithMultipleBases.ts] -var a, M; +var a; import "@swc/helpers/_/_class_call_check"; -a.a, M || (M = {}); +a.a; diff --git a/crates/swc/tests/tsc-references/mergedInterfacesWithMultipleBases2.2.minified.js b/crates/swc/tests/tsc-references/mergedInterfacesWithMultipleBases2.2.minified.js index 2e870bc7bc22..6f23b00c2fff 100644 --- a/crates/swc/tests/tsc-references/mergedInterfacesWithMultipleBases2.2.minified.js +++ b/crates/swc/tests/tsc-references/mergedInterfacesWithMultipleBases2.2.minified.js @@ -1,4 +1,4 @@ //// [mergedInterfacesWithMultipleBases2.ts] -var a, M; +var a; import "@swc/helpers/_/_class_call_check"; -a.a, M || (M = {}); +a.a; diff --git a/crates/swc/tests/tsc-references/moduleWithStatementsOfEveryKind.2.minified.js b/crates/swc/tests/tsc-references/moduleWithStatementsOfEveryKind.2.minified.js index fd261e41f491..9bc8e8b8966b 100644 --- a/crates/swc/tests/tsc-references/moduleWithStatementsOfEveryKind.2.minified.js +++ b/crates/swc/tests/tsc-references/moduleWithStatementsOfEveryKind.2.minified.js @@ -1,31 +1,31 @@ //// [moduleWithStatementsOfEveryKind.ts] -var A, Y, Module, Color, Color1, Y1, A1, AA, B, BB, Color2; +var Color, Y, A, AA, B, BB, Color1; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _create_super } from "@swc/helpers/_/_create_super"; -A || (A = {}), Module || (Module = {}), (Color1 = Color || (Color = {}))[Color1.Blue = 0] = "Blue", Color1[Color1.Red = 1] = "Red", Y1 = Y || (Y = {}), A1 = function A() { +(Color = {})[Color.Blue = 0] = "Blue", Color[Color.Red = 1] = "Red", Y = {}, A = function A() { _class_call_check(this, A); -}, Y1.A = A1, AA = function AA() { +}, Y.A = A, AA = function AA() { _class_call_check(this, AA); -}, Y1.AA = AA, B = function(AA) { +}, Y.AA = AA, B = function(AA) { _inherits(B, AA); var _super = _create_super(B); function B() { return _class_call_check(this, B), _super.apply(this, arguments); } return B; -}(AA), Y1.B = B, BB = function(A) { +}(AA), Y.B = B, BB = function(A) { _inherits(BB, A); var _super = _create_super(BB); function BB() { return _class_call_check(this, BB), _super.apply(this, arguments); } return BB; -}(A1), Y1.BB = BB, Y1.Module || (Y1.Module = {}), (Color2 = Y1.Color || (Y1.Color = {}))[Color2.Blue = 0] = "Blue", Color2[Color2.Red = 1] = "Red", Y1.x = 12, Y1.F = function(s) { +}(A), Y.BB = BB, Y.Module || (Y.Module = {}), (Color1 = Y.Color || (Y.Color = {}))[Color1.Blue = 0] = "Blue", Color1[Color1.Red = 1] = "Red", Y.x = 12, Y.F = function(s) { return 2; -}, Y1.array = null, Y1.fn = function(s) { +}, Y.array = null, Y.fn = function(s) { return 'hello ' + s; -}, Y1.ol = { +}, Y.ol = { s: 'hello', id: 2, isvalid: !0 diff --git a/crates/swc/tests/tsc-references/nameCollision.2.minified.js b/crates/swc/tests/tsc-references/nameCollision.2.minified.js index 68db21fccdea..0674a7c49f4c 100644 --- a/crates/swc/tests/tsc-references/nameCollision.2.minified.js +++ b/crates/swc/tests/tsc-references/nameCollision.2.minified.js @@ -1,4 +1,4 @@ //// [nameCollision.ts] -var A, B, X, Y, D, X1, Y1, Y2, Y3, Y4; +var B, X, Y, Y1, Y2, Y3; import "@swc/helpers/_/_class_call_check"; -A || (A = {}), B || (B = {}), B || (B = {}), (Y1 = (X1 = X || (X = {})).Y || (X1.Y = {})).Z || (Y1.Z = {}), (Y4 = Y3 = (Y3 = (Y2 = Y || (Y = {})).Y || (Y2.Y = {})).Y || (Y3.Y = {}))[Y4.Red = 0] = "Red", Y4[Y4.Blue = 1] = "Blue", (D || (D = {})).E = 'hello'; +B || (B = {}), B || (B = {}), (Y = (X = {}).Y || (X.Y = {})).Z || (Y.Z = {}), (Y3 = Y2 = (Y2 = (Y1 = {}).Y || (Y1.Y = {})).Y || (Y2.Y = {}))[Y3.Red = 0] = "Red", Y3[Y3.Blue = 1] = "Blue"; diff --git a/crates/swc/tests/tsc-references/nameWithRelativePaths.2.minified.js b/crates/swc/tests/tsc-references/nameWithRelativePaths.2.minified.js index 447489513620..2c440c545863 100644 --- a/crates/swc/tests/tsc-references/nameWithRelativePaths.2.minified.js +++ b/crates/swc/tests/tsc-references/nameWithRelativePaths.2.minified.js @@ -29,7 +29,7 @@ Object.defineProperty(exports, "__esModule", { get: function() { return M2; } -}), (M2 || (M2 = {})).x = !0; +}), (M2 = {}).x = !0; //// [test/foo_3.ts] Object.defineProperty(exports, "__esModule", { value: !0 diff --git a/crates/swc/tests/tsc-references/negateOperatorWithBooleanType.2.minified.js b/crates/swc/tests/tsc-references/negateOperatorWithBooleanType.2.minified.js index 2918834b4248..524765cb7cdf 100644 --- a/crates/swc/tests/tsc-references/negateOperatorWithBooleanType.2.minified.js +++ b/crates/swc/tests/tsc-references/negateOperatorWithBooleanType.2.minified.js @@ -8,6 +8,6 @@ var M, A = function() { return !1; }, A; }(); -M || (M = {}); +M = {}; var objA = new A(); objA.a, M.n, A.foo(), objA.a, M.n; diff --git a/crates/swc/tests/tsc-references/negateOperatorWithEnumType.2.minified.js b/crates/swc/tests/tsc-references/negateOperatorWithEnumType.2.minified.js index e15662bc2868..0ff92044c84f 100644 --- a/crates/swc/tests/tsc-references/negateOperatorWithEnumType.2.minified.js +++ b/crates/swc/tests/tsc-references/negateOperatorWithEnumType.2.minified.js @@ -1,3 +1,3 @@ //// [negateOperatorWithEnumType.ts] -var ENUM, ENUM1, ENUM11; -ENUM || (ENUM = {}), (ENUM11 = ENUM1 || (ENUM1 = {}))[ENUM11.A = 0] = "A", ENUM11[ENUM11.B = 1] = "B", ENUM11[ENUM11[""] = 2] = ""; +var ENUM1; +(ENUM1 = {})[ENUM1.A = 0] = "A", ENUM1[ENUM1.B = 1] = "B", ENUM1[ENUM1[""] = 2] = ""; diff --git a/crates/swc/tests/tsc-references/negateOperatorWithNumberType.2.minified.js b/crates/swc/tests/tsc-references/negateOperatorWithNumberType.2.minified.js index 09b6b591c0fd..4bb987de73e5 100644 --- a/crates/swc/tests/tsc-references/negateOperatorWithNumberType.2.minified.js +++ b/crates/swc/tests/tsc-references/negateOperatorWithNumberType.2.minified.js @@ -8,6 +8,6 @@ var M, A = function() { return 1; }, A; }(); -M || (M = {}); +M = {}; var objA = new A(); objA.a, M.n, A.foo(), objA.a, M.n, objA.a, M.n; diff --git a/crates/swc/tests/tsc-references/negateOperatorWithStringType.2.minified.js b/crates/swc/tests/tsc-references/negateOperatorWithStringType.2.minified.js index a0f962f685fa..51de5bb40f88 100644 --- a/crates/swc/tests/tsc-references/negateOperatorWithStringType.2.minified.js +++ b/crates/swc/tests/tsc-references/negateOperatorWithStringType.2.minified.js @@ -8,6 +8,6 @@ var STRING, M, A = function() { return ""; }, A; }(); -M || (M = {}); +M = {}; var objA = new A(); objA.a, M.n, A.foo(), STRING.charAt(0), objA.a, M.n; diff --git a/crates/swc/tests/tsc-references/nestedModules.2.minified.js b/crates/swc/tests/tsc-references/nestedModules.2.minified.js index cf2f5f501dfa..92a5ea56fc5a 100644 --- a/crates/swc/tests/tsc-references/nestedModules.2.minified.js +++ b/crates/swc/tests/tsc-references/nestedModules.2.minified.js @@ -1,3 +1,3 @@ //// [nestedModules.ts] -var A, M2, A1, M21; -(A = A1 || (A1 = {})).B || (A.B = {}), (M2 = M21 || (M21 = {})).X || (M2.X = {}), M21.X.Point; +var A, M2, M21; +(A = {}).B || (A.B = {}), (M2 = M21 = {}).X || (M2.X = {}), M21.X.Point; diff --git a/crates/swc/tests/tsc-references/noUncheckedIndexedAccess.2.minified.js b/crates/swc/tests/tsc-references/noUncheckedIndexedAccess.2.minified.js index 9a53a070afdc..c46ac15b068d 100644 --- a/crates/swc/tests/tsc-references/noUncheckedIndexedAccess.2.minified.js +++ b/crates/swc/tests/tsc-references/noUncheckedIndexedAccess.2.minified.js @@ -1,3 +1,3 @@ //// [noUncheckedIndexedAccess.ts] -var NumericEnum1, NumericEnum2, StringEnum1, NumericEnum11, NumericEnum21, StringEnum11; -(NumericEnum1 = NumericEnum11 || (NumericEnum11 = {}))[NumericEnum1.A = 0] = "A", NumericEnum1[NumericEnum1.B = 1] = "B", NumericEnum1[NumericEnum1.C = 2] = "C", (NumericEnum2 = NumericEnum21 || (NumericEnum21 = {}))[NumericEnum2.A = 0] = "A", NumericEnum2[NumericEnum2.B = 1] = "B", NumericEnum2[NumericEnum2.C = 2] = "C", (StringEnum1 = StringEnum11 || (StringEnum11 = {})).A = "Alpha", StringEnum1.B = "Beta", strMap.foo, strMap.bar, strMap[0], strMap[0], strMap[0], strMap[0], strMap.foo, strMap[0], strMap[0], strMap.Alpha, strMap.Alpha, strMap[0], strMap[0], strMap[null], strMap.foo, strMap.bar, strMap.baz = void 0, strMap.qua = void 0, strMap[0] = void 0, strMap[null] = void 0, numMap[0], numMap[0], numMap[0], numMap[0], numMap[0], obj1.x, obj1.y, obj1.y, obj1.z, strMapUnion.foo, symbolMap[s], symbolMap[s] = void 0, nonEmptyStringArray[0], nonEmptyStringArray[1]; +var NumericEnum1, NumericEnum2, StringEnum1; +(NumericEnum1 = {})[NumericEnum1.A = 0] = "A", NumericEnum1[NumericEnum1.B = 1] = "B", NumericEnum1[NumericEnum1.C = 2] = "C", (NumericEnum2 = {})[NumericEnum2.A = 0] = "A", NumericEnum2[NumericEnum2.B = 1] = "B", NumericEnum2[NumericEnum2.C = 2] = "C", (StringEnum1 = {}).A = "Alpha", StringEnum1.B = "Beta", strMap.foo, strMap.bar, strMap[0], strMap[0], strMap[0], strMap[0], strMap.foo, strMap[0], strMap[0], strMap.Alpha, strMap.Alpha, strMap[0], strMap[0], strMap[null], strMap.foo, strMap.bar, strMap.baz = void 0, strMap.qua = void 0, strMap[0] = void 0, strMap[null] = void 0, numMap[0], numMap[0], numMap[0], numMap[0], numMap[0], obj1.x, obj1.y, obj1.y, obj1.z, strMapUnion.foo, symbolMap[s], symbolMap[s] = void 0, nonEmptyStringArray[0], nonEmptyStringArray[1]; diff --git a/crates/swc/tests/tsc-references/nonGenericTypeReferenceWithTypeArguments.2.minified.js b/crates/swc/tests/tsc-references/nonGenericTypeReferenceWithTypeArguments.2.minified.js index 2c646bec85ec..d81fa66ef8fe 100644 --- a/crates/swc/tests/tsc-references/nonGenericTypeReferenceWithTypeArguments.2.minified.js +++ b/crates/swc/tests/tsc-references/nonGenericTypeReferenceWithTypeArguments.2.minified.js @@ -1,4 +1,2 @@ //// [nonGenericTypeReferenceWithTypeArguments.ts] -var E; import "@swc/helpers/_/_class_call_check"; -E || (E = {}); diff --git a/crates/swc/tests/tsc-references/nonInstantiatedModule.2.minified.js b/crates/swc/tests/tsc-references/nonInstantiatedModule.2.minified.js index a23a3ea51c7d..3dd56462b851 100644 --- a/crates/swc/tests/tsc-references/nonInstantiatedModule.2.minified.js +++ b/crates/swc/tests/tsc-references/nonInstantiatedModule.2.minified.js @@ -1,12 +1,9 @@ //// [nonInstantiatedModule.ts] +var M2, M; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -(M || (M = {})).a = 1; -var M2, M, M21, M3, m = M; -M.a, m.a, ((M2 = M21 || (M21 = {})).Point || (M2.Point = {})).Origin = function() { +(M = {}).a = 1, M.a, M.a, ((M2 = {}).Point || (M2.Point = {})).Origin = function() { return { x: 0, y: 0 }; -}, (M3 || (M3 = {})).Utils = function Utils() { - _class_call_check(this, Utils); }; diff --git a/crates/swc/tests/tsc-references/nullAssignableToEveryType.2.minified.js b/crates/swc/tests/tsc-references/nullAssignableToEveryType.2.minified.js index 4e87139e96a5..051d038c82bd 100644 --- a/crates/swc/tests/tsc-references/nullAssignableToEveryType.2.minified.js +++ b/crates/swc/tests/tsc-references/nullAssignableToEveryType.2.minified.js @@ -1,4 +1,4 @@ //// [nullAssignableToEveryType.ts] -var E, E1; +var E; import "@swc/helpers/_/_class_call_check"; -(E1 = E || (E = {}))[E1.A = 0] = "A"; +(E = {})[E.A = 0] = "A"; diff --git a/crates/swc/tests/tsc-references/nullIsSubtypeOfEverythingButUndefined.2.minified.js b/crates/swc/tests/tsc-references/nullIsSubtypeOfEverythingButUndefined.2.minified.js index fd825e89f08c..c8cac9675e41 100644 --- a/crates/swc/tests/tsc-references/nullIsSubtypeOfEverythingButUndefined.2.minified.js +++ b/crates/swc/tests/tsc-references/nullIsSubtypeOfEverythingButUndefined.2.minified.js @@ -1,8 +1,8 @@ //// [nullIsSubtypeOfEverythingButUndefined.ts] import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; function f() {} -(E = E1 || (E1 = {}))[E.A = 0] = "A", (f || (f = {})).bar = 1; -var E, E1, c = function c() { +(E = {})[E.A = 0] = "A", (f || (f = {})).bar = 1; +var E, c = function c() { _class_call_check(this, c); }; (c || (c = {})).bar = 1; diff --git a/crates/swc/tests/tsc-references/numberAssignableToEnum.2.minified.js b/crates/swc/tests/tsc-references/numberAssignableToEnum.2.minified.js index 117581f0d3f3..0e767b0b1411 100644 --- a/crates/swc/tests/tsc-references/numberAssignableToEnum.2.minified.js +++ b/crates/swc/tests/tsc-references/numberAssignableToEnum.2.minified.js @@ -1,3 +1,3 @@ //// [numberAssignableToEnum.ts] -var E, E1; -(E1 = E || (E = {}))[E1.A = 0] = "A"; +var E; +(E = {})[E.A = 0] = "A"; diff --git a/crates/swc/tests/tsc-references/objectTypesIdentity2.2.minified.js b/crates/swc/tests/tsc-references/objectTypesIdentity2.2.minified.js index e55971c43106..11d88b675110 100644 --- a/crates/swc/tests/tsc-references/objectTypesIdentity2.2.minified.js +++ b/crates/swc/tests/tsc-references/objectTypesIdentity2.2.minified.js @@ -1,4 +1,4 @@ //// [objectTypesIdentity2.ts] -var E, E1; +var E; import "@swc/helpers/_/_class_call_check"; -(E1 = E || (E = {}))[E1.A = 0] = "A"; +(E = {})[E.A = 0] = "A"; diff --git a/crates/swc/tests/tsc-references/parserEnum6.2.minified.js b/crates/swc/tests/tsc-references/parserEnum6.2.minified.js index ff0e32b00701..86af0e035ecd 100644 --- a/crates/swc/tests/tsc-references/parserEnum6.2.minified.js +++ b/crates/swc/tests/tsc-references/parserEnum6.2.minified.js @@ -1,3 +1,3 @@ //// [parserEnum6.ts] -var E, E1; -(E1 = E || (E = {}))[E1.A = 0] = "A", E1[E1.B = 1] = "B", E1[E1.C = 2] = "C"; +var E; +(E = {})[E.A = 0] = "A", E[E.B = 1] = "B", E[E.C = 2] = "C"; diff --git a/crates/swc/tests/tsc-references/parserEnumDeclaration1.2.minified.js b/crates/swc/tests/tsc-references/parserEnumDeclaration1.2.minified.js index 221eff2f4e91..c7844e6deabd 100644 --- a/crates/swc/tests/tsc-references/parserEnumDeclaration1.2.minified.js +++ b/crates/swc/tests/tsc-references/parserEnumDeclaration1.2.minified.js @@ -1,3 +1,3 @@ //// [parserEnumDeclaration1.ts] -var E, E1; -(E1 = E || (E = {}))[E1.Foo = 1] = "Foo", E1[E1.Bar = 2] = "Bar"; +var E; +(E = {})[E.Foo = 1] = "Foo", E[E.Bar = 2] = "Bar"; diff --git a/crates/swc/tests/tsc-references/parserEnumDeclaration5.2.minified.js b/crates/swc/tests/tsc-references/parserEnumDeclaration5.2.minified.js index d7a9368a160f..86620d251444 100644 --- a/crates/swc/tests/tsc-references/parserEnumDeclaration5.2.minified.js +++ b/crates/swc/tests/tsc-references/parserEnumDeclaration5.2.minified.js @@ -1,3 +1,3 @@ //// [parserEnumDeclaration5.ts] -var E, E1; -(E1 = E || (E = {}))[E1.A = 1] = "A", E1[E1.B = 2] = "B", E1[E1.C = 2] = "C", E1[E1.D = 3] = "D"; +var E; +(E = {})[E.A = 1] = "A", E[E.B = 2] = "B", E[E.C = 2] = "C", E[E.D = 3] = "D"; diff --git a/crates/swc/tests/tsc-references/parserEnumDeclaration6.2.minified.js b/crates/swc/tests/tsc-references/parserEnumDeclaration6.2.minified.js index 63b30d07fe35..c1dd3d17b56d 100644 --- a/crates/swc/tests/tsc-references/parserEnumDeclaration6.2.minified.js +++ b/crates/swc/tests/tsc-references/parserEnumDeclaration6.2.minified.js @@ -1,3 +1,3 @@ //// [parserEnumDeclaration6.ts] -var E, E1; -(E1 = E || (E = {}))[E1.A = 1] = "A", E1[E1.B = 2] = "B", E1[E1.C = 2] = "C", E1[E1.D = 3] = "D"; +var E; +(E = {})[E.A = 1] = "A", E[E.B = 2] = "B", E[E.C = 2] = "C", E[E.D = 3] = "D"; diff --git a/crates/swc/tests/tsc-references/parserErrorRecovery_IncompleteMemberVariable1.2.minified.js b/crates/swc/tests/tsc-references/parserErrorRecovery_IncompleteMemberVariable1.2.minified.js index 5c331066f1ae..b02f13dba251 100644 --- a/crates/swc/tests/tsc-references/parserErrorRecovery_IncompleteMemberVariable1.2.minified.js +++ b/crates/swc/tests/tsc-references/parserErrorRecovery_IncompleteMemberVariable1.2.minified.js @@ -1,7 +1,7 @@ //// [parserErrorRecovery_IncompleteMemberVariable1.ts] var Shapes, Point, Shapes1; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -Shapes = Shapes1 || (Shapes1 = {}), (Point = function() { +Shapes = Shapes1 = {}, (Point = function() { function Point(x, y) { _class_call_check(this, Point), this.x = x, this.y = y; } diff --git a/crates/swc/tests/tsc-references/parserInterfaceKeywordInEnum.2.minified.js b/crates/swc/tests/tsc-references/parserInterfaceKeywordInEnum.2.minified.js index 1c2ff62d8cfd..0228d6c444ad 100644 --- a/crates/swc/tests/tsc-references/parserInterfaceKeywordInEnum.2.minified.js +++ b/crates/swc/tests/tsc-references/parserInterfaceKeywordInEnum.2.minified.js @@ -1,3 +1,3 @@ //// [parserInterfaceKeywordInEnum.ts] -var Bar, Bar1; -(Bar1 = Bar || (Bar = {}))[Bar1.interface = 0] = "interface"; +var Bar; +(Bar = {})[Bar.interface = 0] = "interface"; diff --git a/crates/swc/tests/tsc-references/parserInterfaceKeywordInEnum1.2.minified.js b/crates/swc/tests/tsc-references/parserInterfaceKeywordInEnum1.2.minified.js index b8aca4bdd3b7..5b8b21bd0939 100644 --- a/crates/swc/tests/tsc-references/parserInterfaceKeywordInEnum1.2.minified.js +++ b/crates/swc/tests/tsc-references/parserInterfaceKeywordInEnum1.2.minified.js @@ -1,3 +1,3 @@ //// [parserInterfaceKeywordInEnum1.ts] -var Bar, Bar1; -(Bar1 = Bar || (Bar = {}))[Bar1.interface = 0] = "interface"; +var Bar; +(Bar = {})[Bar.interface = 0] = "interface"; diff --git a/crates/swc/tests/tsc-references/parserRealSource1.2.minified.js b/crates/swc/tests/tsc-references/parserRealSource1.2.minified.js index 2763b11317f5..5d233accebaa 100644 --- a/crates/swc/tests/tsc-references/parserRealSource1.2.minified.js +++ b/crates/swc/tests/tsc-references/parserRealSource1.2.minified.js @@ -1,5 +1,5 @@ //// [parserRealSource1.ts] -var TypeScript, TypeScript1, NullLogger, LoggerAdapter, BufferedLogger; +var TypeScript, NullLogger, LoggerAdapter, BufferedLogger; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; !function(CompilerDiagnostics) { function Alert(output) { @@ -10,7 +10,7 @@ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; }, CompilerDiagnostics.assert = function(condition, s) { CompilerDiagnostics.debug && !condition && Alert(s); }; -}((TypeScript1 = TypeScript || (TypeScript = {})).CompilerDiagnostics || (TypeScript1.CompilerDiagnostics = {})), NullLogger = function() { +}((TypeScript = {}).CompilerDiagnostics || (TypeScript.CompilerDiagnostics = {})), NullLogger = function() { function NullLogger() { _class_call_check(this, NullLogger); } @@ -26,7 +26,7 @@ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; }, _proto.fatal = function() { return !1; }, _proto.log = function(s) {}, NullLogger; -}(), TypeScript1.NullLogger = NullLogger, LoggerAdapter = function() { +}(), TypeScript.NullLogger = NullLogger, LoggerAdapter = function() { function LoggerAdapter(logger) { _class_call_check(this, LoggerAdapter), this.logger = logger, this._information = this.logger.information(), this._debug = this.logger.debug(), this._warning = this.logger.warning(), this._error = this.logger.error(), this._fatal = this.logger.fatal(); } @@ -44,7 +44,7 @@ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; }, _proto.log = function(s) { this.logger.log(s); }, LoggerAdapter; -}(), TypeScript1.LoggerAdapter = LoggerAdapter, BufferedLogger = function() { +}(), TypeScript.LoggerAdapter = LoggerAdapter, BufferedLogger = function() { function BufferedLogger() { _class_call_check(this, BufferedLogger), this.logContents = []; } @@ -62,10 +62,10 @@ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; }, _proto.log = function(s) { this.logContents.push(s); }, BufferedLogger; -}(), TypeScript1.BufferedLogger = BufferedLogger, TypeScript1.timeFunction = function(logger, funcDescription, func) { +}(), TypeScript.BufferedLogger = BufferedLogger, TypeScript.timeFunction = function(logger, funcDescription, func) { var start = +new Date(), result = func(), end = +new Date(); return logger.log(funcDescription + " completed in " + (end - start) + " msec"), result; -}, TypeScript1.stringToLiteral = function(value, length) { +}, TypeScript.stringToLiteral = function(value, length) { var result = "", addChar = function(index) { switch(value.charCodeAt(index)){ case 0x09: diff --git a/crates/swc/tests/tsc-references/parserRealSource12.2.minified.js b/crates/swc/tests/tsc-references/parserRealSource12.2.minified.js index c3d3cd347f40..d7b503a7aa21 100644 --- a/crates/swc/tests/tsc-references/parserRealSource12.2.minified.js +++ b/crates/swc/tests/tsc-references/parserRealSource12.2.minified.js @@ -1,7 +1,7 @@ //// [parserRealSource12.ts] -var TypeScript, TypeScript1, globalAstWalkerFactory, ChildrenWalkers, AstWalkOptions, AstWalker, AstWalkerFactory; +var TypeScript, globalAstWalkerFactory, ChildrenWalkers, AstWalkOptions, AstWalker, AstWalkerFactory; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -TypeScript1 = TypeScript || (TypeScript = {}), AstWalkOptions = function() { +TypeScript = {}, AstWalkOptions = function() { function AstWalkOptions() { _class_call_check(this, AstWalkOptions), this.goChildren = !0, this.goNextSibling = !0, this.reverseSiblings = !1; } @@ -9,7 +9,7 @@ TypeScript1 = TypeScript || (TypeScript = {}), AstWalkOptions = function() { var stop = !(arguments.length > 0) || void 0 === arguments[0] || arguments[0]; this.goChildren = !stop, this.goNextSibling = !stop; }, AstWalkOptions; -}(), TypeScript1.AstWalkOptions = AstWalkOptions, AstWalker = function() { +}(), TypeScript.AstWalkOptions = AstWalkOptions, AstWalker = function() { function AstWalker(childrenWalkers, pre, post, options, state) { _class_call_check(this, AstWalker), this.childrenWalkers = childrenWalkers, this.pre = pre, this.post = post, this.options = options, this.state = state; } @@ -37,7 +37,7 @@ TypeScript1 = TypeScript || (TypeScript = {}), AstWalkOptions = function() { }, _proto.initChildrenWalkers = function() { for(var e in this.childrenWalkers[NodeType.None] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.Empty] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.EmptyExpr] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.True] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.False] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.This] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.Super] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.QString] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.Regex] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.Null] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.ArrayLit] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.ObjectLit] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.Void] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.Comma] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Pos] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.Neg] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.Delete] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.Await] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.In] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Dot] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.From] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Is] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.InstOf] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Typeof] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.NumberLit] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.Name] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.TypeRef] = ChildrenWalkers.walkTypeReferenceChildren, this.childrenWalkers[NodeType.Index] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Call] = ChildrenWalkers.walkCallExpressionChildren, this.childrenWalkers[NodeType.New] = ChildrenWalkers.walkCallExpressionChildren, this.childrenWalkers[NodeType.Asg] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgAdd] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgSub] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgDiv] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgMul] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgMod] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgAnd] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgXor] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgOr] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgLsh] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgRsh] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.AsgRs2] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.ConditionalExpression] = ChildrenWalkers.walkTrinaryExpressionChildren, this.childrenWalkers[NodeType.LogOr] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.LogAnd] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Or] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Xor] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.And] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Eq] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Ne] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Eqv] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.NEqv] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Lt] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Le] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Gt] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Ge] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Add] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Sub] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Mul] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Div] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Mod] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Lsh] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Rsh] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Rs2] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.Not] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.LogNot] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.IncPre] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.DecPre] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.IncPost] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.DecPost] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.TypeAssertion] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.FuncDecl] = ChildrenWalkers.walkFuncDeclChildren, this.childrenWalkers[NodeType.Member] = ChildrenWalkers.walkBinaryExpressionChildren, this.childrenWalkers[NodeType.VarDecl] = ChildrenWalkers.walkBoundDeclChildren, this.childrenWalkers[NodeType.ArgDecl] = ChildrenWalkers.walkBoundDeclChildren, this.childrenWalkers[NodeType.Return] = ChildrenWalkers.walkReturnStatementChildren, this.childrenWalkers[NodeType.Break] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.Continue] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.Throw] = ChildrenWalkers.walkUnaryExpressionChildren, this.childrenWalkers[NodeType.For] = ChildrenWalkers.walkForStatementChildren, this.childrenWalkers[NodeType.ForIn] = ChildrenWalkers.walkForInStatementChildren, this.childrenWalkers[NodeType.If] = ChildrenWalkers.walkIfStatementChildren, this.childrenWalkers[NodeType.While] = ChildrenWalkers.walkWhileStatementChildren, this.childrenWalkers[NodeType.DoWhile] = ChildrenWalkers.walkDoWhileStatementChildren, this.childrenWalkers[NodeType.Block] = ChildrenWalkers.walkBlockChildren, this.childrenWalkers[NodeType.Case] = ChildrenWalkers.walkCaseStatementChildren, this.childrenWalkers[NodeType.Switch] = ChildrenWalkers.walkSwitchStatementChildren, this.childrenWalkers[NodeType.Try] = ChildrenWalkers.walkTryChildren, this.childrenWalkers[NodeType.TryCatch] = ChildrenWalkers.walkTryCatchChildren, this.childrenWalkers[NodeType.TryFinally] = ChildrenWalkers.walkTryFinallyChildren, this.childrenWalkers[NodeType.Finally] = ChildrenWalkers.walkFinallyChildren, this.childrenWalkers[NodeType.Catch] = ChildrenWalkers.walkCatchChildren, this.childrenWalkers[NodeType.List] = ChildrenWalkers.walkListChildren, this.childrenWalkers[NodeType.Script] = ChildrenWalkers.walkScriptChildren, this.childrenWalkers[NodeType.ClassDeclaration] = ChildrenWalkers.walkClassDeclChildren, this.childrenWalkers[NodeType.InterfaceDeclaration] = ChildrenWalkers.walkTypeDeclChildren, this.childrenWalkers[NodeType.ModuleDeclaration] = ChildrenWalkers.walkModuleDeclChildren, this.childrenWalkers[NodeType.ImportDeclaration] = ChildrenWalkers.walkImportDeclChildren, this.childrenWalkers[NodeType.With] = ChildrenWalkers.walkWithStatementChildren, this.childrenWalkers[NodeType.Label] = ChildrenWalkers.walkLabelChildren, this.childrenWalkers[NodeType.LabeledStatement] = ChildrenWalkers.walkLabeledStatementChildren, this.childrenWalkers[NodeType.EBStart] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.GotoEB] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.EndCode] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.Error] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.Comment] = ChildrenWalkers.walkNone, this.childrenWalkers[NodeType.Debugger] = ChildrenWalkers.walkNone, NodeType._map)if (void 0 === this.childrenWalkers[e]) throw Error("initWalkers function is not up to date with enum content!"); }, AstWalkerFactory; -}(), TypeScript1.AstWalkerFactory = AstWalkerFactory, TypeScript1.getAstWalkerFactory = function() { +}(), TypeScript.AstWalkerFactory = AstWalkerFactory, TypeScript.getAstWalkerFactory = function() { return globalAstWalkerFactory || (globalAstWalkerFactory = new AstWalkerFactory()), globalAstWalkerFactory; }, function(ChildrenWalkers) { function walkRecordChildren(preAst, parent, walker) { @@ -106,4 +106,4 @@ TypeScript1 = TypeScript || (TypeScript = {}), AstWalkOptions = function() { }, ChildrenWalkers.walkLabelChildren = function(preAst, parent, walker) {}, ChildrenWalkers.walkLabeledStatementChildren = function(preAst, parent, walker) { preAst.labels = walker.walk(preAst.labels, preAst), walker.options.goNextSibling && (preAst.stmt = walker.walk(preAst.stmt, preAst)); }; -}(ChildrenWalkers || (ChildrenWalkers = {})); +}(ChildrenWalkers = {}); diff --git a/crates/swc/tests/tsc-references/parserRealSource13.2.minified.js b/crates/swc/tests/tsc-references/parserRealSource13.2.minified.js index 9a5dbbe44349..94b0e65df69c 100644 --- a/crates/swc/tests/tsc-references/parserRealSource13.2.minified.js +++ b/crates/swc/tests/tsc-references/parserRealSource13.2.minified.js @@ -1,16 +1,16 @@ //// [parserRealSource13.ts] -var TypeScript, TypeScript1; +var TypeScript; !function(AstWalkerWithDetailCallback) { function AstWalkerCallback(pre, ast, callback) { var nodeType = ast.nodeType, callbackString = NodeType._map[nodeType] + "Callback"; return callback[callbackString] ? callback[callbackString](pre, ast) : !callback.DefaultCallback || callback.DefaultCallback(pre, ast); } AstWalkerWithDetailCallback.walk = function(script, callback) { - var walker = TypeScript1.getAstWalkerFactory().getWalker(function(cur, parent) { + var walker = TypeScript.getAstWalkerFactory().getWalker(function(cur, parent) { return walker.options.goChildren = AstWalkerCallback(!0, cur, callback), cur; }, function(cur, parent) { return AstWalkerCallback(!1, cur, callback), cur; }); walker.walk(script, null); }; -}((TypeScript1 = TypeScript || (TypeScript = {})).AstWalkerWithDetailCallback || (TypeScript1.AstWalkerWithDetailCallback = {})); +}((TypeScript = {}).AstWalkerWithDetailCallback || (TypeScript.AstWalkerWithDetailCallback = {})); diff --git a/crates/swc/tests/tsc-references/parserRealSource14.2.minified.js b/crates/swc/tests/tsc-references/parserRealSource14.2.minified.js index 725dabd8904a..e0309e8673e4 100644 --- a/crates/swc/tests/tsc-references/parserRealSource14.2.minified.js +++ b/crates/swc/tests/tsc-references/parserRealSource14.2.minified.js @@ -1,5 +1,4 @@ //// [parserRealSource14.ts] -var TypeScript; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; !function(TypeScript) { function lastOf(items) { @@ -190,4 +189,4 @@ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; return walker.state.pop(), cur; }, null, path); }; -}(TypeScript || (TypeScript = {})); +}({}); diff --git a/crates/swc/tests/tsc-references/parserRealSource2.2.minified.js b/crates/swc/tests/tsc-references/parserRealSource2.2.minified.js index 3ac315e4322d..c869d902e252 100644 --- a/crates/swc/tests/tsc-references/parserRealSource2.2.minified.js +++ b/crates/swc/tests/tsc-references/parserRealSource2.2.minified.js @@ -1,10 +1,10 @@ //// [parserRealSource2.ts] -var TypeScript, TypeScript1, ErrorRecoverySet, AllowedElements, Modifiers, ASTFlags, DeclFlags, ModuleFlags, SymbolFlags, VarFlags, FncFlags, SignatureFlags, TypeFlags, TypeRelationshipFlags, CodeGenTarget, ModuleGenTarget; -(TypeScript1 = TypeScript || (TypeScript = {})).hasFlag = function(val, flag) { +var TypeScript, ErrorRecoverySet, AllowedElements, Modifiers, ASTFlags, DeclFlags, ModuleFlags, SymbolFlags, VarFlags, FncFlags, SignatureFlags, TypeFlags, TypeRelationshipFlags, CodeGenTarget, ModuleGenTarget; +(TypeScript = {}).hasFlag = function(val, flag) { return (val & flag) != 0; -}, (ErrorRecoverySet = TypeScript1.ErrorRecoverySet || (TypeScript1.ErrorRecoverySet = {}))[ErrorRecoverySet.None = 0] = "None", ErrorRecoverySet[ErrorRecoverySet.Comma = 1] = "Comma", ErrorRecoverySet[ErrorRecoverySet.SColon = 2] = "SColon", ErrorRecoverySet[ErrorRecoverySet.Asg = 4] = "Asg", ErrorRecoverySet[ErrorRecoverySet.BinOp = 8] = "BinOp", ErrorRecoverySet[ErrorRecoverySet.RBrack = 16] = "RBrack", ErrorRecoverySet[ErrorRecoverySet.RCurly = 32] = "RCurly", ErrorRecoverySet[ErrorRecoverySet.RParen = 64] = "RParen", ErrorRecoverySet[ErrorRecoverySet.Dot = 128] = "Dot", ErrorRecoverySet[ErrorRecoverySet.Colon = 256] = "Colon", ErrorRecoverySet[ErrorRecoverySet.PrimType = 512] = "PrimType", ErrorRecoverySet[ErrorRecoverySet.AddOp = 1024] = "AddOp", ErrorRecoverySet[ErrorRecoverySet.LCurly = 2048] = "LCurly", ErrorRecoverySet[ErrorRecoverySet.PreOp = 4096] = "PreOp", ErrorRecoverySet[ErrorRecoverySet.RegExp = 8192] = "RegExp", ErrorRecoverySet[ErrorRecoverySet.LParen = 16384] = "LParen", ErrorRecoverySet[ErrorRecoverySet.LBrack = 32768] = "LBrack", ErrorRecoverySet[ErrorRecoverySet.Scope = 65536] = "Scope", ErrorRecoverySet[ErrorRecoverySet.In = 131072] = "In", ErrorRecoverySet[ErrorRecoverySet.SCase = 262144] = "SCase", ErrorRecoverySet[ErrorRecoverySet.Else = 524288] = "Else", ErrorRecoverySet[ErrorRecoverySet.Catch = 1048576] = "Catch", ErrorRecoverySet[ErrorRecoverySet.Var = 2097152] = "Var", ErrorRecoverySet[ErrorRecoverySet.Stmt = 4194304] = "Stmt", ErrorRecoverySet[ErrorRecoverySet.While = 8388608] = "While", ErrorRecoverySet[ErrorRecoverySet.ID = 16777216] = "ID", ErrorRecoverySet[ErrorRecoverySet.Prefix = 33554432] = "Prefix", ErrorRecoverySet[ErrorRecoverySet.Literal = 67108864] = "Literal", ErrorRecoverySet[ErrorRecoverySet.RLit = 134217728] = "RLit", ErrorRecoverySet[ErrorRecoverySet.Func = 268435456] = "Func", ErrorRecoverySet[ErrorRecoverySet.EOF = 536870912] = "EOF", ErrorRecoverySet[ErrorRecoverySet.TypeScriptS = 1073741824] = "TypeScriptS", ErrorRecoverySet[ErrorRecoverySet.ExprStart = 520158210] = "ExprStart", ErrorRecoverySet[ErrorRecoverySet.StmtStart = 1608580098] = "StmtStart", ErrorRecoverySet[ErrorRecoverySet.Postfix = 49280] = "Postfix", (AllowedElements = TypeScript1.AllowedElements || (TypeScript1.AllowedElements = {}))[AllowedElements.None = 0] = "None", AllowedElements[AllowedElements.ModuleDeclarations = 4] = "ModuleDeclarations", AllowedElements[AllowedElements.ClassDeclarations = 8] = "ClassDeclarations", AllowedElements[AllowedElements.InterfaceDeclarations = 16] = "InterfaceDeclarations", AllowedElements[AllowedElements.AmbientDeclarations = 1024] = "AmbientDeclarations", AllowedElements[AllowedElements.Properties = 2048] = "Properties", AllowedElements[AllowedElements.Global = 1052] = "Global", AllowedElements[AllowedElements.QuickParse = 3100] = "QuickParse", (Modifiers = TypeScript1.Modifiers || (TypeScript1.Modifiers = {}))[Modifiers.None = 0] = "None", Modifiers[Modifiers.Private = 1] = "Private", Modifiers[Modifiers.Public = 2] = "Public", Modifiers[Modifiers.Readonly = 4] = "Readonly", Modifiers[Modifiers.Ambient = 8] = "Ambient", Modifiers[Modifiers.Exported = 16] = "Exported", Modifiers[Modifiers.Getter = 32] = "Getter", Modifiers[Modifiers.Setter = 64] = "Setter", Modifiers[Modifiers.Static = 128] = "Static", (ASTFlags = TypeScript1.ASTFlags || (TypeScript1.ASTFlags = {}))[ASTFlags.None = 0] = "None", ASTFlags[ASTFlags.ExplicitSemicolon = 1] = "ExplicitSemicolon", ASTFlags[ASTFlags.AutomaticSemicolon = 2] = "AutomaticSemicolon", ASTFlags[ASTFlags.Writeable = 4] = "Writeable", ASTFlags[ASTFlags.Error = 8] = "Error", ASTFlags[ASTFlags.DotLHSPartial = 16] = "DotLHSPartial", ASTFlags[ASTFlags.DotLHS = 32] = "DotLHS", ASTFlags[ASTFlags.IsStatement = 64] = "IsStatement", ASTFlags[ASTFlags.StrictMode = 128] = "StrictMode", ASTFlags[ASTFlags.PossibleOptionalParameter = 256] = "PossibleOptionalParameter", ASTFlags[ASTFlags.ClassBaseConstructorCall = 512] = "ClassBaseConstructorCall", ASTFlags[ASTFlags.OptionalName = 1024] = "OptionalName", ASTFlags[ASTFlags.SkipNextRParen = 2048] = "SkipNextRParen", (DeclFlags = TypeScript1.DeclFlags || (TypeScript1.DeclFlags = {}))[DeclFlags.None = 0] = "None", DeclFlags[DeclFlags.Exported = 1] = "Exported", DeclFlags[DeclFlags.Private = 2] = "Private", DeclFlags[DeclFlags.Public = 4] = "Public", DeclFlags[DeclFlags.Ambient = 8] = "Ambient", DeclFlags[DeclFlags.Static = 16] = "Static", DeclFlags[DeclFlags.LocalStatic = 32] = "LocalStatic", DeclFlags[DeclFlags.GetAccessor = 64] = "GetAccessor", DeclFlags[DeclFlags.SetAccessor = 128] = "SetAccessor", (ModuleFlags = TypeScript1.ModuleFlags || (TypeScript1.ModuleFlags = {}))[ModuleFlags.None = 0] = "None", ModuleFlags[ModuleFlags.Exported = 1] = "Exported", ModuleFlags[ModuleFlags.Private = 2] = "Private", ModuleFlags[ModuleFlags.Public = 4] = "Public", ModuleFlags[ModuleFlags.Ambient = 8] = "Ambient", ModuleFlags[ModuleFlags.Static = 16] = "Static", ModuleFlags[ModuleFlags.LocalStatic = 32] = "LocalStatic", ModuleFlags[ModuleFlags.GetAccessor = 64] = "GetAccessor", ModuleFlags[ModuleFlags.SetAccessor = 128] = "SetAccessor", ModuleFlags[ModuleFlags.IsEnum = 256] = "IsEnum", ModuleFlags[ModuleFlags.ShouldEmitModuleDecl = 512] = "ShouldEmitModuleDecl", ModuleFlags[ModuleFlags.IsWholeFile = 1024] = "IsWholeFile", ModuleFlags[ModuleFlags.IsDynamic = 2048] = "IsDynamic", ModuleFlags[ModuleFlags.MustCaptureThis = 4096] = "MustCaptureThis", (SymbolFlags = TypeScript1.SymbolFlags || (TypeScript1.SymbolFlags = {}))[SymbolFlags.None = 0] = "None", SymbolFlags[SymbolFlags.Exported = 1] = "Exported", SymbolFlags[SymbolFlags.Private = 2] = "Private", SymbolFlags[SymbolFlags.Public = 4] = "Public", SymbolFlags[SymbolFlags.Ambient = 8] = "Ambient", SymbolFlags[SymbolFlags.Static = 16] = "Static", SymbolFlags[SymbolFlags.LocalStatic = 32] = "LocalStatic", SymbolFlags[SymbolFlags.GetAccessor = 64] = "GetAccessor", SymbolFlags[SymbolFlags.SetAccessor = 128] = "SetAccessor", SymbolFlags[SymbolFlags.Property = 256] = "Property", SymbolFlags[SymbolFlags.Readonly = 512] = "Readonly", SymbolFlags[SymbolFlags.ModuleMember = 1024] = "ModuleMember", SymbolFlags[SymbolFlags.InterfaceMember = 2048] = "InterfaceMember", SymbolFlags[SymbolFlags.ClassMember = 4096] = "ClassMember", SymbolFlags[SymbolFlags.BuiltIn = 8192] = "BuiltIn", SymbolFlags[SymbolFlags.TypeSetDuringScopeAssignment = 16384] = "TypeSetDuringScopeAssignment", SymbolFlags[SymbolFlags.Constant = 32768] = "Constant", SymbolFlags[SymbolFlags.Optional = 65536] = "Optional", SymbolFlags[SymbolFlags.RecursivelyReferenced = 131072] = "RecursivelyReferenced", SymbolFlags[SymbolFlags.Bound = 262144] = "Bound", SymbolFlags[SymbolFlags.CompilerGenerated = 524288] = "CompilerGenerated", (VarFlags = TypeScript1.VarFlags || (TypeScript1.VarFlags = {}))[VarFlags.None = 0] = "None", VarFlags[VarFlags.Exported = 1] = "Exported", VarFlags[VarFlags.Private = 2] = "Private", VarFlags[VarFlags.Public = 4] = "Public", VarFlags[VarFlags.Ambient = 8] = "Ambient", VarFlags[VarFlags.Static = 16] = "Static", VarFlags[VarFlags.LocalStatic = 32] = "LocalStatic", VarFlags[VarFlags.GetAccessor = 64] = "GetAccessor", VarFlags[VarFlags.SetAccessor = 128] = "SetAccessor", VarFlags[VarFlags.AutoInit = 256] = "AutoInit", VarFlags[VarFlags.Property = 512] = "Property", VarFlags[VarFlags.Readonly = 1024] = "Readonly", VarFlags[VarFlags.Class = 2048] = "Class", VarFlags[VarFlags.ClassProperty = 4096] = "ClassProperty", VarFlags[VarFlags.ClassBodyProperty = 8192] = "ClassBodyProperty", VarFlags[VarFlags.ClassConstructorProperty = 16384] = "ClassConstructorProperty", VarFlags[VarFlags.ClassSuperMustBeFirstCallInConstructor = 32768] = "ClassSuperMustBeFirstCallInConstructor", VarFlags[VarFlags.Constant = 65536] = "Constant", VarFlags[VarFlags.MustCaptureThis = 131072] = "MustCaptureThis", (FncFlags = TypeScript1.FncFlags || (TypeScript1.FncFlags = {}))[FncFlags.None = 0] = "None", FncFlags[FncFlags.Exported = 1] = "Exported", FncFlags[FncFlags.Private = 2] = "Private", FncFlags[FncFlags.Public = 4] = "Public", FncFlags[FncFlags.Ambient = 8] = "Ambient", FncFlags[FncFlags.Static = 16] = "Static", FncFlags[FncFlags.LocalStatic = 32] = "LocalStatic", FncFlags[FncFlags.GetAccessor = 64] = "GetAccessor", FncFlags[FncFlags.SetAccessor = 128] = "SetAccessor", FncFlags[FncFlags.Definition = 256] = "Definition", FncFlags[FncFlags.Signature = 512] = "Signature", FncFlags[FncFlags.Method = 1024] = "Method", FncFlags[FncFlags.HasReturnExpression = 2048] = "HasReturnExpression", FncFlags[FncFlags.CallMember = 4096] = "CallMember", FncFlags[FncFlags.ConstructMember = 8192] = "ConstructMember", FncFlags[FncFlags.HasSelfReference = 16384] = "HasSelfReference", FncFlags[FncFlags.IsFatArrowFunction = 32768] = "IsFatArrowFunction", FncFlags[FncFlags.IndexerMember = 65536] = "IndexerMember", FncFlags[FncFlags.IsFunctionExpression = 131072] = "IsFunctionExpression", FncFlags[FncFlags.ClassMethod = 262144] = "ClassMethod", FncFlags[FncFlags.ClassPropertyMethodExported = 524288] = "ClassPropertyMethodExported", (SignatureFlags = TypeScript1.SignatureFlags || (TypeScript1.SignatureFlags = {}))[SignatureFlags.None = 0] = "None", SignatureFlags[SignatureFlags.IsIndexer = 1] = "IsIndexer", SignatureFlags[SignatureFlags.IsStringIndexer = 2] = "IsStringIndexer", SignatureFlags[SignatureFlags.IsNumberIndexer = 4] = "IsNumberIndexer", TypeScript1.ToDeclFlags = function(fncOrVarOrSymbolOrModuleFlags) { +}, (ErrorRecoverySet = TypeScript.ErrorRecoverySet || (TypeScript.ErrorRecoverySet = {}))[ErrorRecoverySet.None = 0] = "None", ErrorRecoverySet[ErrorRecoverySet.Comma = 1] = "Comma", ErrorRecoverySet[ErrorRecoverySet.SColon = 2] = "SColon", ErrorRecoverySet[ErrorRecoverySet.Asg = 4] = "Asg", ErrorRecoverySet[ErrorRecoverySet.BinOp = 8] = "BinOp", ErrorRecoverySet[ErrorRecoverySet.RBrack = 16] = "RBrack", ErrorRecoverySet[ErrorRecoverySet.RCurly = 32] = "RCurly", ErrorRecoverySet[ErrorRecoverySet.RParen = 64] = "RParen", ErrorRecoverySet[ErrorRecoverySet.Dot = 128] = "Dot", ErrorRecoverySet[ErrorRecoverySet.Colon = 256] = "Colon", ErrorRecoverySet[ErrorRecoverySet.PrimType = 512] = "PrimType", ErrorRecoverySet[ErrorRecoverySet.AddOp = 1024] = "AddOp", ErrorRecoverySet[ErrorRecoverySet.LCurly = 2048] = "LCurly", ErrorRecoverySet[ErrorRecoverySet.PreOp = 4096] = "PreOp", ErrorRecoverySet[ErrorRecoverySet.RegExp = 8192] = "RegExp", ErrorRecoverySet[ErrorRecoverySet.LParen = 16384] = "LParen", ErrorRecoverySet[ErrorRecoverySet.LBrack = 32768] = "LBrack", ErrorRecoverySet[ErrorRecoverySet.Scope = 65536] = "Scope", ErrorRecoverySet[ErrorRecoverySet.In = 131072] = "In", ErrorRecoverySet[ErrorRecoverySet.SCase = 262144] = "SCase", ErrorRecoverySet[ErrorRecoverySet.Else = 524288] = "Else", ErrorRecoverySet[ErrorRecoverySet.Catch = 1048576] = "Catch", ErrorRecoverySet[ErrorRecoverySet.Var = 2097152] = "Var", ErrorRecoverySet[ErrorRecoverySet.Stmt = 4194304] = "Stmt", ErrorRecoverySet[ErrorRecoverySet.While = 8388608] = "While", ErrorRecoverySet[ErrorRecoverySet.ID = 16777216] = "ID", ErrorRecoverySet[ErrorRecoverySet.Prefix = 33554432] = "Prefix", ErrorRecoverySet[ErrorRecoverySet.Literal = 67108864] = "Literal", ErrorRecoverySet[ErrorRecoverySet.RLit = 134217728] = "RLit", ErrorRecoverySet[ErrorRecoverySet.Func = 268435456] = "Func", ErrorRecoverySet[ErrorRecoverySet.EOF = 536870912] = "EOF", ErrorRecoverySet[ErrorRecoverySet.TypeScriptS = 1073741824] = "TypeScriptS", ErrorRecoverySet[ErrorRecoverySet.ExprStart = 520158210] = "ExprStart", ErrorRecoverySet[ErrorRecoverySet.StmtStart = 1608580098] = "StmtStart", ErrorRecoverySet[ErrorRecoverySet.Postfix = 49280] = "Postfix", (AllowedElements = TypeScript.AllowedElements || (TypeScript.AllowedElements = {}))[AllowedElements.None = 0] = "None", AllowedElements[AllowedElements.ModuleDeclarations = 4] = "ModuleDeclarations", AllowedElements[AllowedElements.ClassDeclarations = 8] = "ClassDeclarations", AllowedElements[AllowedElements.InterfaceDeclarations = 16] = "InterfaceDeclarations", AllowedElements[AllowedElements.AmbientDeclarations = 1024] = "AmbientDeclarations", AllowedElements[AllowedElements.Properties = 2048] = "Properties", AllowedElements[AllowedElements.Global = 1052] = "Global", AllowedElements[AllowedElements.QuickParse = 3100] = "QuickParse", (Modifiers = TypeScript.Modifiers || (TypeScript.Modifiers = {}))[Modifiers.None = 0] = "None", Modifiers[Modifiers.Private = 1] = "Private", Modifiers[Modifiers.Public = 2] = "Public", Modifiers[Modifiers.Readonly = 4] = "Readonly", Modifiers[Modifiers.Ambient = 8] = "Ambient", Modifiers[Modifiers.Exported = 16] = "Exported", Modifiers[Modifiers.Getter = 32] = "Getter", Modifiers[Modifiers.Setter = 64] = "Setter", Modifiers[Modifiers.Static = 128] = "Static", (ASTFlags = TypeScript.ASTFlags || (TypeScript.ASTFlags = {}))[ASTFlags.None = 0] = "None", ASTFlags[ASTFlags.ExplicitSemicolon = 1] = "ExplicitSemicolon", ASTFlags[ASTFlags.AutomaticSemicolon = 2] = "AutomaticSemicolon", ASTFlags[ASTFlags.Writeable = 4] = "Writeable", ASTFlags[ASTFlags.Error = 8] = "Error", ASTFlags[ASTFlags.DotLHSPartial = 16] = "DotLHSPartial", ASTFlags[ASTFlags.DotLHS = 32] = "DotLHS", ASTFlags[ASTFlags.IsStatement = 64] = "IsStatement", ASTFlags[ASTFlags.StrictMode = 128] = "StrictMode", ASTFlags[ASTFlags.PossibleOptionalParameter = 256] = "PossibleOptionalParameter", ASTFlags[ASTFlags.ClassBaseConstructorCall = 512] = "ClassBaseConstructorCall", ASTFlags[ASTFlags.OptionalName = 1024] = "OptionalName", ASTFlags[ASTFlags.SkipNextRParen = 2048] = "SkipNextRParen", (DeclFlags = TypeScript.DeclFlags || (TypeScript.DeclFlags = {}))[DeclFlags.None = 0] = "None", DeclFlags[DeclFlags.Exported = 1] = "Exported", DeclFlags[DeclFlags.Private = 2] = "Private", DeclFlags[DeclFlags.Public = 4] = "Public", DeclFlags[DeclFlags.Ambient = 8] = "Ambient", DeclFlags[DeclFlags.Static = 16] = "Static", DeclFlags[DeclFlags.LocalStatic = 32] = "LocalStatic", DeclFlags[DeclFlags.GetAccessor = 64] = "GetAccessor", DeclFlags[DeclFlags.SetAccessor = 128] = "SetAccessor", (ModuleFlags = TypeScript.ModuleFlags || (TypeScript.ModuleFlags = {}))[ModuleFlags.None = 0] = "None", ModuleFlags[ModuleFlags.Exported = 1] = "Exported", ModuleFlags[ModuleFlags.Private = 2] = "Private", ModuleFlags[ModuleFlags.Public = 4] = "Public", ModuleFlags[ModuleFlags.Ambient = 8] = "Ambient", ModuleFlags[ModuleFlags.Static = 16] = "Static", ModuleFlags[ModuleFlags.LocalStatic = 32] = "LocalStatic", ModuleFlags[ModuleFlags.GetAccessor = 64] = "GetAccessor", ModuleFlags[ModuleFlags.SetAccessor = 128] = "SetAccessor", ModuleFlags[ModuleFlags.IsEnum = 256] = "IsEnum", ModuleFlags[ModuleFlags.ShouldEmitModuleDecl = 512] = "ShouldEmitModuleDecl", ModuleFlags[ModuleFlags.IsWholeFile = 1024] = "IsWholeFile", ModuleFlags[ModuleFlags.IsDynamic = 2048] = "IsDynamic", ModuleFlags[ModuleFlags.MustCaptureThis = 4096] = "MustCaptureThis", (SymbolFlags = TypeScript.SymbolFlags || (TypeScript.SymbolFlags = {}))[SymbolFlags.None = 0] = "None", SymbolFlags[SymbolFlags.Exported = 1] = "Exported", SymbolFlags[SymbolFlags.Private = 2] = "Private", SymbolFlags[SymbolFlags.Public = 4] = "Public", SymbolFlags[SymbolFlags.Ambient = 8] = "Ambient", SymbolFlags[SymbolFlags.Static = 16] = "Static", SymbolFlags[SymbolFlags.LocalStatic = 32] = "LocalStatic", SymbolFlags[SymbolFlags.GetAccessor = 64] = "GetAccessor", SymbolFlags[SymbolFlags.SetAccessor = 128] = "SetAccessor", SymbolFlags[SymbolFlags.Property = 256] = "Property", SymbolFlags[SymbolFlags.Readonly = 512] = "Readonly", SymbolFlags[SymbolFlags.ModuleMember = 1024] = "ModuleMember", SymbolFlags[SymbolFlags.InterfaceMember = 2048] = "InterfaceMember", SymbolFlags[SymbolFlags.ClassMember = 4096] = "ClassMember", SymbolFlags[SymbolFlags.BuiltIn = 8192] = "BuiltIn", SymbolFlags[SymbolFlags.TypeSetDuringScopeAssignment = 16384] = "TypeSetDuringScopeAssignment", SymbolFlags[SymbolFlags.Constant = 32768] = "Constant", SymbolFlags[SymbolFlags.Optional = 65536] = "Optional", SymbolFlags[SymbolFlags.RecursivelyReferenced = 131072] = "RecursivelyReferenced", SymbolFlags[SymbolFlags.Bound = 262144] = "Bound", SymbolFlags[SymbolFlags.CompilerGenerated = 524288] = "CompilerGenerated", (VarFlags = TypeScript.VarFlags || (TypeScript.VarFlags = {}))[VarFlags.None = 0] = "None", VarFlags[VarFlags.Exported = 1] = "Exported", VarFlags[VarFlags.Private = 2] = "Private", VarFlags[VarFlags.Public = 4] = "Public", VarFlags[VarFlags.Ambient = 8] = "Ambient", VarFlags[VarFlags.Static = 16] = "Static", VarFlags[VarFlags.LocalStatic = 32] = "LocalStatic", VarFlags[VarFlags.GetAccessor = 64] = "GetAccessor", VarFlags[VarFlags.SetAccessor = 128] = "SetAccessor", VarFlags[VarFlags.AutoInit = 256] = "AutoInit", VarFlags[VarFlags.Property = 512] = "Property", VarFlags[VarFlags.Readonly = 1024] = "Readonly", VarFlags[VarFlags.Class = 2048] = "Class", VarFlags[VarFlags.ClassProperty = 4096] = "ClassProperty", VarFlags[VarFlags.ClassBodyProperty = 8192] = "ClassBodyProperty", VarFlags[VarFlags.ClassConstructorProperty = 16384] = "ClassConstructorProperty", VarFlags[VarFlags.ClassSuperMustBeFirstCallInConstructor = 32768] = "ClassSuperMustBeFirstCallInConstructor", VarFlags[VarFlags.Constant = 65536] = "Constant", VarFlags[VarFlags.MustCaptureThis = 131072] = "MustCaptureThis", (FncFlags = TypeScript.FncFlags || (TypeScript.FncFlags = {}))[FncFlags.None = 0] = "None", FncFlags[FncFlags.Exported = 1] = "Exported", FncFlags[FncFlags.Private = 2] = "Private", FncFlags[FncFlags.Public = 4] = "Public", FncFlags[FncFlags.Ambient = 8] = "Ambient", FncFlags[FncFlags.Static = 16] = "Static", FncFlags[FncFlags.LocalStatic = 32] = "LocalStatic", FncFlags[FncFlags.GetAccessor = 64] = "GetAccessor", FncFlags[FncFlags.SetAccessor = 128] = "SetAccessor", FncFlags[FncFlags.Definition = 256] = "Definition", FncFlags[FncFlags.Signature = 512] = "Signature", FncFlags[FncFlags.Method = 1024] = "Method", FncFlags[FncFlags.HasReturnExpression = 2048] = "HasReturnExpression", FncFlags[FncFlags.CallMember = 4096] = "CallMember", FncFlags[FncFlags.ConstructMember = 8192] = "ConstructMember", FncFlags[FncFlags.HasSelfReference = 16384] = "HasSelfReference", FncFlags[FncFlags.IsFatArrowFunction = 32768] = "IsFatArrowFunction", FncFlags[FncFlags.IndexerMember = 65536] = "IndexerMember", FncFlags[FncFlags.IsFunctionExpression = 131072] = "IsFunctionExpression", FncFlags[FncFlags.ClassMethod = 262144] = "ClassMethod", FncFlags[FncFlags.ClassPropertyMethodExported = 524288] = "ClassPropertyMethodExported", (SignatureFlags = TypeScript.SignatureFlags || (TypeScript.SignatureFlags = {}))[SignatureFlags.None = 0] = "None", SignatureFlags[SignatureFlags.IsIndexer = 1] = "IsIndexer", SignatureFlags[SignatureFlags.IsStringIndexer = 2] = "IsStringIndexer", SignatureFlags[SignatureFlags.IsNumberIndexer = 4] = "IsNumberIndexer", TypeScript.ToDeclFlags = function(fncOrVarOrSymbolOrModuleFlags) { return fncOrVarOrSymbolOrModuleFlags; -}, (TypeFlags = TypeScript1.TypeFlags || (TypeScript1.TypeFlags = {}))[TypeFlags.None = 0] = "None", TypeFlags[TypeFlags.HasImplementation = 1] = "HasImplementation", TypeFlags[TypeFlags.HasSelfReference = 2] = "HasSelfReference", TypeFlags[TypeFlags.MergeResult = 4] = "MergeResult", TypeFlags[TypeFlags.IsEnum = 8] = "IsEnum", TypeFlags[TypeFlags.BuildingName = 16] = "BuildingName", TypeFlags[TypeFlags.HasBaseType = 32] = "HasBaseType", TypeFlags[TypeFlags.HasBaseTypeOfObject = 64] = "HasBaseTypeOfObject", TypeFlags[TypeFlags.IsClass = 128] = "IsClass", (TypeRelationshipFlags = TypeScript1.TypeRelationshipFlags || (TypeScript1.TypeRelationshipFlags = {}))[TypeRelationshipFlags.SuccessfulComparison = 0] = "SuccessfulComparison", TypeRelationshipFlags[TypeRelationshipFlags.SourceIsNullTargetIsVoidOrUndefined = 1] = "SourceIsNullTargetIsVoidOrUndefined", TypeRelationshipFlags[TypeRelationshipFlags.RequiredPropertyIsMissing = 2] = "RequiredPropertyIsMissing", TypeRelationshipFlags[TypeRelationshipFlags.IncompatibleSignatures = 4] = "IncompatibleSignatures", TypeRelationshipFlags[TypeRelationshipFlags.SourceSignatureHasTooManyParameters = 3] = "SourceSignatureHasTooManyParameters", TypeRelationshipFlags[TypeRelationshipFlags.IncompatibleReturnTypes = 16] = "IncompatibleReturnTypes", TypeRelationshipFlags[TypeRelationshipFlags.IncompatiblePropertyTypes = 32] = "IncompatiblePropertyTypes", TypeRelationshipFlags[TypeRelationshipFlags.IncompatibleParameterTypes = 64] = "IncompatibleParameterTypes", (CodeGenTarget = TypeScript1.CodeGenTarget || (TypeScript1.CodeGenTarget = {}))[CodeGenTarget.ES3 = 0] = "ES3", CodeGenTarget[CodeGenTarget.ES5 = 1] = "ES5", (ModuleGenTarget = TypeScript1.ModuleGenTarget || (TypeScript1.ModuleGenTarget = {}))[ModuleGenTarget.Synchronous = 0] = "Synchronous", ModuleGenTarget[ModuleGenTarget.Asynchronous = 1] = "Asynchronous", ModuleGenTarget[ModuleGenTarget.Local = 2] = "Local", TypeScript1.codeGenTarget = 0, TypeScript1.moduleGenTarget = 0, TypeScript1.optimizeModuleCodeGen = !0, TypeScript1.flagsToString = function(e, flags) { +}, (TypeFlags = TypeScript.TypeFlags || (TypeScript.TypeFlags = {}))[TypeFlags.None = 0] = "None", TypeFlags[TypeFlags.HasImplementation = 1] = "HasImplementation", TypeFlags[TypeFlags.HasSelfReference = 2] = "HasSelfReference", TypeFlags[TypeFlags.MergeResult = 4] = "MergeResult", TypeFlags[TypeFlags.IsEnum = 8] = "IsEnum", TypeFlags[TypeFlags.BuildingName = 16] = "BuildingName", TypeFlags[TypeFlags.HasBaseType = 32] = "HasBaseType", TypeFlags[TypeFlags.HasBaseTypeOfObject = 64] = "HasBaseTypeOfObject", TypeFlags[TypeFlags.IsClass = 128] = "IsClass", (TypeRelationshipFlags = TypeScript.TypeRelationshipFlags || (TypeScript.TypeRelationshipFlags = {}))[TypeRelationshipFlags.SuccessfulComparison = 0] = "SuccessfulComparison", TypeRelationshipFlags[TypeRelationshipFlags.SourceIsNullTargetIsVoidOrUndefined = 1] = "SourceIsNullTargetIsVoidOrUndefined", TypeRelationshipFlags[TypeRelationshipFlags.RequiredPropertyIsMissing = 2] = "RequiredPropertyIsMissing", TypeRelationshipFlags[TypeRelationshipFlags.IncompatibleSignatures = 4] = "IncompatibleSignatures", TypeRelationshipFlags[TypeRelationshipFlags.SourceSignatureHasTooManyParameters = 3] = "SourceSignatureHasTooManyParameters", TypeRelationshipFlags[TypeRelationshipFlags.IncompatibleReturnTypes = 16] = "IncompatibleReturnTypes", TypeRelationshipFlags[TypeRelationshipFlags.IncompatiblePropertyTypes = 32] = "IncompatiblePropertyTypes", TypeRelationshipFlags[TypeRelationshipFlags.IncompatibleParameterTypes = 64] = "IncompatibleParameterTypes", (CodeGenTarget = TypeScript.CodeGenTarget || (TypeScript.CodeGenTarget = {}))[CodeGenTarget.ES3 = 0] = "ES3", CodeGenTarget[CodeGenTarget.ES5 = 1] = "ES5", (ModuleGenTarget = TypeScript.ModuleGenTarget || (TypeScript.ModuleGenTarget = {}))[ModuleGenTarget.Synchronous = 0] = "Synchronous", ModuleGenTarget[ModuleGenTarget.Asynchronous = 1] = "Asynchronous", ModuleGenTarget[ModuleGenTarget.Local = 2] = "Local", TypeScript.codeGenTarget = 0, TypeScript.moduleGenTarget = 0, TypeScript.optimizeModuleCodeGen = !0, TypeScript.flagsToString = function(e, flags) { for(var builder = "", i = 1; i < -2147483648; i <<= 1)if ((flags & i) != 0) { for(var k in e)if (e[k] == i) { builder.length > 0 && (builder += "|"), builder += k; diff --git a/crates/swc/tests/tsc-references/parserRealSource3.2.minified.js b/crates/swc/tests/tsc-references/parserRealSource3.2.minified.js index 84517dba8657..a277cf1fb646 100644 --- a/crates/swc/tests/tsc-references/parserRealSource3.2.minified.js +++ b/crates/swc/tests/tsc-references/parserRealSource3.2.minified.js @@ -1,3 +1,3 @@ //// [parserRealSource3.ts] -var TypeScript, TypeScript1, NodeType; -(NodeType = (TypeScript1 = TypeScript || (TypeScript = {})).NodeType || (TypeScript1.NodeType = {}))[NodeType.None = 0] = "None", NodeType[NodeType.Empty = 1] = "Empty", NodeType[NodeType.EmptyExpr = 2] = "EmptyExpr", NodeType[NodeType.True = 3] = "True", NodeType[NodeType.False = 4] = "False", NodeType[NodeType.This = 5] = "This", NodeType[NodeType.Super = 6] = "Super", NodeType[NodeType.QString = 7] = "QString", NodeType[NodeType.Regex = 8] = "Regex", NodeType[NodeType.Null = 9] = "Null", NodeType[NodeType.ArrayLit = 10] = "ArrayLit", NodeType[NodeType.ObjectLit = 11] = "ObjectLit", NodeType[NodeType.Void = 12] = "Void", NodeType[NodeType.Comma = 13] = "Comma", NodeType[NodeType.Pos = 14] = "Pos", NodeType[NodeType.Neg = 15] = "Neg", NodeType[NodeType.Delete = 16] = "Delete", NodeType[NodeType.Await = 17] = "Await", NodeType[NodeType.In = 18] = "In", NodeType[NodeType.Dot = 19] = "Dot", NodeType[NodeType.From = 20] = "From", NodeType[NodeType.Is = 21] = "Is", NodeType[NodeType.InstOf = 22] = "InstOf", NodeType[NodeType.Typeof = 23] = "Typeof", NodeType[NodeType.NumberLit = 24] = "NumberLit", NodeType[NodeType.Name = 25] = "Name", NodeType[NodeType.TypeRef = 26] = "TypeRef", NodeType[NodeType.Index = 27] = "Index", NodeType[NodeType.Call = 28] = "Call", NodeType[NodeType.New = 29] = "New", NodeType[NodeType.Asg = 30] = "Asg", NodeType[NodeType.AsgAdd = 31] = "AsgAdd", NodeType[NodeType.AsgSub = 32] = "AsgSub", NodeType[NodeType.AsgDiv = 33] = "AsgDiv", NodeType[NodeType.AsgMul = 34] = "AsgMul", NodeType[NodeType.AsgMod = 35] = "AsgMod", NodeType[NodeType.AsgAnd = 36] = "AsgAnd", NodeType[NodeType.AsgXor = 37] = "AsgXor", NodeType[NodeType.AsgOr = 38] = "AsgOr", NodeType[NodeType.AsgLsh = 39] = "AsgLsh", NodeType[NodeType.AsgRsh = 40] = "AsgRsh", NodeType[NodeType.AsgRs2 = 41] = "AsgRs2", NodeType[NodeType.ConditionalExpression = 42] = "ConditionalExpression", NodeType[NodeType.LogOr = 43] = "LogOr", NodeType[NodeType.LogAnd = 44] = "LogAnd", NodeType[NodeType.Or = 45] = "Or", NodeType[NodeType.Xor = 46] = "Xor", NodeType[NodeType.And = 47] = "And", NodeType[NodeType.Eq = 48] = "Eq", NodeType[NodeType.Ne = 49] = "Ne", NodeType[NodeType.Eqv = 50] = "Eqv", NodeType[NodeType.NEqv = 51] = "NEqv", NodeType[NodeType.Lt = 52] = "Lt", NodeType[NodeType.Le = 53] = "Le", NodeType[NodeType.Gt = 54] = "Gt", NodeType[NodeType.Ge = 55] = "Ge", NodeType[NodeType.Add = 56] = "Add", NodeType[NodeType.Sub = 57] = "Sub", NodeType[NodeType.Mul = 58] = "Mul", NodeType[NodeType.Div = 59] = "Div", NodeType[NodeType.Mod = 60] = "Mod", NodeType[NodeType.Lsh = 61] = "Lsh", NodeType[NodeType.Rsh = 62] = "Rsh", NodeType[NodeType.Rs2 = 63] = "Rs2", NodeType[NodeType.Not = 64] = "Not", NodeType[NodeType.LogNot = 65] = "LogNot", NodeType[NodeType.IncPre = 66] = "IncPre", NodeType[NodeType.DecPre = 67] = "DecPre", NodeType[NodeType.IncPost = 68] = "IncPost", NodeType[NodeType.DecPost = 69] = "DecPost", NodeType[NodeType.TypeAssertion = 70] = "TypeAssertion", NodeType[NodeType.FuncDecl = 71] = "FuncDecl", NodeType[NodeType.Member = 72] = "Member", NodeType[NodeType.VarDecl = 73] = "VarDecl", NodeType[NodeType.ArgDecl = 74] = "ArgDecl", NodeType[NodeType.Return = 75] = "Return", NodeType[NodeType.Break = 76] = "Break", NodeType[NodeType.Continue = 77] = "Continue", NodeType[NodeType.Throw = 78] = "Throw", NodeType[NodeType.For = 79] = "For", NodeType[NodeType.ForIn = 80] = "ForIn", NodeType[NodeType.If = 81] = "If", NodeType[NodeType.While = 82] = "While", NodeType[NodeType.DoWhile = 83] = "DoWhile", NodeType[NodeType.Block = 84] = "Block", NodeType[NodeType.Case = 85] = "Case", NodeType[NodeType.Switch = 86] = "Switch", NodeType[NodeType.Try = 87] = "Try", NodeType[NodeType.TryCatch = 88] = "TryCatch", NodeType[NodeType.TryFinally = 89] = "TryFinally", NodeType[NodeType.Finally = 90] = "Finally", NodeType[NodeType.Catch = 91] = "Catch", NodeType[NodeType.List = 92] = "List", NodeType[NodeType.Script = 93] = "Script", NodeType[NodeType.ClassDeclaration = 94] = "ClassDeclaration", NodeType[NodeType.InterfaceDeclaration = 95] = "InterfaceDeclaration", NodeType[NodeType.ModuleDeclaration = 96] = "ModuleDeclaration", NodeType[NodeType.ImportDeclaration = 97] = "ImportDeclaration", NodeType[NodeType.With = 98] = "With", NodeType[NodeType.Label = 99] = "Label", NodeType[NodeType.LabeledStatement = 100] = "LabeledStatement", NodeType[NodeType.EBStart = 101] = "EBStart", NodeType[NodeType.GotoEB = 102] = "GotoEB", NodeType[NodeType.EndCode = 103] = "EndCode", NodeType[NodeType.Error = 104] = "Error", NodeType[NodeType.Comment = 105] = "Comment", NodeType[NodeType.Debugger = 106] = "Debugger", NodeType[NodeType.GeneralNode = 71] = "GeneralNode", NodeType[NodeType.LastAsg = 41] = "LastAsg"; +var TypeScript, NodeType; +(NodeType = (TypeScript = {}).NodeType || (TypeScript.NodeType = {}))[NodeType.None = 0] = "None", NodeType[NodeType.Empty = 1] = "Empty", NodeType[NodeType.EmptyExpr = 2] = "EmptyExpr", NodeType[NodeType.True = 3] = "True", NodeType[NodeType.False = 4] = "False", NodeType[NodeType.This = 5] = "This", NodeType[NodeType.Super = 6] = "Super", NodeType[NodeType.QString = 7] = "QString", NodeType[NodeType.Regex = 8] = "Regex", NodeType[NodeType.Null = 9] = "Null", NodeType[NodeType.ArrayLit = 10] = "ArrayLit", NodeType[NodeType.ObjectLit = 11] = "ObjectLit", NodeType[NodeType.Void = 12] = "Void", NodeType[NodeType.Comma = 13] = "Comma", NodeType[NodeType.Pos = 14] = "Pos", NodeType[NodeType.Neg = 15] = "Neg", NodeType[NodeType.Delete = 16] = "Delete", NodeType[NodeType.Await = 17] = "Await", NodeType[NodeType.In = 18] = "In", NodeType[NodeType.Dot = 19] = "Dot", NodeType[NodeType.From = 20] = "From", NodeType[NodeType.Is = 21] = "Is", NodeType[NodeType.InstOf = 22] = "InstOf", NodeType[NodeType.Typeof = 23] = "Typeof", NodeType[NodeType.NumberLit = 24] = "NumberLit", NodeType[NodeType.Name = 25] = "Name", NodeType[NodeType.TypeRef = 26] = "TypeRef", NodeType[NodeType.Index = 27] = "Index", NodeType[NodeType.Call = 28] = "Call", NodeType[NodeType.New = 29] = "New", NodeType[NodeType.Asg = 30] = "Asg", NodeType[NodeType.AsgAdd = 31] = "AsgAdd", NodeType[NodeType.AsgSub = 32] = "AsgSub", NodeType[NodeType.AsgDiv = 33] = "AsgDiv", NodeType[NodeType.AsgMul = 34] = "AsgMul", NodeType[NodeType.AsgMod = 35] = "AsgMod", NodeType[NodeType.AsgAnd = 36] = "AsgAnd", NodeType[NodeType.AsgXor = 37] = "AsgXor", NodeType[NodeType.AsgOr = 38] = "AsgOr", NodeType[NodeType.AsgLsh = 39] = "AsgLsh", NodeType[NodeType.AsgRsh = 40] = "AsgRsh", NodeType[NodeType.AsgRs2 = 41] = "AsgRs2", NodeType[NodeType.ConditionalExpression = 42] = "ConditionalExpression", NodeType[NodeType.LogOr = 43] = "LogOr", NodeType[NodeType.LogAnd = 44] = "LogAnd", NodeType[NodeType.Or = 45] = "Or", NodeType[NodeType.Xor = 46] = "Xor", NodeType[NodeType.And = 47] = "And", NodeType[NodeType.Eq = 48] = "Eq", NodeType[NodeType.Ne = 49] = "Ne", NodeType[NodeType.Eqv = 50] = "Eqv", NodeType[NodeType.NEqv = 51] = "NEqv", NodeType[NodeType.Lt = 52] = "Lt", NodeType[NodeType.Le = 53] = "Le", NodeType[NodeType.Gt = 54] = "Gt", NodeType[NodeType.Ge = 55] = "Ge", NodeType[NodeType.Add = 56] = "Add", NodeType[NodeType.Sub = 57] = "Sub", NodeType[NodeType.Mul = 58] = "Mul", NodeType[NodeType.Div = 59] = "Div", NodeType[NodeType.Mod = 60] = "Mod", NodeType[NodeType.Lsh = 61] = "Lsh", NodeType[NodeType.Rsh = 62] = "Rsh", NodeType[NodeType.Rs2 = 63] = "Rs2", NodeType[NodeType.Not = 64] = "Not", NodeType[NodeType.LogNot = 65] = "LogNot", NodeType[NodeType.IncPre = 66] = "IncPre", NodeType[NodeType.DecPre = 67] = "DecPre", NodeType[NodeType.IncPost = 68] = "IncPost", NodeType[NodeType.DecPost = 69] = "DecPost", NodeType[NodeType.TypeAssertion = 70] = "TypeAssertion", NodeType[NodeType.FuncDecl = 71] = "FuncDecl", NodeType[NodeType.Member = 72] = "Member", NodeType[NodeType.VarDecl = 73] = "VarDecl", NodeType[NodeType.ArgDecl = 74] = "ArgDecl", NodeType[NodeType.Return = 75] = "Return", NodeType[NodeType.Break = 76] = "Break", NodeType[NodeType.Continue = 77] = "Continue", NodeType[NodeType.Throw = 78] = "Throw", NodeType[NodeType.For = 79] = "For", NodeType[NodeType.ForIn = 80] = "ForIn", NodeType[NodeType.If = 81] = "If", NodeType[NodeType.While = 82] = "While", NodeType[NodeType.DoWhile = 83] = "DoWhile", NodeType[NodeType.Block = 84] = "Block", NodeType[NodeType.Case = 85] = "Case", NodeType[NodeType.Switch = 86] = "Switch", NodeType[NodeType.Try = 87] = "Try", NodeType[NodeType.TryCatch = 88] = "TryCatch", NodeType[NodeType.TryFinally = 89] = "TryFinally", NodeType[NodeType.Finally = 90] = "Finally", NodeType[NodeType.Catch = 91] = "Catch", NodeType[NodeType.List = 92] = "List", NodeType[NodeType.Script = 93] = "Script", NodeType[NodeType.ClassDeclaration = 94] = "ClassDeclaration", NodeType[NodeType.InterfaceDeclaration = 95] = "InterfaceDeclaration", NodeType[NodeType.ModuleDeclaration = 96] = "ModuleDeclaration", NodeType[NodeType.ImportDeclaration = 97] = "ImportDeclaration", NodeType[NodeType.With = 98] = "With", NodeType[NodeType.Label = 99] = "Label", NodeType[NodeType.LabeledStatement = 100] = "LabeledStatement", NodeType[NodeType.EBStart = 101] = "EBStart", NodeType[NodeType.GotoEB = 102] = "GotoEB", NodeType[NodeType.EndCode = 103] = "EndCode", NodeType[NodeType.Error = 104] = "Error", NodeType[NodeType.Comment = 105] = "Comment", NodeType[NodeType.Debugger = 106] = "Debugger", NodeType[NodeType.GeneralNode = 71] = "GeneralNode", NodeType[NodeType.LastAsg = 41] = "LastAsg"; diff --git a/crates/swc/tests/tsc-references/parserRealSource5.2.minified.js b/crates/swc/tests/tsc-references/parserRealSource5.2.minified.js index 655956e253bf..0e19563efe5e 100644 --- a/crates/swc/tests/tsc-references/parserRealSource5.2.minified.js +++ b/crates/swc/tests/tsc-references/parserRealSource5.2.minified.js @@ -1,7 +1,7 @@ //// [parserRealSource5.ts] -var TypeScript, TypeScript1, PrintContext; +var TypeScript, PrintContext; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -TypeScript1 = TypeScript || (TypeScript = {}), PrintContext = function() { +TypeScript = {}, PrintContext = function() { function PrintContext(outfile, parser) { _class_call_check(this, PrintContext), this.outfile = outfile, this.parser = parser, this.builder = "", this.indent1 = " ", this.indentStrings = [], this.indentAmt = 0; } @@ -24,9 +24,9 @@ TypeScript1 = TypeScript || (TypeScript = {}), PrintContext = function() { }, _proto.writeLine = function(s) { this.builder += s, this.outfile.WriteLine(this.builder), this.builder = ""; }, PrintContext; -}(), TypeScript1.PrintContext = PrintContext, TypeScript1.prePrintAST = function(ast, parent, walker) { +}(), TypeScript.PrintContext = PrintContext, TypeScript.prePrintAST = function(ast, parent, walker) { var pc = walker.state; return ast.print(pc), pc.increaseIndent(), ast; -}, TypeScript1.postPrintAST = function(ast, parent, walker) { +}, TypeScript.postPrintAST = function(ast, parent, walker) { return walker.state.decreaseIndent(), ast; }; diff --git a/crates/swc/tests/tsc-references/parserRealSource6.2.minified.js b/crates/swc/tests/tsc-references/parserRealSource6.2.minified.js index 4d80cec60aaa..aac960b79cbb 100644 --- a/crates/swc/tests/tsc-references/parserRealSource6.2.minified.js +++ b/crates/swc/tests/tsc-references/parserRealSource6.2.minified.js @@ -1,5 +1,4 @@ //// [parserRealSource6.ts] -var TypeScript; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; !function(TypeScript) { TypeScript.TypeCollectionContext = function TypeCollectionContext(scopeChain, checker) { @@ -84,4 +83,4 @@ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var context = new EnclosingScopeContext(logger, script, text, pos, isMemberCompletion); return (TypeScript.getAstWalkerFactory().walk(script, preFindEnclosingScope, null, null, context), null === context.scopeStartAST) ? null : context; }; -}(TypeScript || (TypeScript = {})); +}({}); diff --git a/crates/swc/tests/tsc-references/parserRealSource8.2.minified.js b/crates/swc/tests/tsc-references/parserRealSource8.2.minified.js index 52e57f36deaa..0e0e38414223 100644 --- a/crates/swc/tests/tsc-references/parserRealSource8.2.minified.js +++ b/crates/swc/tests/tsc-references/parserRealSource8.2.minified.js @@ -1,5 +1,4 @@ //// [parserRealSource8.ts] -var TypeScript; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; !function(TypeScript) { function pushAssignScope(scope, context, type, classType, fnc) { @@ -103,4 +102,4 @@ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; var context = walker.state, go = !0; return ast && (ast.nodeType == NodeType.ModuleDeclaration ? (popAssignScope(context), context.modDeclChain.pop(), context.modDeclChain.length >= 1 && (context.typeFlow.checker.currentModDecl = context.modDeclChain[context.modDeclChain.length - 1])) : ast.nodeType == NodeType.ClassDeclaration ? popAssignScope(context) : ast.nodeType == NodeType.InterfaceDeclaration ? popAssignScope(context) : ast.nodeType == NodeType.With ? popAssignScope(context) : ast.nodeType == NodeType.FuncDecl ? (!ast.isConstructor || hasFlag(ast.fncFlags, FncFlags.ClassMethod)) && !ast.isOverload && popAssignScope(context) : ast.nodeType == NodeType.Catch ? ast.param && popAssignScope(context) : go = !1), walker.options.goChildren = go, ast; }; -}(TypeScript || (TypeScript = {})); +}({}); diff --git a/crates/swc/tests/tsc-references/parserSuperExpression1.2.minified.js b/crates/swc/tests/tsc-references/parserSuperExpression1.2.minified.js index d5584de0c7b4..e14ac01a9cd7 100644 --- a/crates/swc/tests/tsc-references/parserSuperExpression1.2.minified.js +++ b/crates/swc/tests/tsc-references/parserSuperExpression1.2.minified.js @@ -1,6 +1,6 @@ //// [parserSuperExpression1.ts] -var M1, M11; +var M1; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _get } from "@swc/helpers/_/_get"; import { _ as _get_prototype_of } from "@swc/helpers/_/_get_prototype_of"; -(M11 = M1 || (M1 = {})).M2 || (M11.M2 = {}); +(M1 = {}).M2 || (M1.M2 = {}); diff --git a/crates/swc/tests/tsc-references/parserSuperExpression4.2.minified.js b/crates/swc/tests/tsc-references/parserSuperExpression4.2.minified.js index 9cbbbcff830d..a158e0de2a9e 100644 --- a/crates/swc/tests/tsc-references/parserSuperExpression4.2.minified.js +++ b/crates/swc/tests/tsc-references/parserSuperExpression4.2.minified.js @@ -1,6 +1,6 @@ //// [parserSuperExpression4.ts] -var M1, M11; +var M1; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _get_prototype_of } from "@swc/helpers/_/_get_prototype_of"; import { _ as _set } from "@swc/helpers/_/_set"; -(M11 = M1 || (M1 = {})).M2 || (M11.M2 = {}); +(M1 = {}).M2 || (M1.M2 = {}); diff --git a/crates/swc/tests/tsc-references/parserindenter.2.minified.js b/crates/swc/tests/tsc-references/parserindenter.2.minified.js index 5d5ab4e4e84b..d7956c430f75 100644 --- a/crates/swc/tests/tsc-references/parserindenter.2.minified.js +++ b/crates/swc/tests/tsc-references/parserindenter.2.minified.js @@ -1,7 +1,7 @@ //// [parserindenter.ts] -var Formatting, Formatting1, Indenter; +var Formatting, Indenter; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -Formatting1 = Formatting || (Formatting = {}), Indenter = function() { +Formatting = {}, Indenter = function() { function Indenter(logger, tree, snapshot, languageHostIndentation, editorOptions, firstToken, smartIndent) { _class_call_check(this, Indenter), this.logger = logger, this.tree = tree, this.snapshot = snapshot, this.languageHostIndentation = languageHostIndentation, this.editorOptions = editorOptions, this.firstToken = firstToken, this.smartIndent = smartIndent, this.indentationBag = new IndentationBag(this.snapshot), this.scriptBlockBeginLineNumber = -1, this.offsetIndentationDeltas = new Dictionary_int_int(), this.tree.Root.SetIndentationOverride(""), this.ApplyScriptBlockIndentation(this.languageHostIndentation, this.tree), this.FillInheritedIndentation(this.tree); } @@ -235,4 +235,4 @@ Formatting1 = Formatting || (Formatting = {}), Indenter = function() { } return indentSize; }, Indenter; -}(), Formatting1.Indenter = Indenter; +}(), Formatting.Indenter = Indenter; diff --git a/crates/swc/tests/tsc-references/plusOperatorWithBooleanType.2.minified.js b/crates/swc/tests/tsc-references/plusOperatorWithBooleanType.2.minified.js index 110a66286e37..799232a2c602 100644 --- a/crates/swc/tests/tsc-references/plusOperatorWithBooleanType.2.minified.js +++ b/crates/swc/tests/tsc-references/plusOperatorWithBooleanType.2.minified.js @@ -8,6 +8,6 @@ var M, A = function() { return !1; }, A; }(); -M || (M = {}); +M = {}; var objA = new A(); objA.a, M.n, A.foo(), objA.a, M.n; diff --git a/crates/swc/tests/tsc-references/plusOperatorWithEnumType.2.minified.js b/crates/swc/tests/tsc-references/plusOperatorWithEnumType.2.minified.js index bf49619d56ed..6c8ffb79db96 100644 --- a/crates/swc/tests/tsc-references/plusOperatorWithEnumType.2.minified.js +++ b/crates/swc/tests/tsc-references/plusOperatorWithEnumType.2.minified.js @@ -1,3 +1,3 @@ //// [plusOperatorWithEnumType.ts] -var ENUM, ENUM1, ENUM11; -ENUM || (ENUM = {}), (ENUM11 = ENUM1 || (ENUM1 = {}))[ENUM11.A = 0] = "A", ENUM11[ENUM11.B = 1] = "B", ENUM11[ENUM11[""] = 2] = "", ENUM[0]; +var ENUM, ENUM1; +ENUM = {}, (ENUM1 = {})[ENUM1.A = 0] = "A", ENUM1[ENUM1.B = 1] = "B", ENUM1[ENUM1[""] = 2] = "", ENUM[0]; diff --git a/crates/swc/tests/tsc-references/plusOperatorWithNumberType.2.minified.js b/crates/swc/tests/tsc-references/plusOperatorWithNumberType.2.minified.js index fd8519ccdf46..998962c1be5b 100644 --- a/crates/swc/tests/tsc-references/plusOperatorWithNumberType.2.minified.js +++ b/crates/swc/tests/tsc-references/plusOperatorWithNumberType.2.minified.js @@ -8,6 +8,6 @@ var M, A = function() { return 1; }, A; }(); -M || (M = {}); +M = {}; var objA = new A(); objA.a, M.n, A.foo(), objA.a, M.n, objA.a, M.n; diff --git a/crates/swc/tests/tsc-references/plusOperatorWithStringType.2.minified.js b/crates/swc/tests/tsc-references/plusOperatorWithStringType.2.minified.js index 9b4bf1a19591..c2f261eedfaf 100644 --- a/crates/swc/tests/tsc-references/plusOperatorWithStringType.2.minified.js +++ b/crates/swc/tests/tsc-references/plusOperatorWithStringType.2.minified.js @@ -8,6 +8,6 @@ var STRING, M, A = function() { return ""; }, A; }(); -M || (M = {}); +M = {}; var objA = new A(); objA.a, M.n, A.foo(), STRING.charAt(0), objA.a, M.n; diff --git a/crates/swc/tests/tsc-references/primtiveTypesAreIdentical.2.minified.js b/crates/swc/tests/tsc-references/primtiveTypesAreIdentical.2.minified.js index 53901a79c026..1115ba38027a 100644 --- a/crates/swc/tests/tsc-references/primtiveTypesAreIdentical.2.minified.js +++ b/crates/swc/tests/tsc-references/primtiveTypesAreIdentical.2.minified.js @@ -1,3 +1,3 @@ //// [primtiveTypesAreIdentical.ts] -var E, E1; -(E1 = E || (E = {}))[E1.A = 0] = "A"; +var E; +(E = {})[E.A = 0] = "A"; diff --git a/crates/swc/tests/tsc-references/propertyAccess.2.minified.js b/crates/swc/tests/tsc-references/propertyAccess.2.minified.js index 312f35c545a8..c7d21b81a1bc 100644 --- a/crates/swc/tests/tsc-references/propertyAccess.2.minified.js +++ b/crates/swc/tests/tsc-references/propertyAccess.2.minified.js @@ -2,8 +2,8 @@ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _create_super } from "@swc/helpers/_/_create_super"; -(Compass1 = Compass || (Compass = {}))[Compass1.North = 0] = "North", Compass1[Compass1.South = 1] = "South", Compass1[Compass1.East = 2] = "East", Compass1[Compass1.West = 3] = "West"; -var Compass, bothIndex, stringOrNumber, someObject, Compass1, numIndex = { +(Compass = {})[Compass.North = 0] = "North", Compass[Compass.South = 1] = "South", Compass[Compass.East = 2] = "East", Compass[Compass.West = 3] = "West"; +var bothIndex, stringOrNumber, someObject, Compass, numIndex = { 3: 'three', three: 'three' }, strIndex = { diff --git a/crates/swc/tests/tsc-references/propertyNamesOfReservedWords.2.minified.js b/crates/swc/tests/tsc-references/propertyNamesOfReservedWords.2.minified.js index 803a54ea32ee..4c68c013bf7f 100644 --- a/crates/swc/tests/tsc-references/propertyNamesOfReservedWords.2.minified.js +++ b/crates/swc/tests/tsc-references/propertyNamesOfReservedWords.2.minified.js @@ -1,4 +1,4 @@ //// [propertyNamesOfReservedWords.ts] -var c, i, a, E, E1; +var c, i, a, E; import "@swc/helpers/_/_class_call_check"; -c.abstract, c.as, i.abstract, i.as, a.abstract, a.as, (E1 = E || (E = {}))[E1.abstract = 0] = "abstract", E1[E1.as = 1] = "as", E1[E1.boolean = 2] = "boolean", E1[E1.break = 3] = "break", E1[E1.byte = 4] = "byte", E1[E1.case = 5] = "case", E1[E1.catch = 6] = "catch", E1[E1.char = 7] = "char", E1[E1.class = 8] = "class", E1[E1.continue = 9] = "continue", E1[E1.const = 10] = "const", E1[E1.debugger = 11] = "debugger", E1[E1.default = 12] = "default", E1[E1.delete = 13] = "delete", E1[E1.do = 14] = "do", E1[E1.double = 15] = "double", E1[E1.else = 16] = "else", E1[E1.enum = 17] = "enum", E1[E1.export = 18] = "export", E1[E1.extends = 19] = "extends", E1[E1.false = 20] = "false", E1[E1.final = 21] = "final", E1[E1.finally = 22] = "finally", E1[E1.float = 23] = "float", E1[E1.for = 24] = "for", E1[E1.function = 25] = "function", E1[E1.goto = 26] = "goto", E1[E1.if = 27] = "if", E1[E1.implements = 28] = "implements", E1[E1.import = 29] = "import", E1[E1.in = 30] = "in", E1[E1.instanceof = 31] = "instanceof", E1[E1.int = 32] = "int", E1[E1.interface = 33] = "interface", E1[E1.is = 34] = "is", E1[E1.long = 35] = "long", E1[E1.namespace = 36] = "namespace", E1[E1.native = 37] = "native", E1[E1.new = 38] = "new", E1[E1.null = 39] = "null", E1[E1.package = 40] = "package", E1[E1.private = 41] = "private", E1[E1.protected = 42] = "protected", E1[E1.public = 43] = "public", E1[E1.return = 44] = "return", E1[E1.short = 45] = "short", E1[E1.static = 46] = "static", E1[E1.super = 47] = "super", E1[E1.switch = 48] = "switch", E1[E1.synchronized = 49] = "synchronized", E1[E1.this = 50] = "this", E1[E1.throw = 51] = "throw", E1[E1.throws = 52] = "throws", E1[E1.transient = 53] = "transient", E1[E1.true = 54] = "true", E1[E1.try = 55] = "try", E1[E1.typeof = 56] = "typeof", E1[E1.use = 57] = "use", E1[E1.var = 58] = "var", E1[E1.void = 59] = "void", E1[E1.volatile = 60] = "volatile", E1[E1.while = 61] = "while", E1[E1.with = 62] = "with"; +c.abstract, c.as, i.abstract, i.as, a.abstract, a.as, (E = {})[E.abstract = 0] = "abstract", E[E.as = 1] = "as", E[E.boolean = 2] = "boolean", E[E.break = 3] = "break", E[E.byte = 4] = "byte", E[E.case = 5] = "case", E[E.catch = 6] = "catch", E[E.char = 7] = "char", E[E.class = 8] = "class", E[E.continue = 9] = "continue", E[E.const = 10] = "const", E[E.debugger = 11] = "debugger", E[E.default = 12] = "default", E[E.delete = 13] = "delete", E[E.do = 14] = "do", E[E.double = 15] = "double", E[E.else = 16] = "else", E[E.enum = 17] = "enum", E[E.export = 18] = "export", E[E.extends = 19] = "extends", E[E.false = 20] = "false", E[E.final = 21] = "final", E[E.finally = 22] = "finally", E[E.float = 23] = "float", E[E.for = 24] = "for", E[E.function = 25] = "function", E[E.goto = 26] = "goto", E[E.if = 27] = "if", E[E.implements = 28] = "implements", E[E.import = 29] = "import", E[E.in = 30] = "in", E[E.instanceof = 31] = "instanceof", E[E.int = 32] = "int", E[E.interface = 33] = "interface", E[E.is = 34] = "is", E[E.long = 35] = "long", E[E.namespace = 36] = "namespace", E[E.native = 37] = "native", E[E.new = 38] = "new", E[E.null = 39] = "null", E[E.package = 40] = "package", E[E.private = 41] = "private", E[E.protected = 42] = "protected", E[E.public = 43] = "public", E[E.return = 44] = "return", E[E.short = 45] = "short", E[E.static = 46] = "static", E[E.super = 47] = "super", E[E.switch = 48] = "switch", E[E.synchronized = 49] = "synchronized", E[E.this = 50] = "this", E[E.throw = 51] = "throw", E[E.throws = 52] = "throws", E[E.transient = 53] = "transient", E[E.true = 54] = "true", E[E.try = 55] = "try", E[E.typeof = 56] = "typeof", E[E.use = 57] = "use", E[E.var = 58] = "var", E[E.void = 59] = "void", E[E.volatile = 60] = "volatile", E[E.while = 61] = "while", E[E.with = 62] = "with"; diff --git a/crates/swc/tests/tsc-references/scopeResolutionIdentifiers.2.minified.js b/crates/swc/tests/tsc-references/scopeResolutionIdentifiers.2.minified.js index 1a28d02f267a..73d6a733c096 100644 --- a/crates/swc/tests/tsc-references/scopeResolutionIdentifiers.2.minified.js +++ b/crates/swc/tests/tsc-references/scopeResolutionIdentifiers.2.minified.js @@ -1,4 +1,2 @@ //// [scopeResolutionIdentifiers.ts] -var M1, M2, M3, M4; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -(M1 || (M1 = {})).s, M2 || (M2 = {}), M3 || (M3 = {}), M4 || (M4 = {}); diff --git a/crates/swc/tests/tsc-references/staticPropertyNotInClassType.2.minified.js b/crates/swc/tests/tsc-references/staticPropertyNotInClassType.2.minified.js index 7cf02c5f80e4..0cb8eda16892 100644 --- a/crates/swc/tests/tsc-references/staticPropertyNotInClassType.2.minified.js +++ b/crates/swc/tests/tsc-references/staticPropertyNotInClassType.2.minified.js @@ -1,8 +1,8 @@ //// [staticPropertyNotInClassType.ts] -var NonGeneric, Generic, C, c, C1, c1; +var C, c, C1, c1; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _create_class } from "@swc/helpers/_/_create_class"; -NonGeneric || (NonGeneric = {}), ((C = function() { +((C = function() { function C(a, b) { _class_call_check(this, C), this.a = a, this.b = b; } @@ -17,7 +17,7 @@ NonGeneric || (NonGeneric = {}), ((C = function() { set: function(v) {} } ]), C; -}()) || (C = {})).bar = '', (c = new C(1, 2)).fn(), c.foo, c.bar, c.x, Generic || (Generic = {}), ((C1 = function() { +}()) || (C = {})).bar = '', (c = new C(1, 2)).fn(), c.foo, c.bar, c.x, ((C1 = function() { function C(a, b) { _class_call_check(this, C), this.a = a, this.b = b; } diff --git a/crates/swc/tests/tsc-references/strictPropertyInitialization.2.minified.js b/crates/swc/tests/tsc-references/strictPropertyInitialization.2.minified.js index 8cf584f8bd98..3f381a56acd9 100644 --- a/crates/swc/tests/tsc-references/strictPropertyInitialization.2.minified.js +++ b/crates/swc/tests/tsc-references/strictPropertyInitialization.2.minified.js @@ -1,6 +1,6 @@ //// [strictPropertyInitialization.ts] -var E, E1; +var E; import "@swc/helpers/_/_class_private_field_get"; import "@swc/helpers/_/_class_private_field_init"; import "@swc/helpers/_/_class_private_field_set"; -Symbol(), (E1 = E || (E = {})).A = "A", E1.B = "B"; +Symbol(), (E = {}).A = "A", E.B = "B"; diff --git a/crates/swc/tests/tsc-references/stringEnumInElementAccess01.2.minified.js b/crates/swc/tests/tsc-references/stringEnumInElementAccess01.2.minified.js index 97d337e646ae..7b326ed96bb6 100644 --- a/crates/swc/tests/tsc-references/stringEnumInElementAccess01.2.minified.js +++ b/crates/swc/tests/tsc-references/stringEnumInElementAccess01.2.minified.js @@ -1,3 +1,3 @@ //// [stringEnumInElementAccess01.ts] -var E, E1; -(E1 = E || (E = {})).A = "a", E1.B = "b", E1.C = "c", item[e]; +var E; +(E = {}).A = "a", E.B = "b", E.C = "c", item[e]; diff --git a/crates/swc/tests/tsc-references/stringLiteralTypeIsSubtypeOfString.2.minified.js b/crates/swc/tests/tsc-references/stringLiteralTypeIsSubtypeOfString.2.minified.js index d2c4d16ffab9..b65b2dd0a0d1 100644 --- a/crates/swc/tests/tsc-references/stringLiteralTypeIsSubtypeOfString.2.minified.js +++ b/crates/swc/tests/tsc-references/stringLiteralTypeIsSubtypeOfString.2.minified.js @@ -1,4 +1,4 @@ //// [stringLiteralTypeIsSubtypeOfString.ts] -var E, E1; +var E; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -(E1 = E || (E = {}))[E1.A = 0] = "A"; +(E = {})[E.A = 0] = "A"; diff --git a/crates/swc/tests/tsc-references/stringLiteralTypesOverloads01.2.minified.js b/crates/swc/tests/tsc-references/stringLiteralTypesOverloads01.2.minified.js index aa202c314408..6d97ae87b0dd 100644 --- a/crates/swc/tests/tsc-references/stringLiteralTypesOverloads01.2.minified.js +++ b/crates/swc/tests/tsc-references/stringLiteralTypesOverloads01.2.minified.js @@ -5,6 +5,6 @@ function getFalsyPrimitive(x) { if ("boolean" === x) return !1; throw "Invalid value"; } -Consts1 || (Consts1 = {}), getFalsyPrimitive("string"), getFalsyPrimitive('number'), getFalsyPrimitive("boolean"); -var Consts1, Consts2, string = "string", number = "number", boolean = "boolean", stringOrNumber = string || number, stringOrBoolean = string || boolean, booleanOrNumber = number || boolean, stringOrBooleanOrNumber = stringOrBoolean || number; -Consts2 || (Consts2 = {}), getFalsyPrimitive(string), getFalsyPrimitive(number), getFalsyPrimitive(boolean), getFalsyPrimitive(stringOrNumber), getFalsyPrimitive(stringOrBoolean), getFalsyPrimitive(booleanOrNumber), getFalsyPrimitive(stringOrBooleanOrNumber); +getFalsyPrimitive("string"), getFalsyPrimitive('number'), getFalsyPrimitive("boolean"); +var string = "string", number = "number", boolean = "boolean", stringOrNumber = string || number, stringOrBoolean = string || boolean, booleanOrNumber = number || boolean, stringOrBooleanOrNumber = stringOrBoolean || number; +getFalsyPrimitive(string), getFalsyPrimitive(number), getFalsyPrimitive(boolean), getFalsyPrimitive(stringOrNumber), getFalsyPrimitive(stringOrBoolean), getFalsyPrimitive(booleanOrNumber), getFalsyPrimitive(stringOrBooleanOrNumber); diff --git a/crates/swc/tests/tsc-references/stringLiteralTypesOverloads02.2.minified.js b/crates/swc/tests/tsc-references/stringLiteralTypesOverloads02.2.minified.js index 43a2cfce27ee..f13eb94bfc26 100644 --- a/crates/swc/tests/tsc-references/stringLiteralTypesOverloads02.2.minified.js +++ b/crates/swc/tests/tsc-references/stringLiteralTypesOverloads02.2.minified.js @@ -5,6 +5,6 @@ function getFalsyPrimitive(x) { if ("boolean" === x) return !1; throw "Invalid value"; } -Consts1 || (Consts1 = {}), getFalsyPrimitive("string"), getFalsyPrimitive('number'), getFalsyPrimitive("boolean"); -var Consts1, Consts2, string = "string", number = "number", boolean = "boolean", stringOrNumber = string || number, stringOrBoolean = string || boolean, booleanOrNumber = number || boolean, stringOrBooleanOrNumber = stringOrBoolean || number; -Consts2 || (Consts2 = {}), getFalsyPrimitive(string), getFalsyPrimitive(number), getFalsyPrimitive(boolean), getFalsyPrimitive(stringOrNumber), getFalsyPrimitive(stringOrBoolean), getFalsyPrimitive(booleanOrNumber), getFalsyPrimitive(stringOrBooleanOrNumber); +getFalsyPrimitive("string"), getFalsyPrimitive('number'), getFalsyPrimitive("boolean"); +var string = "string", number = "number", boolean = "boolean", stringOrNumber = string || number, stringOrBoolean = string || boolean, booleanOrNumber = number || boolean, stringOrBooleanOrNumber = stringOrBoolean || number; +getFalsyPrimitive(string), getFalsyPrimitive(number), getFalsyPrimitive(boolean), getFalsyPrimitive(stringOrNumber), getFalsyPrimitive(stringOrBoolean), getFalsyPrimitive(booleanOrNumber), getFalsyPrimitive(stringOrBooleanOrNumber); diff --git a/crates/swc/tests/tsc-references/subtypesOfAny.2.minified.js b/crates/swc/tests/tsc-references/subtypesOfAny.2.minified.js index 6959f847adf2..2bb4b6f08f87 100644 --- a/crates/swc/tests/tsc-references/subtypesOfAny.2.minified.js +++ b/crates/swc/tests/tsc-references/subtypesOfAny.2.minified.js @@ -1,8 +1,8 @@ //// [subtypesOfAny.ts] import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; function f() {} -(E = E1 || (E1 = {}))[E.A = 0] = "A", (f || (f = {})).bar = 1; -var E, E1, c = function c() { +(E = {})[E.A = 0] = "A", (f || (f = {})).bar = 1; +var E, c = function c() { _class_call_check(this, c); }; (c || (c = {})).bar = 1; diff --git a/crates/swc/tests/tsc-references/subtypesOfTypeParameter.2.minified.js b/crates/swc/tests/tsc-references/subtypesOfTypeParameter.2.minified.js index 8ec98a3c49d9..7d271c973e0f 100644 --- a/crates/swc/tests/tsc-references/subtypesOfTypeParameter.2.minified.js +++ b/crates/swc/tests/tsc-references/subtypesOfTypeParameter.2.minified.js @@ -3,8 +3,8 @@ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _create_super } from "@swc/helpers/_/_create_super"; function f() {} -(E1 = E || (E = {}))[E1.A = 0] = "A", (f || (f = {})).bar = 1; -var E, E1, c = function c() { +(E = {})[E.A = 0] = "A", (f || (f = {})).bar = 1; +var E, c = function c() { _class_call_check(this, c); }; (c || (c = {})).bar = 1; diff --git a/crates/swc/tests/tsc-references/subtypesOfTypeParameterWithConstraints2.2.minified.js b/crates/swc/tests/tsc-references/subtypesOfTypeParameterWithConstraints2.2.minified.js index a99ed1d0c8fe..a1b09417a170 100644 --- a/crates/swc/tests/tsc-references/subtypesOfTypeParameterWithConstraints2.2.minified.js +++ b/crates/swc/tests/tsc-references/subtypesOfTypeParameterWithConstraints2.2.minified.js @@ -1,8 +1,8 @@ //// [subtypesOfTypeParameterWithConstraints2.ts] import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; function f() {} -(E = E1 || (E1 = {}))[E.A = 0] = "A", (f || (f = {})).bar = 1; -var E, E1, c = function c() { +(E = {})[E.A = 0] = "A", (f || (f = {})).bar = 1; +var E, c = function c() { _class_call_check(this, c); }; (c || (c = {})).bar = 1; diff --git a/crates/swc/tests/tsc-references/subtypesOfTypeParameterWithRecursiveConstraints.2.minified.js b/crates/swc/tests/tsc-references/subtypesOfTypeParameterWithRecursiveConstraints.2.minified.js index 397aadf788db..fbf5fa5d0f9f 100644 --- a/crates/swc/tests/tsc-references/subtypesOfTypeParameterWithRecursiveConstraints.2.minified.js +++ b/crates/swc/tests/tsc-references/subtypesOfTypeParameterWithRecursiveConstraints.2.minified.js @@ -1,6 +1,4 @@ //// [subtypesOfTypeParameterWithRecursiveConstraints.ts] -var M1, M2; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _create_super } from "@swc/helpers/_/_create_super"; -M1 || (M1 = {}), M2 || (M2 = {}); diff --git a/crates/swc/tests/tsc-references/subtypesOfUnion.2.minified.js b/crates/swc/tests/tsc-references/subtypesOfUnion.2.minified.js index bf95162d5426..1c7de44debc4 100644 --- a/crates/swc/tests/tsc-references/subtypesOfUnion.2.minified.js +++ b/crates/swc/tests/tsc-references/subtypesOfUnion.2.minified.js @@ -1,8 +1,8 @@ //// [subtypesOfUnion.ts] import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; function f() {} -(E = E1 || (E1 = {}))[E.e1 = 0] = "e1", E[E.e2 = 1] = "e2", (f || (f = {})).bar = 1; -var E, E1, c = function c() { +(E = {})[E.e1 = 0] = "e1", E[E.e2 = 1] = "e2", (f || (f = {})).bar = 1; +var E, c = function c() { _class_call_check(this, c); }; (c || (c = {})).bar = 1; diff --git a/crates/swc/tests/tsc-references/subtypingWithCallSignatures.2.minified.js b/crates/swc/tests/tsc-references/subtypingWithCallSignatures.2.minified.js index 96d528bde1df..93ea71e7cf95 100644 --- a/crates/swc/tests/tsc-references/subtypingWithCallSignatures.2.minified.js +++ b/crates/swc/tests/tsc-references/subtypingWithCallSignatures.2.minified.js @@ -1,6 +1,5 @@ //// [subtypingWithCallSignatures.ts] -var CallSignature; -CallSignature || (CallSignature = {}), foo1(function(x) { +foo1(function(x) { return 1; }), foo1(function(x) { return ''; diff --git a/crates/swc/tests/tsc-references/subtypingWithCallSignatures3.2.minified.js b/crates/swc/tests/tsc-references/subtypingWithCallSignatures3.2.minified.js index fd3bd7bf3028..35f7be0d3de8 100644 --- a/crates/swc/tests/tsc-references/subtypingWithCallSignatures3.2.minified.js +++ b/crates/swc/tests/tsc-references/subtypingWithCallSignatures3.2.minified.js @@ -1,9 +1,8 @@ //// [subtypingWithCallSignatures3.ts] -var Errors, WithGenericSignaturesInBaseType; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _create_super } from "@swc/helpers/_/_create_super"; -Errors || (Errors = {}), foo2(function(x) { +foo2(function(x) { return null; }), foo7(function(x) { return function(r) { @@ -28,7 +27,7 @@ Errors || (Errors = {}), foo2(function(x) { return null; }), foo17(function(x) { return null; -}), WithGenericSignaturesInBaseType || (WithGenericSignaturesInBaseType = {}), foo2(function(x) { +}), foo2(function(x) { return [ '' ]; diff --git a/crates/swc/tests/tsc-references/subtypingWithConstructSignatures.2.minified.js b/crates/swc/tests/tsc-references/subtypingWithConstructSignatures.2.minified.js index 3cce021fb0d1..0fb94f322e80 100644 --- a/crates/swc/tests/tsc-references/subtypingWithConstructSignatures.2.minified.js +++ b/crates/swc/tests/tsc-references/subtypingWithConstructSignatures.2.minified.js @@ -1,3 +1,3 @@ //// [subtypingWithConstructSignatures.ts] -var ConstructSignature, rarg2, r3arg1, r4arg1; -ConstructSignature || (ConstructSignature = {}), foo1(void 0), foo1(rarg2), foo2(r3arg1), foo2(r4arg1); +var rarg2, r3arg1, r4arg1; +foo1(void 0), foo1(rarg2), foo2(r3arg1), foo2(r4arg1); diff --git a/crates/swc/tests/tsc-references/subtypingWithConstructSignatures3.2.minified.js b/crates/swc/tests/tsc-references/subtypingWithConstructSignatures3.2.minified.js index faed1e177d35..8fa9ba739271 100644 --- a/crates/swc/tests/tsc-references/subtypingWithConstructSignatures3.2.minified.js +++ b/crates/swc/tests/tsc-references/subtypingWithConstructSignatures3.2.minified.js @@ -1,6 +1,6 @@ //// [subtypingWithConstructSignatures3.ts] -var Errors, WithGenericSignaturesInBaseType, r1arg1, r2arg1, r3arg1, r4arg1, r5arg1, r6arg1, r7arg1, r7arg3, r8arg, r9arg, r3arg2; +var r1arg1, r2arg1, r3arg1, r4arg1, r5arg1, r6arg1, r7arg1, r7arg3, r8arg, r9arg, r3arg2; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _create_super } from "@swc/helpers/_/_create_super"; -Errors || (Errors = {}), foo2(r1arg1), foo7(r2arg1), foo8(r3arg1), foo10(r4arg1), foo11(r5arg1), foo12(r6arg1), foo15(r7arg1), foo15(r7arg3), foo16(r8arg), foo17(r9arg), WithGenericSignaturesInBaseType || (WithGenericSignaturesInBaseType = {}), foo2(void 0), foo3(r3arg2); +foo2(r1arg1), foo7(r2arg1), foo8(r3arg1), foo10(r4arg1), foo11(r5arg1), foo12(r6arg1), foo15(r7arg1), foo15(r7arg3), foo16(r8arg), foo17(r9arg), foo2(void 0), foo3(r3arg2); diff --git a/crates/swc/tests/tsc-references/subtypingWithNumericIndexer.2.minified.js b/crates/swc/tests/tsc-references/subtypingWithNumericIndexer.2.minified.js index d88394226933..084377b891ac 100644 --- a/crates/swc/tests/tsc-references/subtypingWithNumericIndexer.2.minified.js +++ b/crates/swc/tests/tsc-references/subtypingWithNumericIndexer.2.minified.js @@ -1,6 +1,4 @@ //// [subtypingWithNumericIndexer.ts] -var Generics; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _create_super } from "@swc/helpers/_/_create_super"; -Generics || (Generics = {}); diff --git a/crates/swc/tests/tsc-references/subtypingWithNumericIndexer3.2.minified.js b/crates/swc/tests/tsc-references/subtypingWithNumericIndexer3.2.minified.js index 90b2041fc47c..2aeea0d3e203 100644 --- a/crates/swc/tests/tsc-references/subtypingWithNumericIndexer3.2.minified.js +++ b/crates/swc/tests/tsc-references/subtypingWithNumericIndexer3.2.minified.js @@ -1,6 +1,4 @@ //// [subtypingWithNumericIndexer3.ts] -var Generics; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _create_super } from "@swc/helpers/_/_create_super"; -Generics || (Generics = {}); diff --git a/crates/swc/tests/tsc-references/subtypingWithNumericIndexer4.2.minified.js b/crates/swc/tests/tsc-references/subtypingWithNumericIndexer4.2.minified.js index 9a8a7aa20e22..92beff97d7ec 100644 --- a/crates/swc/tests/tsc-references/subtypingWithNumericIndexer4.2.minified.js +++ b/crates/swc/tests/tsc-references/subtypingWithNumericIndexer4.2.minified.js @@ -1,6 +1,4 @@ //// [subtypingWithNumericIndexer4.ts] -var Generics; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _create_super } from "@swc/helpers/_/_create_super"; -Generics || (Generics = {}); diff --git a/crates/swc/tests/tsc-references/subtypingWithNumericIndexer5.2.minified.js b/crates/swc/tests/tsc-references/subtypingWithNumericIndexer5.2.minified.js index 8869fac315c3..d06dcc97d351 100644 --- a/crates/swc/tests/tsc-references/subtypingWithNumericIndexer5.2.minified.js +++ b/crates/swc/tests/tsc-references/subtypingWithNumericIndexer5.2.minified.js @@ -1,4 +1,2 @@ //// [subtypingWithNumericIndexer5.ts] -var Generics; import "@swc/helpers/_/_class_call_check"; -Generics || (Generics = {}); diff --git a/crates/swc/tests/tsc-references/subtypingWithObjectMembers.2.minified.js b/crates/swc/tests/tsc-references/subtypingWithObjectMembers.2.minified.js index 042f5f22af7b..cd13339d848b 100644 --- a/crates/swc/tests/tsc-references/subtypingWithObjectMembers.2.minified.js +++ b/crates/swc/tests/tsc-references/subtypingWithObjectMembers.2.minified.js @@ -1,6 +1,4 @@ //// [subtypingWithObjectMembers.ts] -var TwoLevels; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _create_super } from "@swc/helpers/_/_create_super"; -TwoLevels || (TwoLevels = {}); diff --git a/crates/swc/tests/tsc-references/subtypingWithObjectMembers5.2.minified.js b/crates/swc/tests/tsc-references/subtypingWithObjectMembers5.2.minified.js index ac36468e9ad1..4771dcf43ac9 100644 --- a/crates/swc/tests/tsc-references/subtypingWithObjectMembers5.2.minified.js +++ b/crates/swc/tests/tsc-references/subtypingWithObjectMembers5.2.minified.js @@ -1,4 +1,2 @@ //// [subtypingWithObjectMembers5.ts] -var NotOptional, Optional; import "@swc/helpers/_/_class_call_check"; -NotOptional || (NotOptional = {}), Optional || (Optional = {}); diff --git a/crates/swc/tests/tsc-references/subtypingWithObjectMembersAccessibility2.2.minified.js b/crates/swc/tests/tsc-references/subtypingWithObjectMembersAccessibility2.2.minified.js index 7d6a1d4e2221..62393636e7df 100644 --- a/crates/swc/tests/tsc-references/subtypingWithObjectMembersAccessibility2.2.minified.js +++ b/crates/swc/tests/tsc-references/subtypingWithObjectMembersAccessibility2.2.minified.js @@ -1,6 +1,4 @@ //// [subtypingWithObjectMembersAccessibility2.ts] -var ExplicitPublic, ImplicitPublic; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _create_super } from "@swc/helpers/_/_create_super"; -ExplicitPublic || (ExplicitPublic = {}), ImplicitPublic || (ImplicitPublic = {}); diff --git a/crates/swc/tests/tsc-references/subtypingWithObjectMembersOptionality.2.minified.js b/crates/swc/tests/tsc-references/subtypingWithObjectMembersOptionality.2.minified.js index 450a08812325..5a3970c9695e 100644 --- a/crates/swc/tests/tsc-references/subtypingWithObjectMembersOptionality.2.minified.js +++ b/crates/swc/tests/tsc-references/subtypingWithObjectMembersOptionality.2.minified.js @@ -1,3 +1 @@ //// [subtypingWithObjectMembersOptionality.ts] -var TwoLevels; -TwoLevels || (TwoLevels = {}); diff --git a/crates/swc/tests/tsc-references/subtypingWithStringIndexer.2.minified.js b/crates/swc/tests/tsc-references/subtypingWithStringIndexer.2.minified.js index d85e256b1f8a..688e933c1659 100644 --- a/crates/swc/tests/tsc-references/subtypingWithStringIndexer.2.minified.js +++ b/crates/swc/tests/tsc-references/subtypingWithStringIndexer.2.minified.js @@ -1,6 +1,4 @@ //// [subtypingWithStringIndexer.ts] -var Generics; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _create_super } from "@swc/helpers/_/_create_super"; -Generics || (Generics = {}); diff --git a/crates/swc/tests/tsc-references/subtypingWithStringIndexer3.2.minified.js b/crates/swc/tests/tsc-references/subtypingWithStringIndexer3.2.minified.js index e553063ec44f..1dde63b45152 100644 --- a/crates/swc/tests/tsc-references/subtypingWithStringIndexer3.2.minified.js +++ b/crates/swc/tests/tsc-references/subtypingWithStringIndexer3.2.minified.js @@ -1,6 +1,4 @@ //// [subtypingWithStringIndexer3.ts] -var Generics; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _create_super } from "@swc/helpers/_/_create_super"; -Generics || (Generics = {}); diff --git a/crates/swc/tests/tsc-references/subtypingWithStringIndexer4.2.minified.js b/crates/swc/tests/tsc-references/subtypingWithStringIndexer4.2.minified.js index a7dee9ac8c87..77a723dd966d 100644 --- a/crates/swc/tests/tsc-references/subtypingWithStringIndexer4.2.minified.js +++ b/crates/swc/tests/tsc-references/subtypingWithStringIndexer4.2.minified.js @@ -1,6 +1,4 @@ //// [subtypingWithStringIndexer4.ts] -var Generics; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _create_super } from "@swc/helpers/_/_create_super"; -Generics || (Generics = {}); diff --git a/crates/swc/tests/tsc-references/superInStaticMembers1(target=es2015).2.minified.js b/crates/swc/tests/tsc-references/superInStaticMembers1(target=es2015).2.minified.js index a53654009d52..a1c4dc39e59b 100644 --- a/crates/swc/tests/tsc-references/superInStaticMembers1(target=es2015).2.minified.js +++ b/crates/swc/tests/tsc-references/superInStaticMembers1(target=es2015).2.minified.js @@ -7,7 +7,6 @@ Baz || (Baz = {}); export default class { } //// [locals.ts] -let Reflect, Reflect1; import { _ as _get } from "@swc/helpers/_/_get"; import { _ as _get_prototype_of } from "@swc/helpers/_/_get_prototype_of"; class C extends B { @@ -28,7 +27,7 @@ C._ = [ })(), void _get(_get_prototype_of(C), "w", C).call(C), void _get(_get_prototype_of(C), "w", C).call(C), - void (Reflect || (Reflect = {}), _get(_get_prototype_of(C), "w", C).call(C)), + void _get(_get_prototype_of(C), "w", C).call(C), void _get(_get_prototype_of(C), "w", C).call(C), void _get(_get_prototype_of(C), "w", C).call(C), void _get(_get_prototype_of(C), "w", C).call(C), @@ -44,7 +43,7 @@ C._ = [ null ]; _get(_get_prototype_of(C), "w", C).call(C); -})(), _get(_get_prototype_of(C), "w", C).call(C), _get(_get_prototype_of(C), "w", C).call(C), _get(_get_prototype_of(C), "w", C).call(C), Reflect1 || (Reflect1 = {}), _get(_get_prototype_of(C), "w", C).call(C), _get(_get_prototype_of(C), "w", C).call(C), _get(_get_prototype_of(C), "w", C).call(C), _get(_get_prototype_of(C), "w", C).call(C), _get(_get_prototype_of(C), "w", C).call(C), _get(_get_prototype_of(C), "w", C).call(C); +})(), _get(_get_prototype_of(C), "w", C).call(C), _get(_get_prototype_of(C), "w", C).call(C), _get(_get_prototype_of(C), "w", C).call(C), _get(_get_prototype_of(C), "w", C).call(C), _get(_get_prototype_of(C), "w", C).call(C), _get(_get_prototype_of(C), "w", C).call(C), _get(_get_prototype_of(C), "w", C).call(C), _get(_get_prototype_of(C), "w", C).call(C), _get(_get_prototype_of(C), "w", C).call(C); //// [varInContainingScopeStaticField1.ts] import { _ as _get } from "@swc/helpers/_/_get"; import { _ as _get_prototype_of } from "@swc/helpers/_/_get_prototype_of"; @@ -130,18 +129,14 @@ class C extends B { } _get(_get_prototype_of(C), "w", C).call(C); //// [enumInContainingScopeStaticField.ts] -var Reflect; import { _ as _get } from "@swc/helpers/_/_get"; import { _ as _get_prototype_of } from "@swc/helpers/_/_get_prototype_of"; -Reflect || (Reflect = {}); class C extends B { } C._ = _get(_get_prototype_of(C), "w", C).call(C); //// [enumInContainingScopeStaticBlock.ts] -var Reflect; import { _ as _get } from "@swc/helpers/_/_get"; import { _ as _get_prototype_of } from "@swc/helpers/_/_get_prototype_of"; -Reflect || (Reflect = {}); class C extends B { } _get(_get_prototype_of(C), "w", C).call(C); diff --git a/crates/swc/tests/tsc-references/superInStaticMembers1(target=es2021).2.minified.js b/crates/swc/tests/tsc-references/superInStaticMembers1(target=es2021).2.minified.js index a53654009d52..a1c4dc39e59b 100644 --- a/crates/swc/tests/tsc-references/superInStaticMembers1(target=es2021).2.minified.js +++ b/crates/swc/tests/tsc-references/superInStaticMembers1(target=es2021).2.minified.js @@ -7,7 +7,6 @@ Baz || (Baz = {}); export default class { } //// [locals.ts] -let Reflect, Reflect1; import { _ as _get } from "@swc/helpers/_/_get"; import { _ as _get_prototype_of } from "@swc/helpers/_/_get_prototype_of"; class C extends B { @@ -28,7 +27,7 @@ C._ = [ })(), void _get(_get_prototype_of(C), "w", C).call(C), void _get(_get_prototype_of(C), "w", C).call(C), - void (Reflect || (Reflect = {}), _get(_get_prototype_of(C), "w", C).call(C)), + void _get(_get_prototype_of(C), "w", C).call(C), void _get(_get_prototype_of(C), "w", C).call(C), void _get(_get_prototype_of(C), "w", C).call(C), void _get(_get_prototype_of(C), "w", C).call(C), @@ -44,7 +43,7 @@ C._ = [ null ]; _get(_get_prototype_of(C), "w", C).call(C); -})(), _get(_get_prototype_of(C), "w", C).call(C), _get(_get_prototype_of(C), "w", C).call(C), _get(_get_prototype_of(C), "w", C).call(C), Reflect1 || (Reflect1 = {}), _get(_get_prototype_of(C), "w", C).call(C), _get(_get_prototype_of(C), "w", C).call(C), _get(_get_prototype_of(C), "w", C).call(C), _get(_get_prototype_of(C), "w", C).call(C), _get(_get_prototype_of(C), "w", C).call(C), _get(_get_prototype_of(C), "w", C).call(C); +})(), _get(_get_prototype_of(C), "w", C).call(C), _get(_get_prototype_of(C), "w", C).call(C), _get(_get_prototype_of(C), "w", C).call(C), _get(_get_prototype_of(C), "w", C).call(C), _get(_get_prototype_of(C), "w", C).call(C), _get(_get_prototype_of(C), "w", C).call(C), _get(_get_prototype_of(C), "w", C).call(C), _get(_get_prototype_of(C), "w", C).call(C), _get(_get_prototype_of(C), "w", C).call(C); //// [varInContainingScopeStaticField1.ts] import { _ as _get } from "@swc/helpers/_/_get"; import { _ as _get_prototype_of } from "@swc/helpers/_/_get_prototype_of"; @@ -130,18 +129,14 @@ class C extends B { } _get(_get_prototype_of(C), "w", C).call(C); //// [enumInContainingScopeStaticField.ts] -var Reflect; import { _ as _get } from "@swc/helpers/_/_get"; import { _ as _get_prototype_of } from "@swc/helpers/_/_get_prototype_of"; -Reflect || (Reflect = {}); class C extends B { } C._ = _get(_get_prototype_of(C), "w", C).call(C); //// [enumInContainingScopeStaticBlock.ts] -var Reflect; import { _ as _get } from "@swc/helpers/_/_get"; import { _ as _get_prototype_of } from "@swc/helpers/_/_get_prototype_of"; -Reflect || (Reflect = {}); class C extends B { } _get(_get_prototype_of(C), "w", C).call(C); diff --git a/crates/swc/tests/tsc-references/superInStaticMembers1(target=es2022).2.minified.js b/crates/swc/tests/tsc-references/superInStaticMembers1(target=es2022).2.minified.js index a56d6182ef52..4b64a734a262 100644 --- a/crates/swc/tests/tsc-references/superInStaticMembers1(target=es2022).2.minified.js +++ b/crates/swc/tests/tsc-references/superInStaticMembers1(target=es2022).2.minified.js @@ -9,7 +9,6 @@ export default class { //// [locals.ts] class C extends B { static{ - let Reflect; this._ = [ void super.w(), (()=>{ @@ -26,7 +25,7 @@ class C extends B { })(), void super.w(), void super.w(), - void (Reflect || (Reflect = {}), super.w()), + void super.w(), void super.w(), void super.w(), void super.w(), @@ -56,8 +55,7 @@ class C extends B { super.w(); } static{ - let Reflect; - Reflect || (Reflect = {}), super.w(); + super.w(); } static{ super.w(); @@ -173,8 +171,6 @@ class C extends B { } export { }; //// [enumInContainingScopeStaticField.ts] -var Reflect; -Reflect || (Reflect = {}); class C extends B { static{ this._ = super.w(); @@ -182,8 +178,6 @@ class C extends B { } export { }; //// [enumInContainingScopeStaticBlock.ts] -var Reflect; -Reflect || (Reflect = {}); class C extends B { static{ super.w(); diff --git a/crates/swc/tests/tsc-references/superInStaticMembers1(target=es5).2.minified.js b/crates/swc/tests/tsc-references/superInStaticMembers1(target=es5).2.minified.js index ca9405deac9b..385fd8f8b05e 100644 --- a/crates/swc/tests/tsc-references/superInStaticMembers1(target=es5).2.minified.js +++ b/crates/swc/tests/tsc-references/superInStaticMembers1(target=es5).2.minified.js @@ -16,7 +16,7 @@ import { _ as _get } from "@swc/helpers/_/_get"; import { _ as _get_prototype_of } from "@swc/helpers/_/_get_prototype_of"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _create_super } from "@swc/helpers/_/_create_super"; -var Reflect, Reflect1, C = function(B1) { +var C = function(B1) { _inherits(C, B1); var _super = _create_super(C); function C() { @@ -30,13 +30,13 @@ C._ = [ void _get(_get_prototype_of(C), "w", C).call(C), void _get(_get_prototype_of(C), "w", C).call(C), void _get(_get_prototype_of(C), "w", C).call(C), - void (Reflect || (Reflect = {}), _get(_get_prototype_of(C), "w", C).call(C)), + void _get(_get_prototype_of(C), "w", C).call(C), void _get(_get_prototype_of(C), "w", C).call(C), void _get(_get_prototype_of(C), "w", C).call(C), void _get(_get_prototype_of(C), "w", C).call(C), void _get(_get_prototype_of(C), "w", C).call(C), void _get(_get_prototype_of(C), "w", C).call(C) -], _get(_get_prototype_of(C), "w", C).call(C), _get(_get_prototype_of(C), "w", C).call(C), _get(_get_prototype_of(C), "w", C).call(C), _get(_get_prototype_of(C), "w", C).call(C), _get(_get_prototype_of(C), "w", C).call(C), Reflect1 || (Reflect1 = {}), _get(_get_prototype_of(C), "w", C).call(C), _get(_get_prototype_of(C), "w", C).call(C), _get(_get_prototype_of(C), "w", C).call(C), _get(_get_prototype_of(C), "w", C).call(C), _get(_get_prototype_of(C), "w", C).call(C), _get(_get_prototype_of(C), "w", C).call(C); +], _get(_get_prototype_of(C), "w", C).call(C), _get(_get_prototype_of(C), "w", C).call(C), _get(_get_prototype_of(C), "w", C).call(C), _get(_get_prototype_of(C), "w", C).call(C), _get(_get_prototype_of(C), "w", C).call(C), _get(_get_prototype_of(C), "w", C).call(C), _get(_get_prototype_of(C), "w", C).call(C), _get(_get_prototype_of(C), "w", C).call(C), _get(_get_prototype_of(C), "w", C).call(C), _get(_get_prototype_of(C), "w", C).call(C), _get(_get_prototype_of(C), "w", C).call(C); //// [varInContainingScopeStaticField1.ts] import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _get } from "@swc/helpers/_/_get"; @@ -223,8 +223,7 @@ import { _ as _get } from "@swc/helpers/_/_get"; import { _ as _get_prototype_of } from "@swc/helpers/_/_get_prototype_of"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _create_super } from "@swc/helpers/_/_create_super"; -Reflect || (Reflect = {}); -var Reflect, C = function(B1) { +var C = function(B1) { _inherits(C, B1); var _super = _create_super(C); function C() { @@ -239,8 +238,7 @@ import { _ as _get } from "@swc/helpers/_/_get"; import { _ as _get_prototype_of } from "@swc/helpers/_/_get_prototype_of"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _create_super } from "@swc/helpers/_/_create_super"; -Reflect || (Reflect = {}); -var Reflect, C = function(B1) { +var C = function(B1) { _inherits(C, B1); var _super = _create_super(C); function C() { 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 index a56d6182ef52..4b64a734a262 100644 --- a/crates/swc/tests/tsc-references/superInStaticMembers1(target=esnext).2.minified.js +++ b/crates/swc/tests/tsc-references/superInStaticMembers1(target=esnext).2.minified.js @@ -9,7 +9,6 @@ export default class { //// [locals.ts] class C extends B { static{ - let Reflect; this._ = [ void super.w(), (()=>{ @@ -26,7 +25,7 @@ class C extends B { })(), void super.w(), void super.w(), - void (Reflect || (Reflect = {}), super.w()), + void super.w(), void super.w(), void super.w(), void super.w(), @@ -56,8 +55,7 @@ class C extends B { super.w(); } static{ - let Reflect; - Reflect || (Reflect = {}), super.w(); + super.w(); } static{ super.w(); @@ -173,8 +171,6 @@ class C extends B { } export { }; //// [enumInContainingScopeStaticField.ts] -var Reflect; -Reflect || (Reflect = {}); class C extends B { static{ this._ = super.w(); @@ -182,8 +178,6 @@ class C extends B { } export { }; //// [enumInContainingScopeStaticBlock.ts] -var Reflect; -Reflect || (Reflect = {}); class C extends B { static{ super.w(); diff --git a/crates/swc/tests/tsc-references/switchStatements.2.minified.js b/crates/swc/tests/tsc-references/switchStatements.2.minified.js index fadae0d7d835..22c241a911ef 100644 --- a/crates/swc/tests/tsc-references/switchStatements.2.minified.js +++ b/crates/swc/tests/tsc-references/switchStatements.2.minified.js @@ -3,7 +3,7 @@ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _type_of } from "@swc/helpers/_/_type_of"; import { _ as _create_super } from "@swc/helpers/_/_create_super"; -switch((M || (M = {})).fn = function(x) { +switch((M = {}).fn = function(x) { return ''; }, x){ case '': diff --git a/crates/swc/tests/tsc-references/symbolDeclarationEmit12.2.minified.js b/crates/swc/tests/tsc-references/symbolDeclarationEmit12.2.minified.js index b2311b4ec98f..10ca4e9291b6 100644 --- a/crates/swc/tests/tsc-references/symbolDeclarationEmit12.2.minified.js +++ b/crates/swc/tests/tsc-references/symbolDeclarationEmit12.2.minified.js @@ -1,7 +1,7 @@ //// [symbolDeclarationEmit12.ts] -var M, M1; +var M; let _Symbol_toPrimitive, _Symbol_isConcatSpreadable, _Symbol_toPrimitive1, _Symbol_toPrimitive2; -M1 = M || (M = {}), _Symbol_toPrimitive = Symbol.toPrimitive, _Symbol_isConcatSpreadable = Symbol.isConcatSpreadable, _Symbol_toPrimitive1 = Symbol.toPrimitive, _Symbol_toPrimitive2 = Symbol.toPrimitive, M1.C = class { +M = {}, _Symbol_toPrimitive = Symbol.toPrimitive, _Symbol_isConcatSpreadable = Symbol.isConcatSpreadable, _Symbol_toPrimitive1 = Symbol.toPrimitive, _Symbol_toPrimitive2 = Symbol.toPrimitive, M.C = class { [_Symbol_toPrimitive](x) {} [_Symbol_isConcatSpreadable]() {} get [_Symbol_toPrimitive1]() {} diff --git a/crates/swc/tests/tsc-references/symbolProperty48.2.minified.js b/crates/swc/tests/tsc-references/symbolProperty48.2.minified.js index 73e62cba371c..d38670a1cd29 100644 --- a/crates/swc/tests/tsc-references/symbolProperty48.2.minified.js +++ b/crates/swc/tests/tsc-references/symbolProperty48.2.minified.js @@ -1,3 +1,2 @@ //// [symbolProperty48.ts] -var M; -M || (M = {}), (void 0).iterator; +(void 0).iterator; diff --git a/crates/swc/tests/tsc-references/symbolProperty49.2.minified.js b/crates/swc/tests/tsc-references/symbolProperty49.2.minified.js index c6edd610a0ec..d7af41151638 100644 --- a/crates/swc/tests/tsc-references/symbolProperty49.2.minified.js +++ b/crates/swc/tests/tsc-references/symbolProperty49.2.minified.js @@ -1,3 +1,2 @@ //// [symbolProperty49.ts] -var M; -(M || (M = {})).Symbol.iterator; +({}).Symbol.iterator; diff --git a/crates/swc/tests/tsc-references/symbolProperty50.2.minified.js b/crates/swc/tests/tsc-references/symbolProperty50.2.minified.js index e74322d4c151..525e92a53151 100644 --- a/crates/swc/tests/tsc-references/symbolProperty50.2.minified.js +++ b/crates/swc/tests/tsc-references/symbolProperty50.2.minified.js @@ -1,3 +1 @@ //// [symbolProperty50.ts] -var M; -M || (M = {}); diff --git a/crates/swc/tests/tsc-references/symbolProperty51.2.minified.js b/crates/swc/tests/tsc-references/symbolProperty51.2.minified.js index c357cb50c288..efe3ba05d53d 100644 --- a/crates/swc/tests/tsc-references/symbolProperty51.2.minified.js +++ b/crates/swc/tests/tsc-references/symbolProperty51.2.minified.js @@ -1,3 +1 @@ //// [symbolProperty51.ts] -var M; -M || (M = {}); diff --git a/crates/swc/tests/tsc-references/symbolProperty55.2.minified.js b/crates/swc/tests/tsc-references/symbolProperty55.2.minified.js index 456ed3dc17c4..a1f7cfb29565 100644 --- a/crates/swc/tests/tsc-references/symbolProperty55.2.minified.js +++ b/crates/swc/tests/tsc-references/symbolProperty55.2.minified.js @@ -1,3 +1,2 @@ //// [symbolProperty55.ts] -var M; -M || (M = {}), (void 0).iterator; +(void 0).iterator; diff --git a/crates/swc/tests/tsc-references/symbolProperty56.2.minified.js b/crates/swc/tests/tsc-references/symbolProperty56.2.minified.js index 23ecb7f95b72..f784458a2b9a 100644 --- a/crates/swc/tests/tsc-references/symbolProperty56.2.minified.js +++ b/crates/swc/tests/tsc-references/symbolProperty56.2.minified.js @@ -1,3 +1,2 @@ //// [symbolProperty56.ts] -var M; -M || (M = {}), (void 0).iterator; +(void 0).iterator; diff --git a/crates/swc/tests/tsc-references/symbolType19.2.minified.js b/crates/swc/tests/tsc-references/symbolType19.2.minified.js index 039f5ab7d4d2..d4d6ec6a9e89 100644 --- a/crates/swc/tests/tsc-references/symbolType19.2.minified.js +++ b/crates/swc/tests/tsc-references/symbolType19.2.minified.js @@ -1,3 +1 @@ //// [symbolType19.ts] -var E; -E || (E = {}); diff --git a/crates/swc/tests/tsc-references/thisTypeErrors.2.minified.js b/crates/swc/tests/tsc-references/thisTypeErrors.2.minified.js index 07eee257cf2d..91b1dca579d3 100644 --- a/crates/swc/tests/tsc-references/thisTypeErrors.2.minified.js +++ b/crates/swc/tests/tsc-references/thisTypeErrors.2.minified.js @@ -1,5 +1,4 @@ //// [thisTypeErrors.ts] -var N1; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; (function() { function C2() { @@ -8,4 +7,4 @@ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; return C2.foo = function(x) {}, C2; })().y = void 0, function(N1) { N1.y = this; -}(N1 || (N1 = {})); +}({}); diff --git a/crates/swc/tests/tsc-references/throwStatements.2.minified.js b/crates/swc/tests/tsc-references/throwStatements.2.minified.js index 4bead994c000..5d007a86f3e2 100644 --- a/crates/swc/tests/tsc-references/throwStatements.2.minified.js +++ b/crates/swc/tests/tsc-references/throwStatements.2.minified.js @@ -1,9 +1,9 @@ //// [throwStatements.ts] -var M, M1; +var M; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _type_of } from "@swc/helpers/_/_type_of"; -throw (M1 = M || (M = {})).A = function A() { +throw (M = {}).A = function A() { _class_call_check(this, A); -}, M1.F2 = function(x) { +}, M.F2 = function(x) { return x.toString(); }, 9.9; diff --git a/crates/swc/tests/tsc-references/tsxElementResolution.2.minified.js b/crates/swc/tests/tsc-references/tsxElementResolution.2.minified.js index 3f6a50ffb39d..c860c1cfeba8 100644 --- a/crates/swc/tests/tsc-references/tsxElementResolution.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxElementResolution.2.minified.js @@ -1,6 +1,6 @@ //// [tsxElementResolution.tsx] var Dotted; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; -(Dotted || (Dotted = {})).Name = function Name() { +(Dotted = {}).Name = function Name() { _class_call_check(this, Name); }, Dotted.Name; diff --git a/crates/swc/tests/tsc-references/tsxElementResolution7.2.minified.js b/crates/swc/tests/tsc-references/tsxElementResolution7.2.minified.js index 7a17146c7938..d66d6d199e43 100644 --- a/crates/swc/tests/tsc-references/tsxElementResolution7.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxElementResolution7.2.minified.js @@ -1,3 +1,3 @@ //// [file.tsx] -var my, q, mine; -my || (my = {}), my.div, my.other, q || (q = {}), (mine = my).div, mine.non; +var my; +(my = {}).div, my.other, my.div, my.non; diff --git a/crates/swc/tests/tsc-references/twoInterfacesDifferentRootModule.2.minified.js b/crates/swc/tests/tsc-references/twoInterfacesDifferentRootModule.2.minified.js index a457d9d93139..7cf25a32ff40 100644 --- a/crates/swc/tests/tsc-references/twoInterfacesDifferentRootModule.2.minified.js +++ b/crates/swc/tests/tsc-references/twoInterfacesDifferentRootModule.2.minified.js @@ -1,3 +1,3 @@ //// [twoInterfacesDifferentRootModule.ts] -var M2, a, b; -M2 || (M2 = {}), a.foo, a.bar, b.foo, b.bar; +var a, b; +a.foo, a.bar, b.foo, b.bar; diff --git a/crates/swc/tests/tsc-references/twoInterfacesDifferentRootModule2.2.minified.js b/crates/swc/tests/tsc-references/twoInterfacesDifferentRootModule2.2.minified.js index 8106e5ea5500..c4c9c081d595 100644 --- a/crates/swc/tests/tsc-references/twoInterfacesDifferentRootModule2.2.minified.js +++ b/crates/swc/tests/tsc-references/twoInterfacesDifferentRootModule2.2.minified.js @@ -1,3 +1,3 @@ //// [twoInterfacesDifferentRootModule2.ts] -var M, M2, a, b, a1, b1; -M || (M = {}), M2 || (M2 = {}), a1.foo, a1.bar, b1.foo, b1.bar, a.foo, a.bar, b.foo, b.bar; +var a, b, a1, b1; +a1.foo, a1.bar, b1.foo, b1.bar, a.foo, a.bar, b.foo, b.bar; diff --git a/crates/swc/tests/tsc-references/twoMergedInterfacesWithDifferingOverloads2.2.minified.js b/crates/swc/tests/tsc-references/twoMergedInterfacesWithDifferingOverloads2.2.minified.js index 0498446137d9..c9a0422f0cb6 100644 --- a/crates/swc/tests/tsc-references/twoMergedInterfacesWithDifferingOverloads2.2.minified.js +++ b/crates/swc/tests/tsc-references/twoMergedInterfacesWithDifferingOverloads2.2.minified.js @@ -1,3 +1,3 @@ //// [twoMergedInterfacesWithDifferingOverloads2.ts] -var a, G, a1; -a(), a(1), a(1, 2), G || (G = {}), a1(), a1(!0), a1(!0, 2), a1(1, !0); +var a, a1; +a(), a(1), a(1, 2), a1(), a1(!0), a1(!0, 2), a1(1, !0); diff --git a/crates/swc/tests/tsc-references/typeAliases.2.minified.js b/crates/swc/tests/tsc-references/typeAliases.2.minified.js index 055083e87330..484d5488d17d 100644 --- a/crates/swc/tests/tsc-references/typeAliases.2.minified.js +++ b/crates/swc/tests/tsc-references/typeAliases.2.minified.js @@ -1,7 +1,7 @@ //// [typeAliases.ts] -var E, x13_1, x13_2, E1, x; +var E, x13_1, x13_2, x; import "@swc/helpers/_/_class_call_check"; -foo13(x13_1, x13_2), foo13(x13_2, x13_1), (E = E1 || (E1 = {}))[E.x = 10] = "x", f15(10).toLowerCase(), f16(x), [ +foo13(x13_1, x13_2), foo13(x13_2, x13_1), (E = {})[E.x = 10] = "x", f15(10).toLowerCase(), f16(x), [ "1", !1 ][0].toLowerCase(); diff --git a/crates/swc/tests/tsc-references/typeArgumentInferenceWithObjectLiteral.2.minified.js b/crates/swc/tests/tsc-references/typeArgumentInferenceWithObjectLiteral.2.minified.js index fcc041331963..cd9fff81c945 100644 --- a/crates/swc/tests/tsc-references/typeArgumentInferenceWithObjectLiteral.2.minified.js +++ b/crates/swc/tests/tsc-references/typeArgumentInferenceWithObjectLiteral.2.minified.js @@ -1,6 +1,6 @@ //// [typeArgumentInferenceWithObjectLiteral.ts] -var E1, E2, E11, E21; -(E11 = E1 || (E1 = {}))[E11.X = 0] = "X", (E21 = E2 || (E2 = {}))[E21.X = 0] = "X", f1({ +var E1, E2; +(E1 = {})[E1.X = 0] = "X", (E2 = {})[E2.X = 0] = "X", f1({ w: function(x) { return x; }, diff --git a/crates/swc/tests/tsc-references/typeArgumentsWithStringLiteralTypes01.2.minified.js b/crates/swc/tests/tsc-references/typeArgumentsWithStringLiteralTypes01.2.minified.js index d475194c55d3..a5c2b3248fd7 100644 --- a/crates/swc/tests/tsc-references/typeArgumentsWithStringLiteralTypes01.2.minified.js +++ b/crates/swc/tests/tsc-references/typeArgumentsWithStringLiteralTypes01.2.minified.js @@ -1,5 +1,5 @@ //// [typeArgumentsWithStringLiteralTypes01.ts] -var n1, n2, n3, n11, n21, n31; +var n1, n2, n3; function fun1(x, y) { return randBool() ? x : y; } @@ -10,4 +10,4 @@ function fun3() { for(var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; return args[+randBool()]; } -(n11 = n1 || (n1 = {})).a = fun1("Hello", "World"), n11.b = fun1("Hello", "Hello"), n11.c = fun2("Hello", "World"), n11.d = fun2("Hello", "Hello"), n11.e = fun3("Hello", "Hello", "World", "Foo"), n11.a = takeReturnString(n11.a), n11.b = takeReturnString(n11.b), n11.c = takeReturnString(n11.c), n11.d = takeReturnString(n11.d), n11.e = takeReturnString(n11.e), n11.a = takeReturnHello(n11.a), n11.b = takeReturnHello(n11.b), n11.c = takeReturnHello(n11.c), n11.d = takeReturnHello(n11.d), n11.e = takeReturnHello(n11.e), n11.a = takeReturnHelloWorld(n11.a), n11.b = takeReturnHelloWorld(n11.b), n11.c = takeReturnHelloWorld(n11.c), n11.d = takeReturnHelloWorld(n11.d), n11.e = takeReturnHelloWorld(n11.e), (n21 = n2 || (n2 = {})).a = fun1("Hello", "Hello"), n21.b = fun1("Hello", "World"), n21.c = fun2("Hello", "Hello"), n21.d = fun2("Hello", "World"), n21.e = fun3("Hello", "World"), n21.a = takeReturnString(n21.a), n21.b = takeReturnString(n21.b), n21.c = takeReturnString(n21.c), n21.d = takeReturnString(n21.d), n21.e = takeReturnString(n21.e), n21.a = takeReturnHello(n21.a), n21.b = takeReturnHello(n21.b), n21.c = takeReturnHello(n21.c), n21.d = takeReturnHello(n21.d), n21.e = takeReturnHello(n21.e), n21.a = takeReturnHelloWorld(n21.a), n21.b = takeReturnHelloWorld(n21.b), n21.c = takeReturnHelloWorld(n21.c), n21.d = takeReturnHelloWorld(n21.d), n21.e = takeReturnHelloWorld(n21.e), (n31 = n3 || (n3 = {})).a = fun2("Hello", "World"), n31.b = fun2("World", "Hello"), n31.c = fun2("Hello", "Hello"), n31.d = fun2("World", "World"), n31.e = fun3("Hello", "World"), n31.a = takeReturnString(n31.a), n31.b = takeReturnString(n31.b), n31.c = takeReturnString(n31.c), n31.d = takeReturnString(n31.d), n31.e = takeReturnString(n31.e), n31.a = takeReturnHello(n31.a), n31.b = takeReturnHello(n31.b), n31.c = takeReturnHello(n31.c), n31.d = takeReturnHello(n31.d), n31.e = takeReturnHello(n31.e), n31.a = takeReturnHelloWorld(n31.a), n31.b = takeReturnHelloWorld(n31.b), n31.c = takeReturnHelloWorld(n31.c), n31.d = takeReturnHelloWorld(n31.d), n31.e = takeReturnHelloWorld(n31.e); +(n1 = {}).a = fun1("Hello", "World"), n1.b = fun1("Hello", "Hello"), n1.c = fun2("Hello", "World"), n1.d = fun2("Hello", "Hello"), n1.e = fun3("Hello", "Hello", "World", "Foo"), n1.a = takeReturnString(n1.a), n1.b = takeReturnString(n1.b), n1.c = takeReturnString(n1.c), n1.d = takeReturnString(n1.d), n1.e = takeReturnString(n1.e), n1.a = takeReturnHello(n1.a), n1.b = takeReturnHello(n1.b), n1.c = takeReturnHello(n1.c), n1.d = takeReturnHello(n1.d), n1.e = takeReturnHello(n1.e), n1.a = takeReturnHelloWorld(n1.a), n1.b = takeReturnHelloWorld(n1.b), n1.c = takeReturnHelloWorld(n1.c), n1.d = takeReturnHelloWorld(n1.d), n1.e = takeReturnHelloWorld(n1.e), (n2 = {}).a = fun1("Hello", "Hello"), n2.b = fun1("Hello", "World"), n2.c = fun2("Hello", "Hello"), n2.d = fun2("Hello", "World"), n2.e = fun3("Hello", "World"), n2.a = takeReturnString(n2.a), n2.b = takeReturnString(n2.b), n2.c = takeReturnString(n2.c), n2.d = takeReturnString(n2.d), n2.e = takeReturnString(n2.e), n2.a = takeReturnHello(n2.a), n2.b = takeReturnHello(n2.b), n2.c = takeReturnHello(n2.c), n2.d = takeReturnHello(n2.d), n2.e = takeReturnHello(n2.e), n2.a = takeReturnHelloWorld(n2.a), n2.b = takeReturnHelloWorld(n2.b), n2.c = takeReturnHelloWorld(n2.c), n2.d = takeReturnHelloWorld(n2.d), n2.e = takeReturnHelloWorld(n2.e), (n3 = {}).a = fun2("Hello", "World"), n3.b = fun2("World", "Hello"), n3.c = fun2("Hello", "Hello"), n3.d = fun2("World", "World"), n3.e = fun3("Hello", "World"), n3.a = takeReturnString(n3.a), n3.b = takeReturnString(n3.b), n3.c = takeReturnString(n3.c), n3.d = takeReturnString(n3.d), n3.e = takeReturnString(n3.e), n3.a = takeReturnHello(n3.a), n3.b = takeReturnHello(n3.b), n3.c = takeReturnHello(n3.c), n3.d = takeReturnHello(n3.d), n3.e = takeReturnHello(n3.e), n3.a = takeReturnHelloWorld(n3.a), n3.b = takeReturnHelloWorld(n3.b), n3.c = takeReturnHelloWorld(n3.c), n3.d = takeReturnHelloWorld(n3.d), n3.e = takeReturnHelloWorld(n3.e); diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignment29.2.minified.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignment29.2.minified.js index f4e5aacbe7e7..5fbadc51361a 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignment29.2.minified.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignment29.2.minified.js @@ -6,7 +6,7 @@ function ExpandoDecl(n) { ExpandoDecl.prop = 2, ExpandoDecl.m = function(n) { return n + 1; }, ExpandoDecl.prop, ExpandoDecl.m(12), ExpandoDecl(101).length; -var Ns, ExpandoExpr = function(n) { +var ExpandoExpr = function(n) { return n.toString(); }; ExpandoExpr.prop = { @@ -29,7 +29,7 @@ ExpandoArrow.prop = 2, ExpandoArrow.m = function(n) { ExpandoNamespace.p6 = 42, Ns.foo = function() { return ExpandoNamespace; }; -}(Ns || (Ns = {})); +}({}); var ExpandoExpr2 = function(n) { return n.toString(); }; diff --git a/crates/swc/tests/tsc-references/typeGuardEnums.2.minified.js b/crates/swc/tests/tsc-references/typeGuardEnums.2.minified.js index 0601614dcf09..63fb6dbbfe18 100644 --- a/crates/swc/tests/tsc-references/typeGuardEnums.2.minified.js +++ b/crates/swc/tests/tsc-references/typeGuardEnums.2.minified.js @@ -1,3 +1 @@ //// [typeGuardEnums.ts] -var E, V; -E || (E = {}), V || (V = {}); diff --git a/crates/swc/tests/tsc-references/typeGuardsInFunctionAndModuleBlock.2.minified.js b/crates/swc/tests/tsc-references/typeGuardsInFunctionAndModuleBlock.2.minified.js index acca28808518..ca7a86f88009 100644 --- a/crates/swc/tests/tsc-references/typeGuardsInFunctionAndModuleBlock.2.minified.js +++ b/crates/swc/tests/tsc-references/typeGuardsInFunctionAndModuleBlock.2.minified.js @@ -1,3 +1,3 @@ //// [typeGuardsInFunctionAndModuleBlock.ts] -var m, m1, x, m2, x1, m21, m22; -m || (m = {}), m2 || (m2 = {}), "string" == typeof x || x.toString(), m1 || (m1 = {}), (m22 = m21 || (m21 = {})).m3 || (m22.m3 = {}), "string" == typeof x1 || x1.toString(); +var x, x1, m2; +"string" == typeof x || x.toString(), (m2 = {}).m3 || (m2.m3 = {}), "string" == typeof x1 || x1.toString(); diff --git a/crates/swc/tests/tsc-references/typeGuardsInModule.2.minified.js b/crates/swc/tests/tsc-references/typeGuardsInModule.2.minified.js index 2e05cb6e9329..b57cc89fe445 100644 --- a/crates/swc/tests/tsc-references/typeGuardsInModule.2.minified.js +++ b/crates/swc/tests/tsc-references/typeGuardsInModule.2.minified.js @@ -1,3 +1,3 @@ //// [typeGuardsInModule.ts] -var var1, m1, m2, m3, m11, var2, m21, var21, m31, m32, var4, m33, m4, var22; -m11 = m1 || (m1 = {}), "string" == typeof var1 && var1.length, "string" == typeof var2 && var2.length, m11.var3, m11.var3, m21 = m2 || (m2 = {}), m32 = m31 || (m31 = {}), "string" == typeof var1 && var1.length, "string" == typeof var21 && var21.length, "string" == typeof m21.var3 && m21.var3, "string" == typeof var4 && var4.length, m32.var5, m32.var5, m4 = (m33 = m3 || (m3 = {})).m4 || (m33.m4 = {}), "string" == typeof var1 && var1.length, "string" == typeof var22 && var22.length, m4.var3, m4.var3; +var var1, m1, var2, m2, var21, m3, var4, m31, m4, var22; +m1 = {}, "string" == typeof var1 && var1.length, "string" == typeof var2 && var2.length, m1.var3, m1.var3, m2 = {}, m3 = {}, "string" == typeof var1 && var1.length, "string" == typeof var21 && var21.length, "string" == typeof m2.var3 && m2.var3, "string" == typeof var4 && var4.length, m3.var5, m3.var5, m4 = (m31 = {}).m4 || (m31.m4 = {}), "string" == typeof var1 && var1.length, "string" == typeof var22 && var22.length, m4.var3, m4.var3; diff --git a/crates/swc/tests/tsc-references/typeOfThisInFunctionExpression.2.minified.js b/crates/swc/tests/tsc-references/typeOfThisInFunctionExpression.2.minified.js index 6fb3c7dd3ca3..bc39d618a9b9 100644 --- a/crates/swc/tests/tsc-references/typeOfThisInFunctionExpression.2.minified.js +++ b/crates/swc/tests/tsc-references/typeOfThisInFunctionExpression.2.minified.js @@ -1,4 +1,2 @@ //// [typeOfThisInFunctionExpression.ts] -var M; import "@swc/helpers/_/_class_call_check"; -M || (M = {}); diff --git a/crates/swc/tests/tsc-references/typeOnlyMerge3.2.minified.js b/crates/swc/tests/tsc-references/typeOnlyMerge3.2.minified.js index f0b10e19c5f0..f4cacba62ff0 100644 --- a/crates/swc/tests/tsc-references/typeOnlyMerge3.2.minified.js +++ b/crates/swc/tests/tsc-references/typeOnlyMerge3.2.minified.js @@ -2,7 +2,7 @@ export { }; //// [b.ts] var A; -(A || (A = {})).displayName = "A"; +(A = {}).displayName = "A"; export { A }; //// [c.ts] import { A } from "./b"; diff --git a/crates/swc/tests/tsc-references/typeofANonExportedType.2.minified.js b/crates/swc/tests/tsc-references/typeofANonExportedType.2.minified.js index 7ec1a792dc65..2120b59399f2 100644 --- a/crates/swc/tests/tsc-references/typeofANonExportedType.2.minified.js +++ b/crates/swc/tests/tsc-references/typeofANonExportedType.2.minified.js @@ -1,5 +1,5 @@ //// [typeofANonExportedType.ts] -var M, E, M1, E1, foo; +var M, E, foo; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; export var r1; export var r2; @@ -10,14 +10,14 @@ export var r4b; export var i; export var r5; export var r5; -(M1 = M || (M = {})).foo = '', M1.C = function C() { +(M = {}).foo = '', M.C = function C() { _class_call_check(this, C); }; export var r6; export var r7; export var r8; export var r9; -(E1 = E || (E = {}))[E1.A = 0] = "A"; +(E = {})[E.A = 0] = "A"; export var r10; export var r11; export var r12; diff --git a/crates/swc/tests/tsc-references/typeofModuleWithoutExports.2.minified.js b/crates/swc/tests/tsc-references/typeofModuleWithoutExports.2.minified.js index 8c2b0d51eeb9..172909efbcdb 100644 --- a/crates/swc/tests/tsc-references/typeofModuleWithoutExports.2.minified.js +++ b/crates/swc/tests/tsc-references/typeofModuleWithoutExports.2.minified.js @@ -1,4 +1,2 @@ //// [typeofModuleWithoutExports.ts] -var M; import "@swc/helpers/_/_class_call_check"; -M || (M = {}); diff --git a/crates/swc/tests/tsc-references/typeofOperatorWithAnyOtherType.2.minified.js b/crates/swc/tests/tsc-references/typeofOperatorWithAnyOtherType.2.minified.js index 2cd961a5418c..8640f5670ea7 100644 --- a/crates/swc/tests/tsc-references/typeofOperatorWithAnyOtherType.2.minified.js +++ b/crates/swc/tests/tsc-references/typeofOperatorWithAnyOtherType.2.minified.js @@ -15,6 +15,6 @@ var A = function() { } return A.foo = function() {}, A; }(); -M || (M = {}); +M = {}; var objA = new A(); void 0 === ANY1 || _type_of(ANY1), _type_of(ANY2), void 0 === A || _type_of(A), void 0 === M || _type_of(M), void 0 === obj || _type_of(obj), _type_of(obj1), _type_of(null), _type_of({}), _type_of(ANY2[0]), _type_of(objA.a), _type_of(obj1.x), _type_of(M.n), _type_of(foo()), _type_of(A.foo()), _type_of(ANY + ANY1), _type_of(NaN), _type_of(0), _type_of(NaN), _type_of(void 0 === ANY ? "undefined" : _type_of(ANY)), _type_of(_type_of(_type_of(ANY + ANY1))), void 0 === ANY || _type_of(ANY), void 0 === ANY1 || _type_of(ANY1), _type_of(ANY2[0]), void 0 === ANY || _type_of(ANY), _type_of(obj1), _type_of(obj1.x), _type_of(objA.a), _type_of(M.n), void 0 === ANY || _type_of(ANY), _type_of(ANY2), _type_of(foo), _type_of(objA.a), _type_of(A.foo), _type_of(M.n), _type_of(obj1.x); diff --git a/crates/swc/tests/tsc-references/typeofOperatorWithBooleanType.2.minified.js b/crates/swc/tests/tsc-references/typeofOperatorWithBooleanType.2.minified.js index db4343f0b94a..7e708edfc6c1 100644 --- a/crates/swc/tests/tsc-references/typeofOperatorWithBooleanType.2.minified.js +++ b/crates/swc/tests/tsc-references/typeofOperatorWithBooleanType.2.minified.js @@ -12,7 +12,7 @@ var BOOLEAN, M, A = function() { return !1; }, A; }(); -M || (M = {}); +M = {}; var objA = new A(); void 0 === BOOLEAN || _type_of(BOOLEAN), _type_of(!0), _type_of({ x: !0, diff --git a/crates/swc/tests/tsc-references/typeofOperatorWithEnumType.2.minified.js b/crates/swc/tests/tsc-references/typeofOperatorWithEnumType.2.minified.js index 78589c32c5a0..7d9809860950 100644 --- a/crates/swc/tests/tsc-references/typeofOperatorWithEnumType.2.minified.js +++ b/crates/swc/tests/tsc-references/typeofOperatorWithEnumType.2.minified.js @@ -1,4 +1,4 @@ //// [typeofOperatorWithEnumType.ts] -var ENUM, ENUM1, z, ENUM11; +var ENUM, ENUM1, ENUM11; import { _ as _type_of } from "@swc/helpers/_/_type_of"; -ENUM || (ENUM = {}), (ENUM11 = ENUM1 || (ENUM1 = {}))[ENUM11.A = 0] = "A", ENUM11[ENUM11.B = 1] = "B", ENUM11[ENUM11[""] = 2] = "", void 0 === ENUM || _type_of(ENUM), void 0 === ENUM1 || _type_of(ENUM1), _type_of(0), _type_of(ENUM[0] + 1), _type_of(void 0 === ENUM ? "undefined" : _type_of(ENUM)), _type_of(_type_of(_type_of(ENUM[0] + 1))), void 0 === ENUM || _type_of(ENUM), void 0 === ENUM1 || _type_of(ENUM1), _type_of(1), void 0 === ENUM || _type_of(ENUM), z || (z = {}), void 0 === ENUM || _type_of(ENUM), void 0 === ENUM1 || _type_of(ENUM1); +ENUM = {}, (ENUM11 = ENUM1 = {})[ENUM11.A = 0] = "A", ENUM11[ENUM11.B = 1] = "B", ENUM11[ENUM11[""] = 2] = "", void 0 === ENUM || _type_of(ENUM), void 0 === ENUM1 || _type_of(ENUM1), _type_of(0), _type_of(ENUM[0] + 1), _type_of(void 0 === ENUM ? "undefined" : _type_of(ENUM)), _type_of(_type_of(_type_of(ENUM[0] + 1))), void 0 === ENUM || _type_of(ENUM), void 0 === ENUM1 || _type_of(ENUM1), _type_of(1), void 0 === ENUM || _type_of(ENUM), void 0 === ENUM || _type_of(ENUM), void 0 === ENUM1 || _type_of(ENUM1); diff --git a/crates/swc/tests/tsc-references/typeofOperatorWithNumberType.2.minified.js b/crates/swc/tests/tsc-references/typeofOperatorWithNumberType.2.minified.js index 805b5af251c0..05e0b1e535df 100644 --- a/crates/swc/tests/tsc-references/typeofOperatorWithNumberType.2.minified.js +++ b/crates/swc/tests/tsc-references/typeofOperatorWithNumberType.2.minified.js @@ -16,7 +16,7 @@ var A = function() { return 1; }, A; }(); -M || (M = {}); +M = {}; var objA = new A(); void 0 === NUMBER || _type_of(NUMBER), _type_of(NUMBER1), _type_of(1), _type_of({ x: 1, diff --git a/crates/swc/tests/tsc-references/typeofOperatorWithStringType.2.minified.js b/crates/swc/tests/tsc-references/typeofOperatorWithStringType.2.minified.js index 88de2adc2560..f83ddf2519b5 100644 --- a/crates/swc/tests/tsc-references/typeofOperatorWithStringType.2.minified.js +++ b/crates/swc/tests/tsc-references/typeofOperatorWithStringType.2.minified.js @@ -16,7 +16,7 @@ var A = function() { return ""; }, A; }(); -M || (M = {}); +M = {}; var objA = new A(); void 0 === STRING || _type_of(STRING), _type_of(STRING1), _type_of(""), _type_of({ x: "", diff --git a/crates/swc/tests/tsc-references/typeofThis.2.minified.js b/crates/swc/tests/tsc-references/typeofThis.2.minified.js index c365f6faa278..c58f2ffabd05 100644 --- a/crates/swc/tests/tsc-references/typeofThis.2.minified.js +++ b/crates/swc/tests/tsc-references/typeofThis.2.minified.js @@ -1,5 +1,3 @@ //// [typeofThis.ts] -var Test6, Test7; import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _instanceof } from "@swc/helpers/_/_instanceof"; -(Test6 || (Test6 = {})).f = function() {}, (Test7 || (Test7 = {})).f = function() {}; diff --git a/crates/swc/tests/tsc-references/undefinedAssignableToEveryType.2.minified.js b/crates/swc/tests/tsc-references/undefinedAssignableToEveryType.2.minified.js index b7076fb6e30a..04affcdb40df 100644 --- a/crates/swc/tests/tsc-references/undefinedAssignableToEveryType.2.minified.js +++ b/crates/swc/tests/tsc-references/undefinedAssignableToEveryType.2.minified.js @@ -1,4 +1,4 @@ //// [undefinedAssignableToEveryType.ts] -var E, E1; +var E; import "@swc/helpers/_/_class_call_check"; -(E1 = E || (E = {}))[E1.A = 0] = "A"; +(E = {})[E.A = 0] = "A"; diff --git a/crates/swc/tests/tsc-references/undefinedIsSubtypeOfEverything.2.minified.js b/crates/swc/tests/tsc-references/undefinedIsSubtypeOfEverything.2.minified.js index 9a0f697d0987..782c9189d3e1 100644 --- a/crates/swc/tests/tsc-references/undefinedIsSubtypeOfEverything.2.minified.js +++ b/crates/swc/tests/tsc-references/undefinedIsSubtypeOfEverything.2.minified.js @@ -3,8 +3,8 @@ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _inherits } from "@swc/helpers/_/_inherits"; import { _ as _create_super } from "@swc/helpers/_/_create_super"; function f() {} -(E1 = E || (E = {}))[E1.A = 0] = "A", (f || (f = {})).bar = 1; -var E, E1, c = function c() { +(E = {})[E.A = 0] = "A", (f || (f = {})).bar = 1; +var E, c = function c() { _class_call_check(this, c); }; (c || (c = {})).bar = 1; diff --git a/crates/swc/tests/tsc-references/unionSubtypeIfEveryConstituentTypeIsSubtype.2.minified.js b/crates/swc/tests/tsc-references/unionSubtypeIfEveryConstituentTypeIsSubtype.2.minified.js index 7d9661d8d94b..6d4c657fe0ce 100644 --- a/crates/swc/tests/tsc-references/unionSubtypeIfEveryConstituentTypeIsSubtype.2.minified.js +++ b/crates/swc/tests/tsc-references/unionSubtypeIfEveryConstituentTypeIsSubtype.2.minified.js @@ -1,8 +1,8 @@ //// [unionSubtypeIfEveryConstituentTypeIsSubtype.ts] import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; function f() {} -(e = e1 || (e1 = {}))[e.e1 = 0] = "e1", e[e.e2 = 1] = "e2", (E2 = E21 || (E21 = {}))[E2.A = 0] = "A", (f || (f = {})).bar = 1; -var e, E2, e1, E21, c = function c() { +(e = {})[e.e1 = 0] = "e1", e[e.e2 = 1] = "e2", (E2 = {})[E2.A = 0] = "A", (f || (f = {})).bar = 1; +var e, E2, c = function c() { _class_call_check(this, c); }; (c || (c = {})).bar = 1; diff --git a/crates/swc/tests/tsc-references/unknownType2.2.minified.js b/crates/swc/tests/tsc-references/unknownType2.2.minified.js index fee503939e9e..192eea1354f7 100644 --- a/crates/swc/tests/tsc-references/unknownType2.2.minified.js +++ b/crates/swc/tests/tsc-references/unknownType2.2.minified.js @@ -1,3 +1,3 @@ //// [unknownType2.ts] -var NumberEnum, StringEnum, NumberEnum1, StringEnum1, u = void 0; -5 === u && u.toString(10), symb, aString, aBoolean, aNumber, anObject, anObjectLiteral, aUnion, anIntersection, aFunction, (NumberEnum = NumberEnum1 || (NumberEnum1 = {}))[NumberEnum.A = 0] = "A", NumberEnum[NumberEnum.B = 1] = "B", NumberEnum[NumberEnum.C = 2] = "C", (StringEnum = StringEnum1 || (StringEnum1 = {})).A = "A", StringEnum.B = "B", StringEnum.C = "C"; +var NumberEnum, StringEnum, u = void 0; +5 === u && u.toString(10), symb, aString, aBoolean, aNumber, anObject, anObjectLiteral, aUnion, anIntersection, aFunction, (NumberEnum = {})[NumberEnum.A = 0] = "A", NumberEnum[NumberEnum.B = 1] = "B", NumberEnum[NumberEnum.C = 2] = "C", (StringEnum = {}).A = "A", StringEnum.B = "B", StringEnum.C = "C"; diff --git a/crates/swc/tests/tsc-references/useObjectValuesAndEntries1.2.minified.js b/crates/swc/tests/tsc-references/useObjectValuesAndEntries1.2.minified.js index 6715793fd342..3a50f3171028 100644 --- a/crates/swc/tests/tsc-references/useObjectValuesAndEntries1.2.minified.js +++ b/crates/swc/tests/tsc-references/useObjectValuesAndEntries1.2.minified.js @@ -26,6 +26,6 @@ var a = [ "b", "c" ]; -Object.entries(a), Object.values(a), (E = E1 || (E1 = {}))[E.A = 0] = "A", E[E.B = 1] = "B", Object.entries(E1), Object.values(E1); +Object.entries(a), Object.values(a), (E = E1 = {})[E.A = 0] = "A", E[E.B = 1] = "B", Object.entries(E1), Object.values(E1); var i = {}; Object.entries(i), Object.values(i); diff --git a/crates/swc/tests/tsc-references/usingDeclarations.1(target=es2015).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarations.1(target=es2015).2.minified.js index 0935feef1992..e665790d2bac 100644 --- a/crates/swc/tests/tsc-references/usingDeclarations.1(target=es2015).2.minified.js +++ b/crates/swc/tests/tsc-references/usingDeclarations.1(target=es2015).2.minified.js @@ -4,7 +4,7 @@ import "@swc/helpers/_/_await_async_generator"; import "@swc/helpers/_/_wrap_async_generator"; import { _ as _using_ctx } from "@swc/helpers/_/_using_ctx"; try { - var N, _usingCtx = _using_ctx(); + var _usingCtx = _using_ctx(); _usingCtx.u({ [Symbol.dispose] () {} }), (()=>{ @@ -29,7 +29,7 @@ try { } finally{ _usingCtx.d(); } - }(N || (N = {})); + }(0); try { var _usingCtx1 = _using_ctx(); _usingCtx1.u({ diff --git a/crates/swc/tests/tsc-references/usingDeclarations.1(target=es2017).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarations.1(target=es2017).2.minified.js index 1a1a2e70b216..3dd7b78fe9a4 100644 --- a/crates/swc/tests/tsc-references/usingDeclarations.1(target=es2017).2.minified.js +++ b/crates/swc/tests/tsc-references/usingDeclarations.1(target=es2017).2.minified.js @@ -1,7 +1,7 @@ //// [usingDeclarations.1.ts] import { _ as _using_ctx } from "@swc/helpers/_/_using_ctx"; try { - var N, _usingCtx = _using_ctx(); + var _usingCtx = _using_ctx(); _usingCtx.u({ [Symbol.dispose] () {} }), (()=>{ @@ -26,7 +26,7 @@ try { } finally{ _usingCtx.d(); } - }(N || (N = {})); + }(0); try { var _usingCtx1 = _using_ctx(); _usingCtx1.u({ diff --git a/crates/swc/tests/tsc-references/usingDeclarations.1(target=es2022).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarations.1(target=es2022).2.minified.js index c757c3f676a5..a252a8cb4fc3 100644 --- a/crates/swc/tests/tsc-references/usingDeclarations.1(target=es2022).2.minified.js +++ b/crates/swc/tests/tsc-references/usingDeclarations.1(target=es2022).2.minified.js @@ -1,7 +1,7 @@ //// [usingDeclarations.1.ts] import { _ as _using_ctx } from "@swc/helpers/_/_using_ctx"; try { - var N, _usingCtx = _using_ctx(); + var _usingCtx = _using_ctx(); _usingCtx.u({ [Symbol.dispose] () {} }); @@ -126,7 +126,7 @@ try { } finally{ _usingCtx.d(); } - }(N || (N = {})); + }(0); try { var _usingCtx1 = _using_ctx(); _usingCtx1.u({ diff --git a/crates/swc/tests/tsc-references/usingDeclarations.1(target=es5).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarations.1(target=es5).2.minified.js index 445a366d3e2c..de10e1f5610b 100644 --- a/crates/swc/tests/tsc-references/usingDeclarations.1(target=es5).2.minified.js +++ b/crates/swc/tests/tsc-references/usingDeclarations.1(target=es5).2.minified.js @@ -11,7 +11,7 @@ import { _ as _create_super } from "@swc/helpers/_/_create_super"; import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator"; import { _ as _using_ctx } from "@swc/helpers/_/_using_ctx"; try { - var N, _usingCtx = _using_ctx(); + var _usingCtx = _using_ctx(); _usingCtx.u(_define_property({}, Symbol.dispose, function() {})), function() { try { var _usingCtx = _using_ctx(); @@ -30,7 +30,7 @@ try { } finally{ _usingCtx.d(); } - }(N || (N = {})); + }(0); try { var _usingCtx1 = _using_ctx(); _usingCtx1.u(_define_property({}, Symbol.dispose, function() {})); 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 index c757c3f676a5..a252a8cb4fc3 100644 --- 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 @@ -1,7 +1,7 @@ //// [usingDeclarations.1.ts] import { _ as _using_ctx } from "@swc/helpers/_/_using_ctx"; try { - var N, _usingCtx = _using_ctx(); + var _usingCtx = _using_ctx(); _usingCtx.u({ [Symbol.dispose] () {} }); @@ -126,7 +126,7 @@ try { } finally{ _usingCtx.d(); } - }(N || (N = {})); + }(0); try { var _usingCtx1 = _using_ctx(); _usingCtx1.u({ diff --git a/crates/swc/tests/tsc-references/validEnumAssignments.2.minified.js b/crates/swc/tests/tsc-references/validEnumAssignments.2.minified.js index 49e6e4d2b179..8afca471f322 100644 --- a/crates/swc/tests/tsc-references/validEnumAssignments.2.minified.js +++ b/crates/swc/tests/tsc-references/validEnumAssignments.2.minified.js @@ -1,3 +1,3 @@ //// [validEnumAssignments.ts] -var E, E1; -(E1 = E || (E = {}))[E1.A = 0] = "A", E1[E1.B = 1] = "B"; +var E; +(E = {})[E.A = 0] = "A", E[E.B = 1] = "B"; diff --git a/crates/swc/tests/tsc-references/validNullAssignments.2.minified.js b/crates/swc/tests/tsc-references/validNullAssignments.2.minified.js index ddd5334acc1c..17f0a7b03d49 100644 --- a/crates/swc/tests/tsc-references/validNullAssignments.2.minified.js +++ b/crates/swc/tests/tsc-references/validNullAssignments.2.minified.js @@ -1,4 +1,4 @@ //// [validNullAssignments.ts] -var E, M, E1; +var E, E1; import "@swc/helpers/_/_class_call_check"; -(E1 = E || (E = {}))[E1.A = 0] = "A", E.A = null, I = null, (M || (M = {})).x = 1; +(E1 = E = {})[E1.A = 0] = "A", E.A = null, I = null; diff --git a/crates/swc/tests/tsc-references/validNumberAssignments.2.minified.js b/crates/swc/tests/tsc-references/validNumberAssignments.2.minified.js index 42573de5501e..985459d0abcd 100644 --- a/crates/swc/tests/tsc-references/validNumberAssignments.2.minified.js +++ b/crates/swc/tests/tsc-references/validNumberAssignments.2.minified.js @@ -1,3 +1,3 @@ //// [validNumberAssignments.ts] -var E, E1; -(E1 = E || (E = {}))[E1.A = 0] = "A"; +var E; +(E = {})[E.A = 0] = "A"; diff --git a/crates/swc/tests/tsc-references/valuesMergingAcrossModules.2.minified.js b/crates/swc/tests/tsc-references/valuesMergingAcrossModules.2.minified.js index 9e635867dac5..28b6de091f29 100644 --- a/crates/swc/tests/tsc-references/valuesMergingAcrossModules.2.minified.js +++ b/crates/swc/tests/tsc-references/valuesMergingAcrossModules.2.minified.js @@ -5,5 +5,5 @@ export { A }; import "./a"; //// [c.ts] var A; -(A || (A = {})).displayName = "A", A(), A.displayName; +(A = {}).displayName = "A", A(), A.displayName; export { }; diff --git a/crates/swc/tests/tsc-references/verbatimModuleSyntaxInternalImportEquals.2.minified.js b/crates/swc/tests/tsc-references/verbatimModuleSyntaxInternalImportEquals.2.minified.js index 40fde832d6b9..0734c1e277d3 100644 --- a/crates/swc/tests/tsc-references/verbatimModuleSyntaxInternalImportEquals.2.minified.js +++ b/crates/swc/tests/tsc-references/verbatimModuleSyntaxInternalImportEquals.2.minified.js @@ -1,4 +1,4 @@ //// [verbatimModuleSyntaxInternalImportEquals.ts] var Foo; -NonExistent, (Foo || (Foo = {})).foo = 1, Foo.foo, Foo.T; +NonExistent, (Foo = {}).foo = 1, Foo.foo, Foo.T; export { }; diff --git a/crates/swc/tests/tsc-references/verbatimModuleSyntaxNoElisionCJS.2.minified.js b/crates/swc/tests/tsc-references/verbatimModuleSyntaxNoElisionCJS.2.minified.js index 30ffff01e7b5..557b12383ff2 100644 --- a/crates/swc/tests/tsc-references/verbatimModuleSyntaxNoElisionCJS.2.minified.js +++ b/crates/swc/tests/tsc-references/verbatimModuleSyntaxNoElisionCJS.2.minified.js @@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", { }), require("./a"); //// [/c.ts] var I; -(I || (I = {})).x = 1, module.exports = I; +(I = {}).x = 1, module.exports = I; //// [/d.ts] require("./c"), module.exports = J; //// [/e.d.ts] diff --git a/crates/swc/tests/tsc-references/verbatimModuleSyntaxRestrictionsCJS.2.minified.js b/crates/swc/tests/tsc-references/verbatimModuleSyntaxRestrictionsCJS.2.minified.js index 9577bbba4a26..68fb3dfa4384 100644 --- a/crates/swc/tests/tsc-references/verbatimModuleSyntaxRestrictionsCJS.2.minified.js +++ b/crates/swc/tests/tsc-references/verbatimModuleSyntaxRestrictionsCJS.2.minified.js @@ -30,14 +30,14 @@ Object.defineProperty(exports, "__esModule", { const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard"); require("./decl"), Promise.resolve().then(()=>_interop_require_wildcard._(require("./decl"))); const x = 1; -(Values || (Values = {})).x = 1; +(Values = {}).x = 1; //// [/main2.ts] module.exports = { x: 1 }; //// [/main3.ts] var ns; -(ns || (ns = {})).x = 1, module.exports = ns; +(ns = {}).x = 1, module.exports = ns; //// [/main4.ts] Object.defineProperty(exports, "__esModule", { value: !0 diff --git a/crates/swc/tests/tsc-references/voidOperatorWithAnyOtherType.2.minified.js b/crates/swc/tests/tsc-references/voidOperatorWithAnyOtherType.2.minified.js index 12bc3a6fc2f2..2144034780d4 100644 --- a/crates/swc/tests/tsc-references/voidOperatorWithAnyOtherType.2.minified.js +++ b/crates/swc/tests/tsc-references/voidOperatorWithAnyOtherType.2.minified.js @@ -6,6 +6,6 @@ var M, A = function() { } return A.foo = function() {}, A; }(); -M || (M = {}); +M = {}; var objA = new A(); objA.a, M.n, A.foo(), objA.a, M.n; diff --git a/crates/swc/tests/tsc-references/voidOperatorWithBooleanType.2.minified.js b/crates/swc/tests/tsc-references/voidOperatorWithBooleanType.2.minified.js index 33f8ac635780..31592243bf19 100644 --- a/crates/swc/tests/tsc-references/voidOperatorWithBooleanType.2.minified.js +++ b/crates/swc/tests/tsc-references/voidOperatorWithBooleanType.2.minified.js @@ -8,6 +8,6 @@ var M, A = function() { return !1; }, A; }(); -M || (M = {}); +M = {}; var objA = new A(); objA.a, M.n, A.foo(), objA.a, M.n; diff --git a/crates/swc/tests/tsc-references/voidOperatorWithEnumType.2.minified.js b/crates/swc/tests/tsc-references/voidOperatorWithEnumType.2.minified.js index 1b2a7a18bc80..86855a256791 100644 --- a/crates/swc/tests/tsc-references/voidOperatorWithEnumType.2.minified.js +++ b/crates/swc/tests/tsc-references/voidOperatorWithEnumType.2.minified.js @@ -1,3 +1,3 @@ //// [voidOperatorWithEnumType.ts] -var ENUM, ENUM1, ENUM11; -ENUM || (ENUM = {}), (ENUM11 = ENUM1 || (ENUM1 = {}))[ENUM11.A = 0] = "A", ENUM11[ENUM11.B = 1] = "B", ENUM11[ENUM11[""] = 2] = "", ENUM[0], ENUM[0]; +var ENUM, ENUM1; +ENUM = {}, (ENUM1 = {})[ENUM1.A = 0] = "A", ENUM1[ENUM1.B = 1] = "B", ENUM1[ENUM1[""] = 2] = "", ENUM[0], ENUM[0]; diff --git a/crates/swc/tests/tsc-references/voidOperatorWithNumberType.2.minified.js b/crates/swc/tests/tsc-references/voidOperatorWithNumberType.2.minified.js index d0749da266b9..cba77af5df93 100644 --- a/crates/swc/tests/tsc-references/voidOperatorWithNumberType.2.minified.js +++ b/crates/swc/tests/tsc-references/voidOperatorWithNumberType.2.minified.js @@ -8,6 +8,6 @@ var M, A = function() { return 1; }, A; }(); -M || (M = {}); +M = {}; var objA = new A(); objA.a, M.n, A.foo(), objA.a, M.n, objA.a, M.n; diff --git a/crates/swc/tests/tsc-references/voidOperatorWithStringType.2.minified.js b/crates/swc/tests/tsc-references/voidOperatorWithStringType.2.minified.js index 8b924ca335e7..0907ebc10053 100644 --- a/crates/swc/tests/tsc-references/voidOperatorWithStringType.2.minified.js +++ b/crates/swc/tests/tsc-references/voidOperatorWithStringType.2.minified.js @@ -8,6 +8,6 @@ var STRING, M, A = function() { return ""; }, A; }(); -M || (M = {}); +M = {}; var objA = new A(); objA.a, M.n, A.foo(), STRING.charAt(0), objA.a, M.n; diff --git a/crates/swc/tests/tsc-references/witness.2.minified.js b/crates/swc/tests/tsc-references/witness.2.minified.js index 8edb5393c970..7b1bb90865fb 100644 --- a/crates/swc/tests/tsc-references/witness.2.minified.js +++ b/crates/swc/tests/tsc-references/witness.2.minified.js @@ -9,10 +9,10 @@ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; }(), function fn5() { return new (void 0)(fn5); }(); -var propAcc1, M2, M21, propAcc1 = { +var propAcc1, M2, propAcc1 = { m: propAcc1.m }; -(M21 = M2 || (M2 = {})).x = M21.x, M21.x, new function C2() { +(M2 = {}).x = M2.x, M2.x, new function C2() { _class_call_check(this, C2), this.n = this.n; }().n; var C3 = function C3() { diff --git a/crates/swc_ecma_minifier/tests/benches-full/jquery.js b/crates/swc_ecma_minifier/tests/benches-full/jquery.js index 9030d0ce0dda..d37b06d5fd2c 100644 --- a/crates/swc_ecma_minifier/tests/benches-full/jquery.js +++ b/crates/swc_ecma_minifier/tests/benches-full/jquery.js @@ -2562,7 +2562,7 @@ } function ajaxExtend(target, src) { var key, deep, flatOptions = jQuery.ajaxSettings.flatOptions || {}; - for(key in src)void 0 !== src[key] && ((flatOptions[key] ? target : deep || (deep = {}))[key] = src[key]); + for(key in src)void 0 !== src[key] && ((flatOptions[key] ? target : deep = {})[key] = src[key]); return deep && jQuery.extend(!0, target, deep), target; } originAnchor.href = location.href, jQuery.extend({ diff --git a/crates/swc_ecma_minifier/tests/benches-full/lodash.js b/crates/swc_ecma_minifier/tests/benches-full/lodash.js index 6d3b60706526..cf70f355e290 100644 --- a/crates/swc_ecma_minifier/tests/benches-full/lodash.js +++ b/crates/swc_ecma_minifier/tests/benches-full/lodash.js @@ -1287,7 +1287,7 @@ } function copyObject(source, props, object, customizer) { var isNew = !object; - object || (object = {}); + object = {}; for(var index = -1, length = props.length; ++index < length;){ var key = props[index], newValue = customizer ? customizer(object[key], source[key], key, object, source) : undefined; undefined === newValue && (newValue = source[key]), isNew ? baseAssignValue(object, key, newValue) : assignValue(object, key, newValue); diff --git a/crates/swc_ecma_minifier/tests/benches-full/terser.js b/crates/swc_ecma_minifier/tests/benches-full/terser.js index a733570dff7c..c372b8298801 100644 --- a/crates/swc_ecma_minifier/tests/benches-full/terser.js +++ b/crates/swc_ecma_minifier/tests/benches-full/terser.js @@ -86,7 +86,7 @@ return MAP; }(); function make_node(ctor, orig, props) { - return props || (props = {}), orig && (props.start || (props.start = orig.start), props.end || (props.end = orig.end)), new ctor(props); + return props = {}, orig && (props.start || (props.start = orig.start), props.end || (props.end = orig.end)), new ctor(props); } function push_uniq(array, el) { array.includes(el) || array.push(el); @@ -5031,7 +5031,7 @@ return !this.fixed || this.fixed instanceof AST_Node ? this.fixed : this.fixed(); } unmangleable(options) { - return options || (options = {}), !!(function_defs && function_defs.has(this.id) && keep_name(options.keep_fnames, this.orig[0].name)) || this.global && !options.toplevel || 1 & this.export || this.undeclared || !options.eval && this.scope.pinned() || (this.orig[0] instanceof AST_SymbolLambda || this.orig[0] instanceof AST_SymbolDefun) && keep_name(options.keep_fnames, this.orig[0].name) || this.orig[0] instanceof AST_SymbolMethod || (this.orig[0] instanceof AST_SymbolClass || this.orig[0] instanceof AST_SymbolDefClass) && keep_name(options.keep_classnames, this.orig[0].name); + return options = {}, !!(function_defs && function_defs.has(this.id) && keep_name(options.keep_fnames, this.orig[0].name)) || this.global && !options.toplevel || 1 & this.export || this.undeclared || !options.eval && this.scope.pinned() || (this.orig[0] instanceof AST_SymbolLambda || this.orig[0] instanceof AST_SymbolDefun) && keep_name(options.keep_fnames, this.orig[0].name) || this.orig[0] instanceof AST_SymbolMethod || (this.orig[0] instanceof AST_SymbolClass || this.orig[0] instanceof AST_SymbolDefClass) && keep_name(options.keep_classnames, this.orig[0].name); } mangle(options) { const cache = options.cache && options.cache.props; diff --git a/crates/swc_ecma_minifier/tests/benches-full/victory.js b/crates/swc_ecma_minifier/tests/benches-full/victory.js index 46ea0fdd912f..604359246992 100644 --- a/crates/swc_ecma_minifier/tests/benches-full/victory.js +++ b/crates/swc_ecma_minifier/tests/benches-full/victory.js @@ -7445,7 +7445,7 @@ var assignValue = __webpack_require__("../../../node_modules/lodash/_assignValue.js"), baseAssignValue = __webpack_require__("../../../node_modules/lodash/_baseAssignValue.js"); module1.exports = function(source, props, object, customizer) { var isNew = !object; - object || (object = {}); + object = {}; for(var index = -1, length = props.length; ++index < length;){ var key = props[index], newValue = customizer ? customizer(object[key], source[key], key, object, source) : void 0; void 0 === newValue && (newValue = source[key]), isNew ? baseAssignValue(object, key, newValue) : assignValue(object, key, newValue); diff --git a/crates/swc_ecma_minifier/tests/benches-full/vue.js b/crates/swc_ecma_minifier/tests/benches-full/vue.js index eef7427c2866..37b3541e963a 100644 --- a/crates/swc_ecma_minifier/tests/benches-full/vue.js +++ b/crates/swc_ecma_minifier/tests/benches-full/vue.js @@ -1304,7 +1304,7 @@ Ctor.superOptions = superOptions; var modifiedOptions = function(Ctor) { var modified, latest = Ctor.options, sealed = Ctor.sealedOptions; - for(var key in latest)latest[key] !== sealed[key] && (modified || (modified = {}), modified[key] = latest[key]); + for(var key in latest)latest[key] !== sealed[key] && ((modified = {})[key] = latest[key]); return modified; }(Ctor); modifiedOptions && extend(Ctor.extendOptions, modifiedOptions), (options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions)).name && (options.components[options.name] = Ctor); diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/6628/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/6628/output.js index 5d12f36e0bb6..1ccc4f492b48 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/6628/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/issues/6628/output.js @@ -5,7 +5,7 @@ }(); !function(n) { n[n.Var = 0] = "Var", n[n.All = 1] = "All"; - }(CallbackType || (CallbackType = {})); + }(CallbackType = {}); var CepRule = function() { eval(); }(); diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/firebase-core/1/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/firebase-core/1/output.js index ac575db3c6e3..58407baf6f45 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/firebase-core/1/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/issues/firebase-core/1/output.js @@ -2321,7 +2321,7 @@ } }); const instances = []; - (LogLevel1 = LogLevel || (LogLevel = {}))[LogLevel1.DEBUG = 0] = "DEBUG", LogLevel1[LogLevel1.VERBOSE = 1] = "VERBOSE", LogLevel1[LogLevel1.INFO = 2] = "INFO", LogLevel1[LogLevel1.WARN = 3] = "WARN", LogLevel1[LogLevel1.ERROR = 4] = "ERROR", LogLevel1[LogLevel1.SILENT = 5] = "SILENT"; + (LogLevel1 = LogLevel = {})[LogLevel1.DEBUG = 0] = "DEBUG", LogLevel1[LogLevel1.VERBOSE = 1] = "VERBOSE", LogLevel1[LogLevel1.INFO = 2] = "INFO", LogLevel1[LogLevel1.WARN = 3] = "WARN", LogLevel1[LogLevel1.ERROR = 4] = "ERROR", LogLevel1[LogLevel1.SILENT = 5] = "SILENT"; const levelStringToEnum = { debug: LogLevel.DEBUG, verbose: LogLevel.VERBOSE, diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/firebase-firestore/1/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/firebase-firestore/1/output.js index 56375505c2bc..ad648bdf57f0 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/firebase-firestore/1/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/issues/firebase-firestore/1/output.js @@ -1273,7 +1273,7 @@ return L(); } } - (ln = hn || (hn = {}))[ln.OK = 0] = "OK", ln[ln.CANCELLED = 1] = "CANCELLED", ln[ln.UNKNOWN = 2] = "UNKNOWN", ln[ln.INVALID_ARGUMENT = 3] = "INVALID_ARGUMENT", ln[ln.DEADLINE_EXCEEDED = 4] = "DEADLINE_EXCEEDED", ln[ln.NOT_FOUND = 5] = "NOT_FOUND", ln[ln.ALREADY_EXISTS = 6] = "ALREADY_EXISTS", ln[ln.PERMISSION_DENIED = 7] = "PERMISSION_DENIED", ln[ln.UNAUTHENTICATED = 16] = "UNAUTHENTICATED", ln[ln.RESOURCE_EXHAUSTED = 8] = "RESOURCE_EXHAUSTED", ln[ln.FAILED_PRECONDITION = 9] = "FAILED_PRECONDITION", ln[ln.ABORTED = 10] = "ABORTED", ln[ln.OUT_OF_RANGE = 11] = "OUT_OF_RANGE", ln[ln.UNIMPLEMENTED = 12] = "UNIMPLEMENTED", ln[ln.INTERNAL = 13] = "INTERNAL", ln[ln.UNAVAILABLE = 14] = "UNAVAILABLE", ln[ln.DATA_LOSS = 15] = "DATA_LOSS"; + (ln = hn = {})[ln.OK = 0] = "OK", ln[ln.CANCELLED = 1] = "CANCELLED", ln[ln.UNKNOWN = 2] = "UNKNOWN", ln[ln.INVALID_ARGUMENT = 3] = "INVALID_ARGUMENT", ln[ln.DEADLINE_EXCEEDED = 4] = "DEADLINE_EXCEEDED", ln[ln.NOT_FOUND = 5] = "NOT_FOUND", ln[ln.ALREADY_EXISTS = 6] = "ALREADY_EXISTS", ln[ln.PERMISSION_DENIED = 7] = "PERMISSION_DENIED", ln[ln.UNAUTHENTICATED = 16] = "UNAUTHENTICATED", ln[ln.RESOURCE_EXHAUSTED = 8] = "RESOURCE_EXHAUSTED", ln[ln.FAILED_PRECONDITION = 9] = "FAILED_PRECONDITION", ln[ln.ABORTED = 10] = "ABORTED", ln[ln.OUT_OF_RANGE = 11] = "OUT_OF_RANGE", ln[ln.UNIMPLEMENTED = 12] = "UNIMPLEMENTED", ln[ln.INTERNAL = 13] = "INTERNAL", ln[ln.UNAVAILABLE = 14] = "UNAVAILABLE", ln[ln.DATA_LOSS = 15] = "DATA_LOSS"; class wn { constructor(t, e){ this.comparator = t, this.root = e || mn.EMPTY; diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/quagga2/1.4.2/1/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/quagga2/1.4.2/1/output.js index e4c0fcf46497..f61eaa5f7575 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/quagga2/1.4.2/1/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/issues/quagga2/1.4.2/1/output.js @@ -2083,7 +2083,7 @@ var assignValue = __webpack_require__(55), baseAssignValue = __webpack_require__(37); module1.exports = function(source, props, object, customizer) { var isNew = !object; - object || (object = {}); + object = {}; for(var index = -1, length = props.length; ++index < length;){ var key = props[index], newValue = customizer ? customizer(object[key], source[key], key, object, source) : void 0; void 0 === newValue && (newValue = source[key]), isNew ? baseAssignValue(object, key, newValue) : assignValue(object, key, newValue); @@ -3252,7 +3252,7 @@ } }; var image_debug = __webpack_require__(9), classCallCheck = __webpack_require__(3), classCallCheck_default = __webpack_require__.n(classCallCheck), createClass = __webpack_require__(4), createClass_default = __webpack_require__.n(createClass), assertThisInitialized = __webpack_require__(1), assertThisInitialized_default = __webpack_require__.n(assertThisInitialized), inherits = __webpack_require__(6), inherits_default = __webpack_require__.n(inherits), possibleConstructorReturn = __webpack_require__(5), possibleConstructorReturn_default = __webpack_require__.n(possibleConstructorReturn), getPrototypeOf = __webpack_require__(2), getPrototypeOf_default = __webpack_require__.n(getPrototypeOf), defineProperty = __webpack_require__(0), defineProperty_default = __webpack_require__.n(defineProperty), array_helper = __webpack_require__(10); - (BarcodeDirection = BarcodeDirection1 || (BarcodeDirection1 = {}))[BarcodeDirection.Forward = 1] = "Forward", BarcodeDirection[BarcodeDirection.Reverse = -1] = "Reverse"; + (BarcodeDirection = BarcodeDirection1 = {})[BarcodeDirection.Forward = 1] = "Forward", BarcodeDirection[BarcodeDirection.Reverse = -1] = "Reverse"; var barcode_reader = function() { function BarcodeReader(config, supplements) { return classCallCheck_default()(this, BarcodeReader), defineProperty_default()(this, "_row", []), defineProperty_default()(this, "config", {}), defineProperty_default()(this, "supplements", []), defineProperty_default()(this, "SINGLE_CODE_ERROR", 0), defineProperty_default()(this, "FORMAT", "unknown"), defineProperty_default()(this, "CONFIG_KEYS", {}), this._row = [], this.config = config || {}, supplements && (this.supplements = supplements), this; diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/ts-enum/basic/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/ts-enum/basic/output.js new file mode 100644 index 000000000000..e95917cbcebc --- /dev/null +++ b/crates/swc_ecma_minifier/tests/fixture/issues/ts-enum/basic/output.js @@ -0,0 +1,3 @@ +var Foo, Foo1; +(Foo1 = Foo = {})[Foo1.a = 1] = "a", Foo1[Foo1.b = 2] = "b"; +export { Foo }; diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/ts-enum/unused/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/ts-enum/unused/output.js new file mode 100644 index 000000000000..9a3dd1641389 --- /dev/null +++ b/crates/swc_ecma_minifier/tests/fixture/issues/ts-enum/unused/output.js @@ -0,0 +1,2 @@ +var Foo; +(Foo = {})[Foo.a = 1] = "a", Foo[Foo.b = 2] = "b"; diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/typescript/1/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/typescript/1/output.js index 225688a1f604..cfe3011b105d 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/typescript/1/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/issues/typescript/1/output.js @@ -1,6 +1,6 @@ -var ts, ts1, dynamicImportUMDHelper; -(ts1 = ts || (ts = {})).transformModule = function(context) { - var currentSourceFile, currentModuleInfo, needUMDDynamicImportHelper, factory = context.factory, emitHelpers = context.getEmitHelperFactory, startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration, compilerOptions = context.getCompilerOptions(), resolver = context.getEmitResolver(), host = context.getEmitHost(), languageVersion = ts1.getEmitScriptTarget(compilerOptions), moduleKind = ts1.getEmitModuleKind(compilerOptions), previousOnSubstituteNode = context.onSubstituteNode, previousOnEmitNode = context.onEmitNode; +var ts, dynamicImportUMDHelper; +(ts = {}).transformModule = function(context) { + var currentSourceFile, currentModuleInfo, needUMDDynamicImportHelper, factory = context.factory, emitHelpers = context.getEmitHelperFactory, startLexicalEnvironment = context.startLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration, compilerOptions = context.getCompilerOptions(), resolver = context.getEmitResolver(), host = context.getEmitHost(), languageVersion = ts.getEmitScriptTarget(compilerOptions), moduleKind = ts.getEmitModuleKind(compilerOptions), previousOnSubstituteNode = context.onSubstituteNode, previousOnEmitNode = context.onEmitNode; context.onSubstituteNode = function(hint, node) { return (node = previousOnSubstituteNode(hint, node)).id && noSubstitution[node.id] ? node : 1 === hint ? function(node) { switch(node.kind){ @@ -8,28 +8,28 @@ var ts, ts1, dynamicImportUMDHelper; return substituteExpressionIdentifier(node); case 207: return function(node) { - if (ts1.isIdentifier(node.expression)) { + if (ts.isIdentifier(node.expression)) { var expression = substituteExpressionIdentifier(node.expression); - if (noSubstitution[ts1.getNodeId(expression)] = !0, !ts1.isIdentifier(expression) && !(4096 & ts1.getEmitFlags(node.expression))) return ts1.addEmitFlags(factory.updateCallExpression(node, expression, void 0, node.arguments), 536870912); + if (noSubstitution[ts.getNodeId(expression)] = !0, !ts.isIdentifier(expression) && !(4096 & ts.getEmitFlags(node.expression))) return ts.addEmitFlags(factory.updateCallExpression(node, expression, void 0, node.arguments), 536870912); } return node; }(node); case 209: return function(node) { - if (ts1.isIdentifier(node.tag)) { + if (ts.isIdentifier(node.tag)) { var tag = substituteExpressionIdentifier(node.tag); - if (noSubstitution[ts1.getNodeId(tag)] = !0, !ts1.isIdentifier(tag) && !(4096 & ts1.getEmitFlags(node.tag))) return ts1.addEmitFlags(factory.updateTaggedTemplateExpression(node, tag, void 0, node.template), 536870912); + if (noSubstitution[ts.getNodeId(tag)] = !0, !ts.isIdentifier(tag) && !(4096 & ts.getEmitFlags(node.tag))) return ts.addEmitFlags(factory.updateTaggedTemplateExpression(node, tag, void 0, node.template), 536870912); } return node; }(node); case 220: return function(node) { - if (ts1.isAssignmentOperator(node.operatorToken.kind) && ts1.isIdentifier(node.left) && !ts1.isGeneratedIdentifier(node.left) && !ts1.isLocalName(node.left) && !ts1.isDeclarationNameOfEnumOrNamespace(node.left)) { + if (ts.isAssignmentOperator(node.operatorToken.kind) && ts.isIdentifier(node.left) && !ts.isGeneratedIdentifier(node.left) && !ts.isLocalName(node.left) && !ts.isDeclarationNameOfEnumOrNamespace(node.left)) { var exportedNames = getExports(node.left); if (exportedNames) { for(var expression = node, _i = 0; _i < exportedNames.length; _i++){ var exportName = exportedNames[_i]; - noSubstitution[ts1.getNodeId(expression)] = !0, expression = createExportExpression(exportName, expression, node); + noSubstitution[ts.getNodeId(expression)] = !0, expression = createExportExpression(exportName, expression, node); } return expression; } @@ -38,29 +38,29 @@ var ts, ts1, dynamicImportUMDHelper; }(node); } return node; - }(node) : ts1.isShorthandPropertyAssignment(node) ? function(node) { + }(node) : ts.isShorthandPropertyAssignment(node) ? function(node) { var name = node.name, exportedOrImportedName = substituteExpressionIdentifier(name); if (exportedOrImportedName !== name) { if (node.objectAssignmentInitializer) { var initializer = factory.createAssignment(exportedOrImportedName, node.objectAssignmentInitializer); - return ts1.setTextRange(factory.createPropertyAssignment(name, initializer), node); + return ts.setTextRange(factory.createPropertyAssignment(name, initializer), node); } - return ts1.setTextRange(factory.createPropertyAssignment(name, exportedOrImportedName), node); + return ts.setTextRange(factory.createPropertyAssignment(name, exportedOrImportedName), node); } return node; }(node) : node; }, context.onEmitNode = function(hint, node, emitCallback) { - 303 === node.kind ? (currentSourceFile = node, currentModuleInfo = moduleInfoMap[ts1.getOriginalNodeId(currentSourceFile)], previousOnEmitNode(hint, node, emitCallback), currentSourceFile = void 0, currentModuleInfo = void 0) : previousOnEmitNode(hint, node, emitCallback); + 303 === node.kind ? (currentSourceFile = node, currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(currentSourceFile)], previousOnEmitNode(hint, node, emitCallback), currentSourceFile = void 0, currentModuleInfo = void 0) : previousOnEmitNode(hint, node, emitCallback); }, context.enableSubstitution(207), context.enableSubstitution(209), context.enableSubstitution(79), context.enableSubstitution(220), context.enableSubstitution(295), context.enableEmitNotification(303); var moduleInfoMap = [], deferredExports = [], noSubstitution = []; - return ts1.chainBundle(context, function(node) { - if (node.isDeclarationFile || !(ts1.isEffectiveExternalModule(node, compilerOptions) || 4194304 & node.transformFlags || ts1.isJsonSourceFile(node) && ts1.hasJsonModuleEmitEnabled(compilerOptions) && ts1.outFile(compilerOptions))) return node; - currentSourceFile = node, currentModuleInfo = ts1.collectExternalModuleInfo(context, node, resolver, compilerOptions), moduleInfoMap[ts1.getOriginalNodeId(node)] = currentModuleInfo; + return ts.chainBundle(context, function(node) { + if (node.isDeclarationFile || !(ts.isEffectiveExternalModule(node, compilerOptions) || 4194304 & node.transformFlags || ts.isJsonSourceFile(node) && ts.hasJsonModuleEmitEnabled(compilerOptions) && ts.outFile(compilerOptions))) return node; + currentSourceFile = node, currentModuleInfo = ts.collectExternalModuleInfo(context, node, resolver, compilerOptions), moduleInfoMap[ts.getOriginalNodeId(node)] = currentModuleInfo; var updated = (function(moduleKind) { switch(moduleKind){ - case ts1.ModuleKind.AMD: + case ts.ModuleKind.AMD: return transformAMDModule; - case ts1.ModuleKind.UMD: + case ts.ModuleKind.UMD: return transformUMDModule; default: return transformCommonJSModule; @@ -69,24 +69,24 @@ var ts, ts1, dynamicImportUMDHelper; return currentSourceFile = void 0, currentModuleInfo = void 0, needUMDDynamicImportHelper = !1, updated; }); function shouldEmitUnderscoreUnderscoreESModule() { - return !!(!currentModuleInfo.exportEquals && ts1.isExternalModule(currentSourceFile)); + return !!(!currentModuleInfo.exportEquals && ts.isExternalModule(currentSourceFile)); } function transformCommonJSModule(node) { startLexicalEnvironment(); - var statements = [], ensureUseStrict = ts1.getStrictOptionValue(compilerOptions, "alwaysStrict") || !compilerOptions.noImplicitUseStrict && ts1.isExternalModule(currentSourceFile), statementOffset = factory.copyPrologue(node.statements, statements, ensureUseStrict && !ts1.isJsonSourceFile(node), topLevelVisitor); - if (shouldEmitUnderscoreUnderscoreESModule() && ts1.append(statements, createUnderscoreUnderscoreESModule()), ts1.length(currentModuleInfo.exportedNames)) for(var i = 0; i < currentModuleInfo.exportedNames.length; i += 50)ts1.append(statements, factory.createExpressionStatement(ts1.reduceLeft(currentModuleInfo.exportedNames.slice(i, i + 50), function(prev, nextId) { - return factory.createAssignment(factory.createPropertyAccessExpression(factory.createIdentifier("exports"), factory.createIdentifier(ts1.idText(nextId))), prev); + var statements = [], ensureUseStrict = ts.getStrictOptionValue(compilerOptions, "alwaysStrict") || !compilerOptions.noImplicitUseStrict && ts.isExternalModule(currentSourceFile), statementOffset = factory.copyPrologue(node.statements, statements, ensureUseStrict && !ts.isJsonSourceFile(node), topLevelVisitor); + if (shouldEmitUnderscoreUnderscoreESModule() && ts.append(statements, createUnderscoreUnderscoreESModule()), ts.length(currentModuleInfo.exportedNames)) for(var i = 0; i < currentModuleInfo.exportedNames.length; i += 50)ts.append(statements, factory.createExpressionStatement(ts.reduceLeft(currentModuleInfo.exportedNames.slice(i, i + 50), function(prev, nextId) { + return factory.createAssignment(factory.createPropertyAccessExpression(factory.createIdentifier("exports"), factory.createIdentifier(ts.idText(nextId))), prev); }, factory.createVoidZero()))); - ts1.append(statements, ts1.visitNode(currentModuleInfo.externalHelpersImportDeclaration, topLevelVisitor, ts1.isStatement)), ts1.addRange(statements, ts1.visitNodes(node.statements, topLevelVisitor, ts1.isStatement, statementOffset)), addExportEqualsIfNeeded(statements, !1), ts1.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment()); - var updated = factory.updateSourceFile(node, ts1.setTextRange(factory.createNodeArray(statements), node.statements)); - return ts1.addEmitHelpers(updated, context.readEmitHelpers()), updated; + ts.append(statements, ts.visitNode(currentModuleInfo.externalHelpersImportDeclaration, topLevelVisitor, ts.isStatement)), ts.addRange(statements, ts.visitNodes(node.statements, topLevelVisitor, ts.isStatement, statementOffset)), addExportEqualsIfNeeded(statements, !1), ts.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment()); + var updated = factory.updateSourceFile(node, ts.setTextRange(factory.createNodeArray(statements), node.statements)); + return ts.addEmitHelpers(updated, context.readEmitHelpers()), updated; } function transformAMDModule(node) { - var define = factory.createIdentifier("define"), moduleName = ts1.tryGetModuleNameFromFile(factory, node, host, compilerOptions), jsonSourceFile = ts1.isJsonSourceFile(node) && node, _a = collectAsynchronousDependencies(node, !0), aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames, importAliasNames = _a.importAliasNames, updated = factory.updateSourceFile(node, ts1.setTextRange(factory.createNodeArray([ + var define = factory.createIdentifier("define"), moduleName = ts.tryGetModuleNameFromFile(factory, node, host, compilerOptions), jsonSourceFile = ts.isJsonSourceFile(node) && node, _a = collectAsynchronousDependencies(node, !0), aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames, importAliasNames = _a.importAliasNames, updated = factory.updateSourceFile(node, ts.setTextRange(factory.createNodeArray([ factory.createExpressionStatement(factory.createCallExpression(define, void 0, __spreadArray(__spreadArray([], moduleName ? [ moduleName ] : [], !0), [ - factory.createArrayLiteralExpression(jsonSourceFile ? ts1.emptyArray : __spreadArray(__spreadArray([ + factory.createArrayLiteralExpression(jsonSourceFile ? ts.emptyArray : __spreadArray(__spreadArray([ factory.createStringLiteral("require"), factory.createStringLiteral("exports") ], aliasedModuleNames, !0), unaliasedModuleNames, !0)), @@ -96,12 +96,12 @@ var ts, ts1, dynamicImportUMDHelper; ], importAliasNames, !0), void 0, transformAsynchronousModuleBody(node)) ], !1))) ]), node.statements)); - return ts1.addEmitHelpers(updated, context.readEmitHelpers()), updated; + return ts.addEmitHelpers(updated, context.readEmitHelpers()), updated; } function transformUMDModule(node) { - var _a = collectAsynchronousDependencies(node, !1), aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames, importAliasNames = _a.importAliasNames, moduleName = ts1.tryGetModuleNameFromFile(factory, node, host, compilerOptions), umdHeader = factory.createFunctionExpression(void 0, void 0, void 0, void 0, [ + var _a = collectAsynchronousDependencies(node, !1), aliasedModuleNames = _a.aliasedModuleNames, unaliasedModuleNames = _a.unaliasedModuleNames, importAliasNames = _a.importAliasNames, moduleName = ts.tryGetModuleNameFromFile(factory, node, host, compilerOptions), umdHeader = factory.createFunctionExpression(void 0, void 0, void 0, void 0, [ factory.createParameterDeclaration(void 0, void 0, void 0, "factory") - ], void 0, ts1.setTextRange(factory.createBlock([ + ], void 0, ts.setTextRange(factory.createBlock([ factory.createIfStatement(factory.createLogicalAnd(factory.createTypeCheck(factory.createIdentifier("module"), "object"), factory.createTypeCheck(factory.createPropertyAccessExpression(factory.createIdentifier("module"), "exports"), "object")), factory.createBlock([ factory.createVariableStatement(void 0, [ factory.createVariableDeclaration("v", void 0, void 0, factory.createCallExpression(factory.createIdentifier("factory"), void 0, [ @@ -109,7 +109,7 @@ var ts, ts1, dynamicImportUMDHelper; factory.createIdentifier("exports") ])) ]), - ts1.setEmitFlags(factory.createIfStatement(factory.createStrictInequality(factory.createIdentifier("v"), factory.createIdentifier("undefined")), factory.createExpressionStatement(factory.createAssignment(factory.createPropertyAccessExpression(factory.createIdentifier("module"), "exports"), factory.createIdentifier("v")))), 1) + ts.setEmitFlags(factory.createIfStatement(factory.createStrictInequality(factory.createIdentifier("v"), factory.createIdentifier("undefined")), factory.createExpressionStatement(factory.createAssignment(factory.createPropertyAccessExpression(factory.createIdentifier("module"), "exports"), factory.createIdentifier("v")))), 1) ]), factory.createIfStatement(factory.createLogicalAnd(factory.createTypeCheck(factory.createIdentifier("define"), "function"), factory.createPropertyAccessExpression(factory.createIdentifier("define"), "amd")), factory.createBlock([ factory.createExpressionStatement(factory.createCallExpression(factory.createIdentifier("define"), void 0, __spreadArray(__spreadArray([], moduleName ? [ moduleName @@ -121,7 +121,7 @@ var ts, ts1, dynamicImportUMDHelper; factory.createIdentifier("factory") ], !1))) ]))) - ], !0), void 0)), updated = factory.updateSourceFile(node, ts1.setTextRange(factory.createNodeArray([ + ], !0), void 0)), updated = factory.updateSourceFile(node, ts.setTextRange(factory.createNodeArray([ factory.createExpressionStatement(factory.createCallExpression(umdHeader, void 0, [ factory.createFunctionExpression(void 0, void 0, void 0, void 0, __spreadArray([ factory.createParameterDeclaration(void 0, void 0, void 0, "require"), @@ -129,7 +129,7 @@ var ts, ts1, dynamicImportUMDHelper; ], importAliasNames, !0), void 0, transformAsynchronousModuleBody(node)) ])) ]), node.statements)); - return ts1.addEmitHelpers(updated, context.readEmitHelpers()), updated; + return ts.addEmitHelpers(updated, context.readEmitHelpers()), updated; } function collectAsynchronousDependencies(node, includeNonAmdDependencies) { for(var aliasedModuleNames = [], unaliasedModuleNames = [], importAliasNames = [], _i = 0, _a = node.amdDependencies; _i < _a.length; _i++){ @@ -137,8 +137,8 @@ var ts, ts1, dynamicImportUMDHelper; amdDependency.name ? (aliasedModuleNames.push(factory.createStringLiteral(amdDependency.path)), importAliasNames.push(factory.createParameterDeclaration(void 0, void 0, void 0, amdDependency.name))) : unaliasedModuleNames.push(factory.createStringLiteral(amdDependency.path)); } for(var _b = 0, _c = currentModuleInfo.externalImports; _b < _c.length; _b++){ - var importNode = _c[_b], externalModuleName = ts1.getExternalModuleNameLiteral(factory, importNode, currentSourceFile, host, resolver, compilerOptions), importAliasName = ts1.getLocalNameForExternalImport(factory, importNode, currentSourceFile); - externalModuleName && (includeNonAmdDependencies && importAliasName ? (ts1.setEmitFlags(importAliasName, 4), aliasedModuleNames.push(externalModuleName), importAliasNames.push(factory.createParameterDeclaration(void 0, void 0, void 0, importAliasName))) : unaliasedModuleNames.push(externalModuleName)); + var importNode = _c[_b], externalModuleName = ts.getExternalModuleNameLiteral(factory, importNode, currentSourceFile, host, resolver, compilerOptions), importAliasName = ts.getLocalNameForExternalImport(factory, importNode, currentSourceFile); + externalModuleName && (includeNonAmdDependencies && importAliasName ? (ts.setEmitFlags(importAliasName, 4), aliasedModuleNames.push(externalModuleName), importAliasNames.push(factory.createParameterDeclaration(void 0, void 0, void 0, importAliasName))) : unaliasedModuleNames.push(externalModuleName)); } return { aliasedModuleNames: aliasedModuleNames, @@ -147,30 +147,30 @@ var ts, ts1, dynamicImportUMDHelper; }; } function getAMDImportExpressionForImport(node) { - if (!(ts1.isImportEqualsDeclaration(node) || ts1.isExportDeclaration(node)) && ts1.getExternalModuleNameLiteral(factory, node, currentSourceFile, host, resolver, compilerOptions)) { - var name = ts1.getLocalNameForExternalImport(factory, node, currentSourceFile), expr = getHelperExpressionForImport(node, name); + if (!(ts.isImportEqualsDeclaration(node) || ts.isExportDeclaration(node)) && ts.getExternalModuleNameLiteral(factory, node, currentSourceFile, host, resolver, compilerOptions)) { + var name = ts.getLocalNameForExternalImport(factory, node, currentSourceFile), expr = getHelperExpressionForImport(node, name); if (expr !== name) return factory.createExpressionStatement(factory.createAssignment(name, expr)); } } function transformAsynchronousModuleBody(node) { startLexicalEnvironment(); var statements = [], statementOffset = factory.copyPrologue(node.statements, statements, !compilerOptions.noImplicitUseStrict, topLevelVisitor); - shouldEmitUnderscoreUnderscoreESModule() && ts1.append(statements, createUnderscoreUnderscoreESModule()), ts1.length(currentModuleInfo.exportedNames) && ts1.append(statements, factory.createExpressionStatement(ts1.reduceLeft(currentModuleInfo.exportedNames, function(prev, nextId) { - return factory.createAssignment(factory.createPropertyAccessExpression(factory.createIdentifier("exports"), factory.createIdentifier(ts1.idText(nextId))), prev); - }, factory.createVoidZero()))), ts1.append(statements, ts1.visitNode(currentModuleInfo.externalHelpersImportDeclaration, topLevelVisitor, ts1.isStatement)), moduleKind === ts1.ModuleKind.AMD && ts1.addRange(statements, ts1.mapDefined(currentModuleInfo.externalImports, getAMDImportExpressionForImport)), ts1.addRange(statements, ts1.visitNodes(node.statements, topLevelVisitor, ts1.isStatement, statementOffset)), addExportEqualsIfNeeded(statements, !0), ts1.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment()); + shouldEmitUnderscoreUnderscoreESModule() && ts.append(statements, createUnderscoreUnderscoreESModule()), ts.length(currentModuleInfo.exportedNames) && ts.append(statements, factory.createExpressionStatement(ts.reduceLeft(currentModuleInfo.exportedNames, function(prev, nextId) { + return factory.createAssignment(factory.createPropertyAccessExpression(factory.createIdentifier("exports"), factory.createIdentifier(ts.idText(nextId))), prev); + }, factory.createVoidZero()))), ts.append(statements, ts.visitNode(currentModuleInfo.externalHelpersImportDeclaration, topLevelVisitor, ts.isStatement)), moduleKind === ts.ModuleKind.AMD && ts.addRange(statements, ts.mapDefined(currentModuleInfo.externalImports, getAMDImportExpressionForImport)), ts.addRange(statements, ts.visitNodes(node.statements, topLevelVisitor, ts.isStatement, statementOffset)), addExportEqualsIfNeeded(statements, !0), ts.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment()); var body = factory.createBlock(statements, !0); - return needUMDDynamicImportHelper && ts1.addEmitHelper(body, dynamicImportUMDHelper), body; + return needUMDDynamicImportHelper && ts.addEmitHelper(body, dynamicImportUMDHelper), body; } function addExportEqualsIfNeeded(statements, emitAsReturn) { if (currentModuleInfo.exportEquals) { - var expressionResult = ts1.visitNode(currentModuleInfo.exportEquals.expression, visitor); + var expressionResult = ts.visitNode(currentModuleInfo.exportEquals.expression, visitor); if (expressionResult) { if (emitAsReturn) { var statement = factory.createReturnStatement(expressionResult); - ts1.setTextRange(statement, currentModuleInfo.exportEquals), ts1.setEmitFlags(statement, 1920), statements.push(statement); + ts.setTextRange(statement, currentModuleInfo.exportEquals), ts.setEmitFlags(statement, 1920), statements.push(statement); } else { var statement = factory.createExpressionStatement(factory.createAssignment(factory.createPropertyAccessExpression(factory.createIdentifier("module"), "exports"), expressionResult)); - ts1.setTextRange(statement, currentModuleInfo.exportEquals), ts1.setEmitFlags(statement, 1536), statements.push(statement); + ts.setTextRange(statement, currentModuleInfo.exportEquals), ts.setEmitFlags(statement, 1536), statements.push(statement); } } } @@ -179,52 +179,52 @@ var ts, ts1, dynamicImportUMDHelper; switch(node.kind){ case 265: return function(node) { - var statements, namespaceDeclaration = ts1.getNamespaceDeclarationNode(node); - if (moduleKind !== ts1.ModuleKind.AMD) { - if (!node.importClause) return ts1.setOriginalNode(ts1.setTextRange(factory.createExpressionStatement(createRequireCall(node)), node), node); + var statements, namespaceDeclaration = ts.getNamespaceDeclarationNode(node); + if (moduleKind !== ts.ModuleKind.AMD) { + if (!node.importClause) return ts.setOriginalNode(ts.setTextRange(factory.createExpressionStatement(createRequireCall(node)), node), node); var variables = []; - namespaceDeclaration && !ts1.isDefaultImport(node) ? variables.push(factory.createVariableDeclaration(factory.cloneNode(namespaceDeclaration.name), void 0, void 0, getHelperExpressionForImport(node, createRequireCall(node)))) : (variables.push(factory.createVariableDeclaration(factory.getGeneratedNameForNode(node), void 0, void 0, getHelperExpressionForImport(node, createRequireCall(node)))), namespaceDeclaration && ts1.isDefaultImport(node) && variables.push(factory.createVariableDeclaration(factory.cloneNode(namespaceDeclaration.name), void 0, void 0, factory.getGeneratedNameForNode(node)))), statements = ts1.append(statements, ts1.setOriginalNode(ts1.setTextRange(factory.createVariableStatement(void 0, factory.createVariableDeclarationList(variables, languageVersion >= 2 ? 2 : 0)), node), node)); - } else namespaceDeclaration && ts1.isDefaultImport(node) && (statements = ts1.append(statements, factory.createVariableStatement(void 0, factory.createVariableDeclarationList([ - ts1.setOriginalNode(ts1.setTextRange(factory.createVariableDeclaration(factory.cloneNode(namespaceDeclaration.name), void 0, void 0, factory.getGeneratedNameForNode(node)), node), node) + namespaceDeclaration && !ts.isDefaultImport(node) ? variables.push(factory.createVariableDeclaration(factory.cloneNode(namespaceDeclaration.name), void 0, void 0, getHelperExpressionForImport(node, createRequireCall(node)))) : (variables.push(factory.createVariableDeclaration(factory.getGeneratedNameForNode(node), void 0, void 0, getHelperExpressionForImport(node, createRequireCall(node)))), namespaceDeclaration && ts.isDefaultImport(node) && variables.push(factory.createVariableDeclaration(factory.cloneNode(namespaceDeclaration.name), void 0, void 0, factory.getGeneratedNameForNode(node)))), statements = ts.append(statements, ts.setOriginalNode(ts.setTextRange(factory.createVariableStatement(void 0, factory.createVariableDeclarationList(variables, languageVersion >= 2 ? 2 : 0)), node), node)); + } else namespaceDeclaration && ts.isDefaultImport(node) && (statements = ts.append(statements, factory.createVariableStatement(void 0, factory.createVariableDeclarationList([ + ts.setOriginalNode(ts.setTextRange(factory.createVariableDeclaration(factory.cloneNode(namespaceDeclaration.name), void 0, void 0, factory.getGeneratedNameForNode(node)), node), node) ], languageVersion >= 2 ? 2 : 0)))); if (hasAssociatedEndOfDeclarationMarker(node)) { - var id = ts1.getOriginalNodeId(node); + var id = ts.getOriginalNodeId(node); deferredExports[id] = appendExportsOfImportDeclaration(deferredExports[id], node); } else statements = appendExportsOfImportDeclaration(statements, node); - return ts1.singleOrMany(statements); + return ts.singleOrMany(statements); }(node); case 264: return function(node) { - if (ts1.Debug.assert(ts1.isExternalModuleImportEqualsDeclaration(node), "import= for internal module references should be handled in an earlier transformer."), moduleKind !== ts1.ModuleKind.AMD ? statements = ts1.hasSyntacticModifier(node, 1) ? ts1.append(statements, ts1.setOriginalNode(ts1.setTextRange(factory.createExpressionStatement(createExportExpression(node.name, createRequireCall(node))), node), node)) : ts1.append(statements, ts1.setOriginalNode(ts1.setTextRange(factory.createVariableStatement(void 0, factory.createVariableDeclarationList([ + if (ts.Debug.assert(ts.isExternalModuleImportEqualsDeclaration(node), "import= for internal module references should be handled in an earlier transformer."), moduleKind !== ts.ModuleKind.AMD ? statements = ts.hasSyntacticModifier(node, 1) ? ts.append(statements, ts.setOriginalNode(ts.setTextRange(factory.createExpressionStatement(createExportExpression(node.name, createRequireCall(node))), node), node)) : ts.append(statements, ts.setOriginalNode(ts.setTextRange(factory.createVariableStatement(void 0, factory.createVariableDeclarationList([ factory.createVariableDeclaration(factory.cloneNode(node.name), void 0, void 0, createRequireCall(node)) - ], languageVersion >= 2 ? 2 : 0)), node), node)) : ts1.hasSyntacticModifier(node, 1) && (statements = ts1.append(statements, ts1.setOriginalNode(ts1.setTextRange(factory.createExpressionStatement(createExportExpression(factory.getExportName(node), factory.getLocalName(node))), node), node))), hasAssociatedEndOfDeclarationMarker(node)) { - var statements, id = ts1.getOriginalNodeId(node); + ], languageVersion >= 2 ? 2 : 0)), node), node)) : ts.hasSyntacticModifier(node, 1) && (statements = ts.append(statements, ts.setOriginalNode(ts.setTextRange(factory.createExpressionStatement(createExportExpression(factory.getExportName(node), factory.getLocalName(node))), node), node))), hasAssociatedEndOfDeclarationMarker(node)) { + var statements, id = ts.getOriginalNodeId(node); deferredExports[id] = appendExportsOfImportEqualsDeclaration(deferredExports[id], node); } else statements = appendExportsOfImportEqualsDeclaration(statements, node); - return ts1.singleOrMany(statements); + return ts.singleOrMany(statements); }(node); case 271: return function(node) { if (node.moduleSpecifier) { var innerExpr, generatedName = factory.getGeneratedNameForNode(node); - if (node.exportClause && ts1.isNamedExports(node.exportClause)) { + if (node.exportClause && ts.isNamedExports(node.exportClause)) { var statements = []; - moduleKind !== ts1.ModuleKind.AMD && statements.push(ts1.setOriginalNode(ts1.setTextRange(factory.createVariableStatement(void 0, factory.createVariableDeclarationList([ + moduleKind !== ts.ModuleKind.AMD && statements.push(ts.setOriginalNode(ts.setTextRange(factory.createVariableStatement(void 0, factory.createVariableDeclarationList([ factory.createVariableDeclaration(generatedName, void 0, void 0, createRequireCall(node)) ])), node), node)); for(var _i = 0, _a = node.exportClause.elements; _i < _a.length; _i++){ var specifier = _a[_i]; - if (0 === languageVersion) statements.push(ts1.setOriginalNode(ts1.setTextRange(factory.createExpressionStatement(emitHelpers().createCreateBindingHelper(generatedName, factory.createStringLiteralFromNode(specifier.propertyName || specifier.name), specifier.propertyName ? factory.createStringLiteralFromNode(specifier.name) : void 0)), specifier), specifier)); + if (0 === languageVersion) statements.push(ts.setOriginalNode(ts.setTextRange(factory.createExpressionStatement(emitHelpers().createCreateBindingHelper(generatedName, factory.createStringLiteralFromNode(specifier.propertyName || specifier.name), specifier.propertyName ? factory.createStringLiteralFromNode(specifier.name) : void 0)), specifier), specifier)); else { - var exportNeedsImportDefault = !!ts1.getESModuleInterop(compilerOptions) && !(67108864 & ts1.getEmitFlags(node)) && "default" === ts1.idText(specifier.propertyName || specifier.name), exportedValue = factory.createPropertyAccessExpression(exportNeedsImportDefault ? emitHelpers().createImportDefaultHelper(generatedName) : generatedName, specifier.propertyName || specifier.name); - statements.push(ts1.setOriginalNode(ts1.setTextRange(factory.createExpressionStatement(createExportExpression(factory.getExportName(specifier), exportedValue, void 0, !0)), specifier), specifier)); + var exportNeedsImportDefault = !!ts.getESModuleInterop(compilerOptions) && !(67108864 & ts.getEmitFlags(node)) && "default" === ts.idText(specifier.propertyName || specifier.name), exportedValue = factory.createPropertyAccessExpression(exportNeedsImportDefault ? emitHelpers().createImportDefaultHelper(generatedName) : generatedName, specifier.propertyName || specifier.name); + statements.push(ts.setOriginalNode(ts.setTextRange(factory.createExpressionStatement(createExportExpression(factory.getExportName(specifier), exportedValue, void 0, !0)), specifier), specifier)); } } - return ts1.singleOrMany(statements); + return ts.singleOrMany(statements); } - if (!node.exportClause) return ts1.setOriginalNode(ts1.setTextRange(factory.createExpressionStatement(emitHelpers().createExportStarHelper(moduleKind !== ts1.ModuleKind.AMD ? createRequireCall(node) : generatedName)), node), node); + if (!node.exportClause) return ts.setOriginalNode(ts.setTextRange(factory.createExpressionStatement(emitHelpers().createExportStarHelper(moduleKind !== ts.ModuleKind.AMD ? createRequireCall(node) : generatedName)), node), node); var statements = []; - return statements.push(ts1.setOriginalNode(ts1.setTextRange(factory.createExpressionStatement(createExportExpression(factory.cloneNode(node.exportClause.name), (innerExpr = moduleKind !== ts1.ModuleKind.AMD ? createRequireCall(node) : ts1.isExportNamespaceAsDefaultDeclaration(node) ? generatedName : factory.createIdentifier(ts1.idText(node.exportClause.name)), !ts1.getESModuleInterop(compilerOptions) || 67108864 & ts1.getEmitFlags(node) ? innerExpr : ts1.getExportNeedsImportStarHelper(node) ? emitHelpers().createImportStarHelper(innerExpr) : innerExpr))), node), node)), ts1.singleOrMany(statements); + return statements.push(ts.setOriginalNode(ts.setTextRange(factory.createExpressionStatement(createExportExpression(factory.cloneNode(node.exportClause.name), (innerExpr = moduleKind !== ts.ModuleKind.AMD ? createRequireCall(node) : ts.isExportNamespaceAsDefaultDeclaration(node) ? generatedName : factory.createIdentifier(ts.idText(node.exportClause.name)), !ts.getESModuleInterop(compilerOptions) || 67108864 & ts.getEmitFlags(node) ? innerExpr : ts.getExportNeedsImportStarHelper(node) ? emitHelpers().createImportStarHelper(innerExpr) : innerExpr))), node), node)), ts.singleOrMany(statements); } }(node); case 270: @@ -232,65 +232,65 @@ var ts, ts1, dynamicImportUMDHelper; if (!node.isExportEquals) { var statements, original = node.original; if (original && hasAssociatedEndOfDeclarationMarker(original)) { - var id = ts1.getOriginalNodeId(node); - deferredExports[id] = appendExportStatement(deferredExports[id], factory.createIdentifier("default"), ts1.visitNode(node.expression, visitor), node, !0); - } else statements = appendExportStatement(statements, factory.createIdentifier("default"), ts1.visitNode(node.expression, visitor), node, !0); - return ts1.singleOrMany(statements); + var id = ts.getOriginalNodeId(node); + deferredExports[id] = appendExportStatement(deferredExports[id], factory.createIdentifier("default"), ts.visitNode(node.expression, visitor), node, !0); + } else statements = appendExportStatement(statements, factory.createIdentifier("default"), ts.visitNode(node.expression, visitor), node, !0); + return ts.singleOrMany(statements); } }(node); case 236: return function(node) { - if (ts1.hasSyntacticModifier(node, 1)) { + if (ts.hasSyntacticModifier(node, 1)) { for(var statements, variables, expressions, modifiers = void 0, removeCommentsOnExpressions = !1, _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++){ var variable = _a[_i]; - if (ts1.isIdentifier(variable.name) && ts1.isLocalName(variable.name)) modifiers || (modifiers = ts1.visitNodes(node.modifiers, modifierVisitor, ts1.isModifier)), variables = ts1.append(variables, variable); + if (ts.isIdentifier(variable.name) && ts.isLocalName(variable.name)) modifiers || (modifiers = ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier)), variables = ts.append(variables, variable); else if (variable.initializer) { - if (!ts1.isBindingPattern(variable.name) && (ts1.isArrowFunction(variable.initializer) || ts1.isFunctionExpression(variable.initializer) || ts1.isClassExpression(variable.initializer))) { - var expression = factory.createAssignment(ts1.setTextRange(factory.createPropertyAccessExpression(factory.createIdentifier("exports"), variable.name), variable.name), factory.createIdentifier(ts1.getTextOfIdentifierOrLiteral(variable.name))), updatedVariable = factory.createVariableDeclaration(variable.name, variable.exclamationToken, variable.type, ts1.visitNode(variable.initializer, visitor)); - variables = ts1.append(variables, updatedVariable), expressions = ts1.append(expressions, expression), removeCommentsOnExpressions = !0; - } else expressions = ts1.append(expressions, ts1.isBindingPattern(variable.name) ? ts1.flattenDestructuringAssignment(ts1.visitNode(variable, visitor), void 0, context, 0, !1, createAllExportExpressions) : factory.createAssignment(ts1.setTextRange(factory.createPropertyAccessExpression(factory.createIdentifier("exports"), variable.name), variable.name), variable.initializer ? ts1.visitNode(variable.initializer, visitor) : factory.createVoidZero())); + if (!ts.isBindingPattern(variable.name) && (ts.isArrowFunction(variable.initializer) || ts.isFunctionExpression(variable.initializer) || ts.isClassExpression(variable.initializer))) { + var expression = factory.createAssignment(ts.setTextRange(factory.createPropertyAccessExpression(factory.createIdentifier("exports"), variable.name), variable.name), factory.createIdentifier(ts.getTextOfIdentifierOrLiteral(variable.name))), updatedVariable = factory.createVariableDeclaration(variable.name, variable.exclamationToken, variable.type, ts.visitNode(variable.initializer, visitor)); + variables = ts.append(variables, updatedVariable), expressions = ts.append(expressions, expression), removeCommentsOnExpressions = !0; + } else expressions = ts.append(expressions, ts.isBindingPattern(variable.name) ? ts.flattenDestructuringAssignment(ts.visitNode(variable, visitor), void 0, context, 0, !1, createAllExportExpressions) : factory.createAssignment(ts.setTextRange(factory.createPropertyAccessExpression(factory.createIdentifier("exports"), variable.name), variable.name), variable.initializer ? ts.visitNode(variable.initializer, visitor) : factory.createVoidZero())); } } - if (variables && (statements = ts1.append(statements, factory.updateVariableStatement(node, modifiers, factory.updateVariableDeclarationList(node.declarationList, variables)))), expressions) { - var statement = ts1.setOriginalNode(ts1.setTextRange(factory.createExpressionStatement(factory.inlineExpressions(expressions)), node), node); - removeCommentsOnExpressions && ts1.removeAllComments(statement), statements = ts1.append(statements, statement); + if (variables && (statements = ts.append(statements, factory.updateVariableStatement(node, modifiers, factory.updateVariableDeclarationList(node.declarationList, variables)))), expressions) { + var statement = ts.setOriginalNode(ts.setTextRange(factory.createExpressionStatement(factory.inlineExpressions(expressions)), node), node); + removeCommentsOnExpressions && ts.removeAllComments(statement), statements = ts.append(statements, statement); } - } else statements = ts1.append(statements, ts1.visitEachChild(node, visitor, context)); + } else statements = ts.append(statements, ts.visitEachChild(node, visitor, context)); if (hasAssociatedEndOfDeclarationMarker(node)) { - var id = ts1.getOriginalNodeId(node); + var id = ts.getOriginalNodeId(node); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node); } else statements = appendExportsOfVariableStatement(statements, node); - return ts1.singleOrMany(statements); + return ts.singleOrMany(statements); }(node); case 255: return function(node) { var statements; - if (statements = ts1.hasSyntacticModifier(node, 1) ? ts1.append(statements, ts1.setOriginalNode(ts1.setTextRange(factory.createFunctionDeclaration(void 0, ts1.visitNodes(node.modifiers, modifierVisitor, ts1.isModifier), node.asteriskToken, factory.getDeclarationName(node, !0, !0), void 0, ts1.visitNodes(node.parameters, visitor), void 0, ts1.visitEachChild(node.body, visitor, context)), node), node)) : ts1.append(statements, ts1.visitEachChild(node, visitor, context)), hasAssociatedEndOfDeclarationMarker(node)) { - var id = ts1.getOriginalNodeId(node); + if (statements = ts.hasSyntacticModifier(node, 1) ? ts.append(statements, ts.setOriginalNode(ts.setTextRange(factory.createFunctionDeclaration(void 0, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.asteriskToken, factory.getDeclarationName(node, !0, !0), void 0, ts.visitNodes(node.parameters, visitor), void 0, ts.visitEachChild(node.body, visitor, context)), node), node)) : ts.append(statements, ts.visitEachChild(node, visitor, context)), hasAssociatedEndOfDeclarationMarker(node)) { + var id = ts.getOriginalNodeId(node); deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node); } else statements = appendExportsOfHoistedDeclaration(statements, node); - return ts1.singleOrMany(statements); + return ts.singleOrMany(statements); }(node); case 256: return function(node) { var statements; - if (statements = ts1.hasSyntacticModifier(node, 1) ? ts1.append(statements, ts1.setOriginalNode(ts1.setTextRange(factory.createClassDeclaration(void 0, ts1.visitNodes(node.modifiers, modifierVisitor, ts1.isModifier), factory.getDeclarationName(node, !0, !0), void 0, ts1.visitNodes(node.heritageClauses, visitor), ts1.visitNodes(node.members, visitor)), node), node)) : ts1.append(statements, ts1.visitEachChild(node, visitor, context)), hasAssociatedEndOfDeclarationMarker(node)) { - var id = ts1.getOriginalNodeId(node); + if (statements = ts.hasSyntacticModifier(node, 1) ? ts.append(statements, ts.setOriginalNode(ts.setTextRange(factory.createClassDeclaration(void 0, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), factory.getDeclarationName(node, !0, !0), void 0, ts.visitNodes(node.heritageClauses, visitor), ts.visitNodes(node.members, visitor)), node), node)) : ts.append(statements, ts.visitEachChild(node, visitor, context)), hasAssociatedEndOfDeclarationMarker(node)) { + var id = ts.getOriginalNodeId(node); deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node); } else statements = appendExportsOfHoistedDeclaration(statements, node); - return ts1.singleOrMany(statements); + return ts.singleOrMany(statements); }(node); case 350: return function(node) { if (hasAssociatedEndOfDeclarationMarker(node) && 236 === node.original.kind) { - var id = ts1.getOriginalNodeId(node); + var id = ts.getOriginalNodeId(node); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original); } return node; }(node); case 351: var id, statements; - return (statements = deferredExports[id = ts1.getOriginalNodeId(node)]) ? (delete deferredExports[id], ts1.append(statements, node)) : node; + return (statements = deferredExports[id = ts.getOriginalNodeId(node)]) ? (delete deferredExports[id], ts.append(statements, node)) : node; default: return visitor(node); } @@ -299,37 +299,37 @@ var ts, ts1, dynamicImportUMDHelper; if (!(71307264 & node.transformFlags)) return node; switch(node.kind){ case 241: - return factory.updateForStatement(node, ts1.visitNode(node.initializer, discardedValueVisitor, ts1.isForInitializer), ts1.visitNode(node.condition, visitor, ts1.isExpression), ts1.visitNode(node.incrementor, discardedValueVisitor, ts1.isExpression), ts1.visitIterationBody(node.statement, visitor, context)); + return factory.updateForStatement(node, ts.visitNode(node.initializer, discardedValueVisitor, ts.isForInitializer), ts.visitNode(node.condition, visitor, ts.isExpression), ts.visitNode(node.incrementor, discardedValueVisitor, ts.isExpression), ts.visitIterationBody(node.statement, visitor, context)); case 237: - return factory.updateExpressionStatement(node, ts1.visitNode(node.expression, discardedValueVisitor, ts1.isExpression)); + return factory.updateExpressionStatement(node, ts.visitNode(node.expression, discardedValueVisitor, ts.isExpression)); case 211: - return factory.updateParenthesizedExpression(node, ts1.visitNode(node.expression, valueIsDiscarded ? discardedValueVisitor : visitor, ts1.isExpression)); + return factory.updateParenthesizedExpression(node, ts.visitNode(node.expression, valueIsDiscarded ? discardedValueVisitor : visitor, ts.isExpression)); case 348: - return factory.updatePartiallyEmittedExpression(node, ts1.visitNode(node.expression, valueIsDiscarded ? discardedValueVisitor : visitor, ts1.isExpression)); + return factory.updatePartiallyEmittedExpression(node, ts.visitNode(node.expression, valueIsDiscarded ? discardedValueVisitor : visitor, ts.isExpression)); case 207: - if (ts1.isImportCall(node) && void 0 === currentSourceFile.impliedNodeFormat) return function(node) { - var externalModuleName = ts1.getExternalModuleNameLiteral(factory, node, currentSourceFile, host, resolver, compilerOptions), firstArgument = ts1.visitNode(ts1.firstOrUndefined(node.arguments), visitor), argument = !externalModuleName || firstArgument && ts1.isStringLiteral(firstArgument) && firstArgument.text === externalModuleName.text ? firstArgument : externalModuleName, containsLexicalThis = !!(8192 & node.transformFlags); + if (ts.isImportCall(node) && void 0 === currentSourceFile.impliedNodeFormat) return function(node) { + var externalModuleName = ts.getExternalModuleNameLiteral(factory, node, currentSourceFile, host, resolver, compilerOptions), firstArgument = ts.visitNode(ts.firstOrUndefined(node.arguments), visitor), argument = !externalModuleName || firstArgument && ts.isStringLiteral(firstArgument) && firstArgument.text === externalModuleName.text ? firstArgument : externalModuleName, containsLexicalThis = !!(8192 & node.transformFlags); switch(compilerOptions.module){ - case ts1.ModuleKind.AMD: + case ts.ModuleKind.AMD: return createImportCallExpressionAMD(argument, containsLexicalThis); - case ts1.ModuleKind.UMD: + case ts.ModuleKind.UMD: return function(arg, containsLexicalThis) { - if (needUMDDynamicImportHelper = !0, ts1.isSimpleCopiableExpression(arg)) { - var argClone = ts1.isGeneratedIdentifier(arg) ? arg : ts1.isStringLiteral(arg) ? factory.createStringLiteralFromNode(arg) : ts1.setEmitFlags(ts1.setTextRange(factory.cloneNode(arg), arg), 1536); + if (needUMDDynamicImportHelper = !0, ts.isSimpleCopiableExpression(arg)) { + var argClone = ts.isGeneratedIdentifier(arg) ? arg : ts.isStringLiteral(arg) ? factory.createStringLiteralFromNode(arg) : ts.setEmitFlags(ts.setTextRange(factory.cloneNode(arg), arg), 1536); return factory.createConditionalExpression(factory.createIdentifier("__syncRequire"), void 0, createImportCallExpressionCommonJS(arg, containsLexicalThis), void 0, createImportCallExpressionAMD(argClone, containsLexicalThis)); } var temp = factory.createTempVariable(hoistVariableDeclaration); return factory.createComma(factory.createAssignment(temp, arg), factory.createConditionalExpression(factory.createIdentifier("__syncRequire"), void 0, createImportCallExpressionCommonJS(temp, containsLexicalThis), void 0, createImportCallExpressionAMD(temp, containsLexicalThis))); }(null != argument ? argument : factory.createVoidZero(), containsLexicalThis); - case ts1.ModuleKind.CommonJS: + case ts.ModuleKind.CommonJS: default: return createImportCallExpressionCommonJS(argument, containsLexicalThis); } }(node); break; case 220: - if (ts1.isDestructuringAssignment(node)) return !function destructuringNeedsFlattening(node) { - if (ts1.isObjectLiteralExpression(node)) for(var _i = 0, _a = node.properties; _i < _a.length; _i++){ + if (ts.isDestructuringAssignment(node)) return !function destructuringNeedsFlattening(node) { + if (ts.isObjectLiteralExpression(node)) for(var _i = 0, _a = node.properties; _i < _a.length; _i++){ var elem = _a[_i]; switch(elem.kind){ case 294: @@ -346,38 +346,38 @@ var ts, ts1, dynamicImportUMDHelper; case 172: return !1; default: - ts1.Debug.assertNever(elem, "Unhandled object member kind"); + ts.Debug.assertNever(elem, "Unhandled object member kind"); } } - else if (ts1.isArrayLiteralExpression(node)) for(var _b = 0, _c = node.elements; _b < _c.length; _b++){ + else if (ts.isArrayLiteralExpression(node)) for(var _b = 0, _c = node.elements; _b < _c.length; _b++){ var elem = _c[_b]; - if (ts1.isSpreadElement(elem)) { + if (ts.isSpreadElement(elem)) { if (destructuringNeedsFlattening(elem.expression)) return !0; } else if (destructuringNeedsFlattening(elem)) return !0; } - else if (ts1.isIdentifier(node)) return ts1.length(getExports(node)) > (ts1.isExportName(node) ? 1 : 0); + else if (ts.isIdentifier(node)) return ts.length(getExports(node)) > (ts.isExportName(node) ? 1 : 0); return !1; - }(node.left) ? ts1.visitEachChild(node, visitor, context) : ts1.flattenDestructuringAssignment(node, visitor, context, 0, !valueIsDiscarded, createAllExportExpressions); + }(node.left) ? ts.visitEachChild(node, visitor, context) : ts.flattenDestructuringAssignment(node, visitor, context, 0, !valueIsDiscarded, createAllExportExpressions); break; case 218: case 219: return function(node, valueIsDiscarded) { - if ((45 === node.operator || 46 === node.operator) && ts1.isIdentifier(node.operand) && !ts1.isGeneratedIdentifier(node.operand) && !ts1.isLocalName(node.operand) && !ts1.isDeclarationNameOfEnumOrNamespace(node.operand)) { + if ((45 === node.operator || 46 === node.operator) && ts.isIdentifier(node.operand) && !ts.isGeneratedIdentifier(node.operand) && !ts.isLocalName(node.operand) && !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) { var exportedNames = getExports(node.operand); if (exportedNames) { - var temp = void 0, expression = ts1.visitNode(node.operand, visitor, ts1.isExpression); - ts1.isPrefixUnaryExpression(node) ? expression = factory.updatePrefixUnaryExpression(node, expression) : (expression = factory.updatePostfixUnaryExpression(node, expression), valueIsDiscarded || (temp = factory.createTempVariable(hoistVariableDeclaration), expression = factory.createAssignment(temp, expression), ts1.setTextRange(expression, node)), expression = factory.createComma(expression, factory.cloneNode(node.operand)), ts1.setTextRange(expression, node)); + var temp = void 0, expression = ts.visitNode(node.operand, visitor, ts.isExpression); + ts.isPrefixUnaryExpression(node) ? expression = factory.updatePrefixUnaryExpression(node, expression) : (expression = factory.updatePostfixUnaryExpression(node, expression), valueIsDiscarded || (temp = factory.createTempVariable(hoistVariableDeclaration), expression = factory.createAssignment(temp, expression), ts.setTextRange(expression, node)), expression = factory.createComma(expression, factory.cloneNode(node.operand)), ts.setTextRange(expression, node)); for(var _i = 0; _i < exportedNames.length; _i++){ var exportName = exportedNames[_i]; - noSubstitution[ts1.getNodeId(expression)] = !0, expression = createExportExpression(exportName, expression), ts1.setTextRange(expression, node); + noSubstitution[ts.getNodeId(expression)] = !0, expression = createExportExpression(exportName, expression), ts.setTextRange(expression, node); } - return temp && (noSubstitution[ts1.getNodeId(expression)] = !0, expression = factory.createComma(expression, temp), ts1.setTextRange(expression, node)), expression; + return temp && (noSubstitution[ts.getNodeId(expression)] = !0, expression = factory.createComma(expression, temp), ts.setTextRange(expression, node)), expression; } } - return ts1.visitEachChild(node, visitor, context); + return ts.visitEachChild(node, visitor, context); }(node, valueIsDiscarded); } - return ts1.visitEachChild(node, visitor, context); + return ts.visitEachChild(node, visitor, context); } function visitor(node) { return visitorWorker(node, !1); @@ -398,11 +398,11 @@ var ts, ts1, dynamicImportUMDHelper; reject ])) ]); - languageVersion >= 2 ? func = factory.createArrowFunction(void 0, void 0, parameters, void 0, void 0, body) : (func = factory.createFunctionExpression(void 0, void 0, void 0, void 0, parameters, void 0, body), containsLexicalThis && ts1.setEmitFlags(func, 8)); + languageVersion >= 2 ? func = factory.createArrowFunction(void 0, void 0, parameters, void 0, void 0, body) : (func = factory.createFunctionExpression(void 0, void 0, void 0, void 0, parameters, void 0, body), containsLexicalThis && ts.setEmitFlags(func, 8)); var promise = factory.createNewExpression(factory.createIdentifier("Promise"), void 0, [ func ]); - return ts1.getESModuleInterop(compilerOptions) ? factory.createCallExpression(factory.createPropertyAccessExpression(promise, factory.createIdentifier("then")), void 0, [ + return ts.getESModuleInterop(compilerOptions) ? factory.createCallExpression(factory.createPropertyAccessExpression(promise, factory.createIdentifier("then")), void 0, [ emitHelpers().createImportStarCallbackHelper() ]) : promise; } @@ -410,32 +410,32 @@ var ts, ts1, dynamicImportUMDHelper; var func, promiseResolveCall = factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("Promise"), "resolve"), void 0, []), requireCall = factory.createCallExpression(factory.createIdentifier("require"), void 0, arg ? [ arg ] : []); - return ts1.getESModuleInterop(compilerOptions) && (requireCall = emitHelpers().createImportStarHelper(requireCall)), languageVersion >= 2 ? func = factory.createArrowFunction(void 0, void 0, [], void 0, void 0, requireCall) : (func = factory.createFunctionExpression(void 0, void 0, void 0, void 0, [], void 0, factory.createBlock([ + return ts.getESModuleInterop(compilerOptions) && (requireCall = emitHelpers().createImportStarHelper(requireCall)), languageVersion >= 2 ? func = factory.createArrowFunction(void 0, void 0, [], void 0, void 0, requireCall) : (func = factory.createFunctionExpression(void 0, void 0, void 0, void 0, [], void 0, factory.createBlock([ factory.createReturnStatement(requireCall) - ])), containsLexicalThis && ts1.setEmitFlags(func, 8)), factory.createCallExpression(factory.createPropertyAccessExpression(promiseResolveCall, "then"), void 0, [ + ])), containsLexicalThis && ts.setEmitFlags(func, 8)), factory.createCallExpression(factory.createPropertyAccessExpression(promiseResolveCall, "then"), void 0, [ func ]); } function getHelperExpressionForImport(node, innerExpr) { - return !ts1.getESModuleInterop(compilerOptions) || 67108864 & ts1.getEmitFlags(node) ? innerExpr : ts1.getImportNeedsImportStarHelper(node) ? emitHelpers().createImportStarHelper(innerExpr) : ts1.getImportNeedsImportDefaultHelper(node) ? emitHelpers().createImportDefaultHelper(innerExpr) : innerExpr; + return !ts.getESModuleInterop(compilerOptions) || 67108864 & ts.getEmitFlags(node) ? innerExpr : ts.getImportNeedsImportStarHelper(node) ? emitHelpers().createImportStarHelper(innerExpr) : ts.getImportNeedsImportDefaultHelper(node) ? emitHelpers().createImportDefaultHelper(innerExpr) : innerExpr; } function createRequireCall(importNode) { - var moduleName = ts1.getExternalModuleNameLiteral(factory, importNode, currentSourceFile, host, resolver, compilerOptions), args = []; + var moduleName = ts.getExternalModuleNameLiteral(factory, importNode, currentSourceFile, host, resolver, compilerOptions), args = []; return moduleName && args.push(moduleName), factory.createCallExpression(factory.createIdentifier("require"), void 0, args); } function createAllExportExpressions(name, value, location) { var exportedNames = getExports(name); if (exportedNames) { - for(var expression = ts1.isExportName(name) ? value : factory.createAssignment(name, value), _i = 0; _i < exportedNames.length; _i++){ + for(var expression = ts.isExportName(name) ? value : factory.createAssignment(name, value), _i = 0; _i < exportedNames.length; _i++){ var exportName = exportedNames[_i]; - ts1.setEmitFlags(expression, 4), expression = createExportExpression(exportName, expression, location); + ts.setEmitFlags(expression, 4), expression = createExportExpression(exportName, expression, location); } return expression; } return factory.createAssignment(name, value); } function hasAssociatedEndOfDeclarationMarker(node) { - return (4194304 & ts1.getEmitFlags(node)) != 0; + return (4194304 & ts.getEmitFlags(node)) != 0; } function appendExportsOfImportDeclaration(statements, decl) { if (currentModuleInfo.exportEquals) return statements; @@ -459,20 +459,20 @@ var ts, ts1, dynamicImportUMDHelper; if (currentModuleInfo.exportEquals) return statements; for(var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++)statements = function appendExportsOfBindingElement(statements, decl) { if (currentModuleInfo.exportEquals) return statements; - if (ts1.isBindingPattern(decl.name)) for(var _i = 0, _a = decl.name.elements; _i < _a.length; _i++){ + if (ts.isBindingPattern(decl.name)) for(var _i = 0, _a = decl.name.elements; _i < _a.length; _i++){ var element = _a[_i]; - ts1.isOmittedExpression(element) || (statements = appendExportsOfBindingElement(statements, element)); + ts.isOmittedExpression(element) || (statements = appendExportsOfBindingElement(statements, element)); } - else ts1.isGeneratedIdentifier(decl.name) || (statements = appendExportsOfDeclaration(statements, decl)); + else ts.isGeneratedIdentifier(decl.name) || (statements = appendExportsOfDeclaration(statements, decl)); return statements; }(statements, _a[_i]); return statements; } function appendExportsOfHoistedDeclaration(statements, decl) { - return currentModuleInfo.exportEquals || (ts1.hasSyntacticModifier(decl, 1) && (statements = appendExportStatement(statements, ts1.hasSyntacticModifier(decl, 512) ? factory.createIdentifier("default") : factory.getDeclarationName(decl), factory.getLocalName(decl), decl)), decl.name && (statements = appendExportsOfDeclaration(statements, decl))), statements; + return currentModuleInfo.exportEquals || (ts.hasSyntacticModifier(decl, 1) && (statements = appendExportStatement(statements, ts.hasSyntacticModifier(decl, 512) ? factory.createIdentifier("default") : factory.getDeclarationName(decl), factory.getLocalName(decl), decl)), decl.name && (statements = appendExportsOfDeclaration(statements, decl))), statements; } function appendExportsOfDeclaration(statements, decl, liveBinding) { - var name = factory.getDeclarationName(decl), exportSpecifiers = currentModuleInfo.exportSpecifiers.get(ts1.idText(name)); + var name = factory.getDeclarationName(decl), exportSpecifiers = currentModuleInfo.exportSpecifiers.get(ts.idText(name)); if (exportSpecifiers) for(var _i = 0; _i < exportSpecifiers.length; _i++){ var exportSpecifier = exportSpecifiers[_i]; statements = appendExportStatement(statements, exportSpecifier.name, name, exportSpecifier.name, void 0, liveBinding); @@ -481,7 +481,7 @@ var ts, ts1, dynamicImportUMDHelper; } function appendExportStatement(statements, exportName, expression, location, allowComments, liveBinding) { var statement; - return statements = ts1.append(statements, (statement = ts1.setTextRange(factory.createExpressionStatement(createExportExpression(exportName, expression, void 0, liveBinding)), location), ts1.startOnNewLine(statement), allowComments || ts1.setEmitFlags(statement, 1536), statement)); + return statements = ts.append(statements, (statement = ts.setTextRange(factory.createExpressionStatement(createExportExpression(exportName, expression, void 0, liveBinding)), location), ts.startOnNewLine(statement), allowComments || ts.setEmitFlags(statement, 1536), statement)); } function createUnderscoreUnderscoreESModule() { var statement; @@ -491,10 +491,10 @@ var ts, ts1, dynamicImportUMDHelper; factory.createObjectLiteralExpression([ factory.createPropertyAssignment("value", factory.createTrue()) ]) - ])), ts1.setEmitFlags(statement, 1048576), statement; + ])), ts.setEmitFlags(statement, 1048576), statement; } function createExportExpression(name, value, location, liveBinding) { - return ts1.setTextRange(liveBinding && 0 !== languageVersion ? factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("Object"), "defineProperty"), void 0, [ + return ts.setTextRange(liveBinding && 0 !== languageVersion ? factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("Object"), "defineProperty"), void 0, [ factory.createIdentifier("exports"), factory.createStringLiteralFromNode(name), factory.createObjectLiteralExpression([ @@ -515,27 +515,27 @@ var ts, ts1, dynamicImportUMDHelper; } function substituteExpressionIdentifier(node) { var _a, _b; - if (4096 & ts1.getEmitFlags(node)) { - var externalHelpersModuleName = ts1.getExternalHelpersModuleName(currentSourceFile); + if (4096 & ts.getEmitFlags(node)) { + var externalHelpersModuleName = ts.getExternalHelpersModuleName(currentSourceFile); if (externalHelpersModuleName) return factory.createPropertyAccessExpression(externalHelpersModuleName, node); - } else if (!(ts1.isGeneratedIdentifier(node) && !(64 & node.autoGenerateFlags)) && !ts1.isLocalName(node)) { - var exportContainer = resolver.getReferencedExportContainer(node, ts1.isExportName(node)); - if (exportContainer && 303 === exportContainer.kind) return ts1.setTextRange(factory.createPropertyAccessExpression(factory.createIdentifier("exports"), factory.cloneNode(node)), node); + } else if (!(ts.isGeneratedIdentifier(node) && !(64 & node.autoGenerateFlags)) && !ts.isLocalName(node)) { + var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node)); + if (exportContainer && 303 === exportContainer.kind) return ts.setTextRange(factory.createPropertyAccessExpression(factory.createIdentifier("exports"), factory.cloneNode(node)), node); var importDeclaration = resolver.getReferencedImportDeclaration(node); if (importDeclaration) { - if (ts1.isImportClause(importDeclaration)) return ts1.setTextRange(factory.createPropertyAccessExpression(factory.getGeneratedNameForNode(importDeclaration.parent), factory.createIdentifier("default")), node); - if (ts1.isImportSpecifier(importDeclaration)) { + if (ts.isImportClause(importDeclaration)) return ts.setTextRange(factory.createPropertyAccessExpression(factory.getGeneratedNameForNode(importDeclaration.parent), factory.createIdentifier("default")), node); + if (ts.isImportSpecifier(importDeclaration)) { var name = importDeclaration.propertyName || importDeclaration.name; - return ts1.setTextRange(factory.createPropertyAccessExpression(factory.getGeneratedNameForNode((null === (_b = null === (_a = importDeclaration.parent) || void 0 === _a ? void 0 : _a.parent) || void 0 === _b ? void 0 : _b.parent) || importDeclaration), factory.cloneNode(name)), node); + return ts.setTextRange(factory.createPropertyAccessExpression(factory.getGeneratedNameForNode((null === (_b = null === (_a = importDeclaration.parent) || void 0 === _a ? void 0 : _a.parent) || void 0 === _b ? void 0 : _b.parent) || importDeclaration), factory.cloneNode(name)), node); } } } return node; } function getExports(name) { - if (!ts1.isGeneratedIdentifier(name)) { + if (!ts.isGeneratedIdentifier(name)) { var valueDeclaration = resolver.getReferencedImportDeclaration(name) || resolver.getReferencedValueDeclaration(name); - if (valueDeclaration) return currentModuleInfo && currentModuleInfo.exportedBindings[ts1.getOriginalNodeId(valueDeclaration)]; + if (valueDeclaration) return currentModuleInfo && currentModuleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]; } } }, dynamicImportUMDHelper = { diff --git a/crates/swc_ecma_minifier/tests/fixture/next/feedback-2/codemirror/output.js b/crates/swc_ecma_minifier/tests/fixture/next/feedback-2/codemirror/output.js index 544f5c237149..802078d5349c 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/feedback-2/codemirror/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/next/feedback-2/codemirror/output.js @@ -3365,7 +3365,7 @@ return doc.scrollTop = this.scrollTop, doc.scrollLeft = this.scrollLeft, doc.sel = this.sel, doc.extend = !1, copyHistory && (doc.history.undoDepth = this.history.undoDepth, doc.setHistory(this.getHistory())), doc; }, linkedDoc: function(options) { - options || (options = {}); + options = {}; var from = this.first, to = this.first + this.size; null != options.from && options.from > from && (from = options.from), null != options.to && options.to < to && (to = options.to); var copy = new Doc(getLines(this, from, to), options.mode || this.modeOption, from, this.lineSep, this.direction); diff --git a/crates/swc_ecma_minifier/tests/fixture/next/react-ace/chunks/8a28b14e.d8fbda268ed281a1/output.js b/crates/swc_ecma_minifier/tests/fixture/next/react-ace/chunks/8a28b14e.d8fbda268ed281a1/output.js index d03c5ead9f3c..51d6ed54d7f4 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/react-ace/chunks/8a28b14e.d8fbda268ed281a1/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/next/react-ace/chunks/8a28b14e.d8fbda268ed281a1/output.js @@ -8632,7 +8632,7 @@ }, this.getLastSearchOptions = function() { return this.$search.getOptions(); }, this.find = function(needle, options, animate) { - options || (options = {}), "string" == typeof needle || needle instanceof RegExp ? options.needle = needle : "object" == typeof needle && oop.mixin(options, needle); + options = {}, "string" == typeof needle || needle instanceof RegExp ? options.needle = needle : "object" == typeof needle && oop.mixin(options, needle); var range = this.selection.getRange(); null == options.needle && ((needle = this.session.getTextRange(range) || this.$search.$options.needle) || (range = this.session.getWordRange(range.start.row, range.start.column), needle = this.session.getTextRange(range)), this.$search.set({ needle: needle diff --git a/crates/swc_ecma_minifier/tests/fixture/next/react-pdf-renderer/output.js b/crates/swc_ecma_minifier/tests/fixture/next/react-pdf-renderer/output.js index 7449e159f63d..99546e1ee948 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/react-pdf-renderer/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/next/react-pdf-renderer/output.js @@ -8442,7 +8442,7 @@ }), t; } function v(e, t) { - t || (t = {}), this.type = "default", this.status = void 0 === t.status ? 200 : t.status, this.ok = this.status >= 200 && this.status < 300, this.statusText = "statusText" in t ? t.statusText : "OK", this.headers = new l(t.headers), this.url = t.url || "", this._initBody(e); + t = {}, this.type = "default", this.status = void 0 === t.status ? 200 : t.status, this.ok = this.status >= 200 && this.status < 300, this.statusText = "statusText" in t ? t.statusText : "OK", this.headers = new l(t.headers), this.url = t.url || "", this._initBody(e); } y.prototype.clone = function() { return new y(this, { @@ -21710,7 +21710,7 @@ function i() {} e.exports = function e(t, r, o) { if ("function" == typeof r) return e(t, null, r); - r || (r = {}), a = o || i, u = !1, o = function() { + r = {}, a = o || i, u = !1, o = function() { if (!u) { u = !0; for(var e = arguments.length, t = Array(e), r = 0; r < e; r++)t[r] = arguments[r]; diff --git a/crates/swc_ecma_minifier/tests/fixture/next/syncfusion/933-e9f9a6bf671b96fc/output.js b/crates/swc_ecma_minifier/tests/fixture/next/syncfusion/933-e9f9a6bf671b96fc/output.js index 9d1538617621..154fe3f8d220 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/syncfusion/933-e9f9a6bf671b96fc/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/next/syncfusion/933-e9f9a6bf671b96fc/output.js @@ -2243,7 +2243,7 @@ 79930, 79960, 79990 - ], (HijriParser = HijriParser1 || (HijriParser1 = {})).getHijriDate = function(gDate) { + ], (HijriParser = HijriParser1 = {}).getHijriDate = function(gDate) { var day = gDate.getDate(), month = gDate.getMonth(), year = gDate.getFullYear(), tMonth = month + 1, tYear = year; tMonth < 3 && (tYear -= 1, tMonth += 12); var yPrefix = Math.floor(tYear / 100.), julilanOffset = yPrefix - Math.floor(yPrefix / 4.) - 2, julianNumber = Math.floor(365.25 * (tYear + 4716)) + Math.floor(30.6001 * (tMonth + 1)) + day - julilanOffset - 1524; @@ -3614,7 +3614,7 @@ } else weeknum = Math.floor((daynum + day - 1) / 7); return weeknum; }; - }(intl_base_IntlBase || (intl_base_IntlBase = {})); + }(intl_base_IntlBase = {}); var headerRegex = /^(.*?):[ \t]*([^\r\n]*)$/gm, Ajax = function() { function Ajax(options, type, async, contentType) { this.mode = !0, this.emitError = !0, this.options = {}, 'string' == typeof options ? (this.url = options, this.type = type ? type.toUpperCase() : 'GET', this.mode = !!util_isNullOrUndefined(async) || async) : 'object' == typeof options && (this.options = options, util_merge(this, this.options)), this.type = this.type ? this.type.toUpperCase() : 'GET', this.contentType = void 0 !== this.contentType ? this.contentType : contentType; @@ -6290,7 +6290,7 @@ } container.getElementsByClassName('e-input-group-icon')[0] && container.getElementsByClassName('e-float-text-overflow')[0] && container.getElementsByClassName('e-float-text-overflow')[0].classList.add('e-icon'); }, Input.prependSpan = prependSpan, Input.appendSpan = appendSpan, Input.validateInputType = validateInputType; - }(Input || (Input = {})); + }(Input = {}); }, 8801: function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -8007,7 +8007,7 @@ return RichTextEditorComponent; } }); - var extendStatics, extendStatics1, extendStatics2, extendStatics3, extendStatics4, extendStatics5, extendStatics6, extendStatics7, extendStatics8, extendStatics9, extendStatics10, extendStatics11, extendStatics12, extendStatics13, targetElement, selectedHandler, minHeight, maxHeight, minWidth, maxWidth, containerElement, resizeWestWidth, proxy, DialogUtility, react = __webpack_require__(7294), ej2_base = __webpack_require__(1807), popup = __webpack_require__(9486), constant = __webpack_require__(3386), classes = __webpack_require__(9805), base_enum = __webpack_require__(809), Render = function() { + var extendStatics, extendStatics1, extendStatics2, extendStatics3, extendStatics4, extendStatics5, extendStatics6, extendStatics7, extendStatics8, extendStatics9, extendStatics10, extendStatics11, extendStatics12, extendStatics13, targetElement, selectedHandler, minHeight, maxHeight, minWidth, maxWidth, containerElement, resizeWestWidth, proxy, react = __webpack_require__(7294), ej2_base = __webpack_require__(1807), popup = __webpack_require__(9486), constant = __webpack_require__(3386), classes = __webpack_require__(9805), base_enum = __webpack_require__(809), Render = function() { function Render(parent, locator) { this.parent = parent, this.locator = locator, this.renderer = this.locator.getService('rendererFactory'), this.addEventListener(); } @@ -10450,7 +10450,7 @@ args && args.close && args.close.apply(confirmDialogObj), confirmDialogObj.destroy(), confirmDialogObj.element.classList.contains('e-dlg-modal') ? (confirmDialogObj.element.parentElement.remove(), confirmDialogObj.target.classList.remove(DLG_UTIL_ROOT)) : confirmDialogObj.element.remove(); }, confirmDialogObj; }; - }(DialogUtility || (DialogUtility = {})); + }({}); var DialogRenderer = function() { function DialogRenderer(parent) { this.parent = parent, this.addEventListener(); @@ -24993,7 +24993,7 @@ y2: function() { return RenderType; } - }), (RenderType1 = RenderType || (RenderType = {}))[RenderType1.Toolbar = 0] = "Toolbar", RenderType1[RenderType1.Content = 1] = "Content", RenderType1[RenderType1.Popup = 2] = "Popup", RenderType1[RenderType1.LinkToolbar = 3] = "LinkToolbar", RenderType1[RenderType1.TextToolbar = 4] = "TextToolbar", RenderType1[RenderType1.ImageToolbar = 5] = "ImageToolbar", RenderType1[RenderType1.InlineToolbar = 6] = "InlineToolbar", RenderType1[RenderType1.TableToolbar = 7] = "TableToolbar", (ToolbarType1 = ToolbarType || (ToolbarType = {})).Expand = "Expand", ToolbarType1.MultiRow = "MultiRow", ToolbarType1.Scrollable = "Scrollable", (DialogType1 = DialogType || (DialogType = {})).InsertLink = "InsertLink", DialogType1.InsertImage = "InsertImage", DialogType1.InsertTable = "InsertTable"; + }), (RenderType1 = RenderType = {})[RenderType1.Toolbar = 0] = "Toolbar", RenderType1[RenderType1.Content = 1] = "Content", RenderType1[RenderType1.Popup = 2] = "Popup", RenderType1[RenderType1.LinkToolbar = 3] = "LinkToolbar", RenderType1[RenderType1.TextToolbar = 4] = "TextToolbar", RenderType1[RenderType1.ImageToolbar = 5] = "ImageToolbar", RenderType1[RenderType1.InlineToolbar = 6] = "InlineToolbar", RenderType1[RenderType1.TableToolbar = 7] = "TableToolbar", (ToolbarType1 = ToolbarType = {}).Expand = "Expand", ToolbarType1.MultiRow = "MultiRow", ToolbarType1.Scrollable = "Scrollable", (DialogType1 = DialogType = {}).InsertLink = "InsertLink", DialogType1.InsertImage = "InsertImage", DialogType1.InsertTable = "InsertTable"; }, 5932: function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; diff --git a/crates/swc_ecma_minifier/tests/fixture/next/wrap-contracts/output.js b/crates/swc_ecma_minifier/tests/fixture/next/wrap-contracts/output.js index e60d03232566..c3a8046dca8b 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/wrap-contracts/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/next/wrap-contracts/output.js @@ -10379,7 +10379,7 @@ }, EC.prototype.keyFromPublic = function(pub, enc) { return KeyPair.fromPublic(this, pub, enc); }, EC.prototype.genKeyPair = function(options) { - options || (options = {}); + options = {}; for(var drbg = new HmacDRBG({ hash: this.hash, pers: options.pers, @@ -15155,7 +15155,7 @@ var assignValue = __webpack_require__(4865), baseAssignValue = __webpack_require__(9465); function copyObject(source, props, object, customizer) { var isNew = !object; - object || (object = {}); + object = {}; for(var index = -1, length = props.length; ++index < length;){ var key = props[index], newValue = customizer ? customizer(object[key], source[key], key, object, source) : void 0; void 0 === newValue && (newValue = source[key]), isNew ? baseAssignValue(object, key, newValue) : assignValue(object, key, newValue); @@ -17054,7 +17054,7 @@ } function eos(e, t, r) { if ("function" == typeof t) return eos(e, null, t); - t || (t = {}), r = once(r || noop); + t = {}, r = once(r || noop); var i = t.readable || !1 !== t.readable && e.readable, a = t.writable || !1 !== t.writable && e.writable, o = function() { e.writable || f(); }, s = e._writableState && e._writableState.finished, f = function() { diff --git a/crates/swc_ecma_minifier/tests/fixture/projects/backbone/16/output.js b/crates/swc_ecma_minifier/tests/fixture/projects/backbone/16/output.js index ad62d847beb7..9e2d7099b7af 100644 --- a/crates/swc_ecma_minifier/tests/fixture/projects/backbone/16/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/projects/backbone/16/output.js @@ -1,9 +1,9 @@ export const obj = { remove: function(models, options) { var i, l, index, model, singular = !_.isArray(models); - for(models = singular ? [ + for(i = 0, models = singular ? [ models - ] : _.clone(models), options || (options = {}), i = 0, l = models.length; i < l; i++)(model = models[i] = this.get(models[i])) && (delete this._byId[model.id], delete this._byId[model.cid], index = this.indexOf(model), this.models.splice(index, 1), this.length--, options.silent || (options.index = index, model.trigger("remove", model, this, options)), this._removeReference(model)); + ] : _.clone(models), options = {}, l = models.length; i < l; i++)(model = models[i] = this.get(models[i])) && (delete this._byId[model.id], delete this._byId[model.cid], index = this.indexOf(model), this.models.splice(index, 1), this.length--, options.silent || (options.index = index, model.trigger("remove", model, this, options)), this._removeReference(model)); return singular ? models[0] : models; } }; diff --git a/crates/swc_ecma_minifier/tests/fixture/projects/underscore/8/output.js b/crates/swc_ecma_minifier/tests/fixture/projects/underscore/8/output.js index 8d477bd33caf..360b4a7c760e 100644 --- a/crates/swc_ecma_minifier/tests/fixture/projects/underscore/8/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/projects/underscore/8/output.js @@ -1,6 +1,6 @@ _.throttle = function(func, wait, options) { var context, args, result, timeout = null, previous = 0; - options || (options = {}); + options = {}; var later = function() { previous = !1 === options.leading ? 0 : new Date(), timeout = null, result = func.apply(context, args); }; diff --git a/crates/swc_ecma_minifier/tests/fixture/reduced/1/output.js b/crates/swc_ecma_minifier/tests/fixture/reduced/1/output.js index 102d35521d05..7be9bca55828 100644 --- a/crates/swc_ecma_minifier/tests/fixture/reduced/1/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/reduced/1/output.js @@ -1,4 +1,4 @@ -var A, B, A2; +var A, A2; ((A2 = A || (A = {})).Point || (A2.Point = {})).Origin = { x: 0, y: 0 @@ -18,4 +18,4 @@ var A, B, A2; x: 0, y: 0 }, B1.Point = Point1; -}(B || (B = {})); +}({}); diff --git a/crates/swc_ecma_minifier/tests/projects/output/backbone-1.1.0.js b/crates/swc_ecma_minifier/tests/projects/output/backbone-1.1.0.js index 84e273aaa6ce..38d1f2d01dd2 100644 --- a/crates/swc_ecma_minifier/tests/projects/output/backbone-1.1.0.js +++ b/crates/swc_ecma_minifier/tests/projects/output/backbone-1.1.0.js @@ -100,7 +100,7 @@ }), Events.bind = Events.on, Events.unbind = Events.off, _.extend(Backbone, Events); var Model = Backbone.Model = function(attributes, options) { var attrs = attributes || {}; - options || (options = {}), this.cid = _.uniqueId("c"), this.attributes = {}, options.collection && (this.collection = options.collection), options.parse && (attrs = this.parse(attrs, options) || {}), attrs = _.defaults({}, attrs, _.result(this, "defaults")), this.set(attrs, options), this.changed = {}, this.initialize.apply(this, arguments); + options = {}, this.cid = _.uniqueId("c"), this.attributes = {}, options.collection && (this.collection = options.collection), options.parse && (attrs = this.parse(attrs, options) || {}), attrs = _.defaults({}, attrs, _.result(this, "defaults")), this.set(attrs, options), this.changed = {}, this.initialize.apply(this, arguments); }; _.extend(Model.prototype, Events, { changed: null, @@ -238,7 +238,7 @@ }; }); var Collection = Backbone.Collection = function(models, options) { - options || (options = {}), options.model && (this.model = options.model), void 0 !== options.comparator && (this.comparator = options.comparator), this._reset(), this.initialize.apply(this, arguments), models && this.reset(models, _.extend({ + (options = {}).model && (this.model = options.model), void 0 !== options.comparator && (this.comparator = options.comparator), this._reset(), this.initialize.apply(this, arguments), models && this.reset(models, _.extend({ silent: !0 }, options)); }, setOptions = { @@ -267,9 +267,9 @@ }, remove: function(models, options) { var i, l, index, model, singular = !_.isArray(models); - for(models = singular ? [ + for(i = 0, models = singular ? [ models - ] : _.clone(models), options || (options = {}), i = 0, l = models.length; i < l; i++)(model = models[i] = this.get(models[i])) && (delete this._byId[model.id], delete this._byId[model.cid], index = this.indexOf(model), this.models.splice(index, 1), this.length--, options.silent || (options.index = index, model.trigger("remove", model, this, options)), this._removeReference(model)); + ] : _.clone(models), options = {}, l = models.length; i < l; i++)(model = models[i] = this.get(models[i])) && (delete this._byId[model.id], delete this._byId[model.cid], index = this.indexOf(model), this.models.splice(index, 1), this.length--, options.silent || (options.index = index, model.trigger("remove", model, this, options)), this._removeReference(model)); return singular ? models[0] : models; }, set: function(models, options) { @@ -308,7 +308,7 @@ return singular ? models[0] : models; }, reset: function(models, options) { - options || (options = {}); + options = {}; for(var i = 0, l = this.models.length; i < l; i++)this._removeReference(this.models[i]); return options.previousModels = this.models, this._reset(), models = this.add(models, _.extend({ silent: !0 @@ -352,7 +352,7 @@ }, sort: function(options) { if (!this.comparator) throw Error("Cannot sort a set without a comparator"); - return options || (options = {}), _.isString(this.comparator) || 1 === this.comparator.length ? this.models = this.sortBy(this.comparator, this) : this.models.sort(_.bind(this.comparator, this)), options.silent || this.trigger("sort", this, options), this; + return options = {}, _.isString(this.comparator) || 1 === this.comparator.length ? this.models = this.sortBy(this.comparator, this) : this.models.sort(_.bind(this.comparator, this)), options.silent || this.trigger("sort", this, options), this; }, pluck: function(attr) { return _.invoke(this.models, "get", attr); @@ -452,7 +452,7 @@ }; }); var View = Backbone.View = function(options) { - this.cid = _.uniqueId("view"), options || (options = {}), _.extend(this, _.pick(options, viewOptions)), this._ensureElement(), this.initialize.apply(this, arguments), this.delegateEvents(); + this.cid = _.uniqueId("view"), options = {}, _.extend(this, _.pick(options, viewOptions)), this._ensureElement(), this.initialize.apply(this, arguments), this.delegateEvents(); }, delegateEventSplitter = /^(\S+)\s*(.*)$/, viewOptions = [ "model", "collection", @@ -503,7 +503,7 @@ } }), Backbone.sync = function(method, model, options) { var type = methodMap[method]; - _.defaults(options || (options = {}), { + _.defaults(options = {}, { emulateHTTP: Backbone.emulateHTTP, emulateJSON: Backbone.emulateJSON }); @@ -537,7 +537,7 @@ return Backbone.$.ajax.apply(Backbone.$, arguments); }; var Router = Backbone.Router = function(options) { - options || (options = {}), options.routes && (this.routes = options.routes), this._bindRoutes(), this.initialize.apply(this, arguments); + (options = {}).routes && (this.routes = options.routes), this._bindRoutes(), this.initialize.apply(this, arguments); }, optionalParam = /\((.*?)\)/g, namedParam = /(\(\?)?:\w+/g, splatParam = /\*\w+/g, escapeRegExp = /[\-{}\[\]+?.,\\\^$|#\s]/g; _.extend(Router.prototype, Events, { initialize: function() {}, diff --git a/crates/swc_ecma_minifier/tests/projects/output/jquery-1.9.1.js b/crates/swc_ecma_minifier/tests/projects/output/jquery-1.9.1.js index 1e316265c317..e6783d6442ba 100644 --- a/crates/swc_ecma_minifier/tests/projects/output/jquery-1.9.1.js +++ b/crates/swc_ecma_minifier/tests/projects/output/jquery-1.9.1.js @@ -2359,7 +2359,7 @@ } function ajaxExtend(target, src) { var deep, key, flatOptions = jQuery.ajaxSettings.flatOptions || {}; - for(key in src)undefined !== src[key] && ((flatOptions[key] ? target : deep || (deep = {}))[key] = src[key]); + for(key in src)undefined !== src[key] && ((flatOptions[key] ? target : deep = {})[key] = src[key]); return deep && jQuery.extend(!0, target, deep), target; } ajaxLocParts = rurl.exec(ajaxLocation.toLowerCase()) || [], jQuery.fn.load = function(url, params, callback) { diff --git a/crates/swc_ecma_minifier/tests/projects/output/underscore-1.5.2.js b/crates/swc_ecma_minifier/tests/projects/output/underscore-1.5.2.js index d6c0e10b0751..cd3c52626ae9 100644 --- a/crates/swc_ecma_minifier/tests/projects/output/underscore-1.5.2.js +++ b/crates/swc_ecma_minifier/tests/projects/output/underscore-1.5.2.js @@ -277,7 +277,7 @@ ].concat(slice.call(arguments, 1))); }, _.throttle = function(func, wait, options) { var context, args, result, timeout = null, previous = 0; - options || (options = {}); + options = {}; var later = function() { previous = !1 === options.leading ? 0 : new Date(), timeout = null, result = func.apply(context, args); }; diff --git a/crates/swc_ecma_minifier/tests/projects/output/yui-3.12.0.js b/crates/swc_ecma_minifier/tests/projects/output/yui-3.12.0.js index 99c141004f15..5d8188a78a86 100644 --- a/crates/swc_ecma_minifier/tests/projects/output/yui-3.12.0.js +++ b/crates/swc_ecma_minifier/tests/projects/output/yui-3.12.0.js @@ -438,7 +438,7 @@ var YUI = function() { }, Y.Queue = Queue, YUI.Env._loaderQueue = YUI.Env._loaderQueue || new Queue(); var hasOwn = Object.prototype.hasOwnProperty, isObject = Y.Lang.isObject; Y.cached = function(source, cache, refetch) { - return cache || (cache = {}), function(arg) { + return cache = {}, function(arg) { var key = arguments.length > 1 ? Array.prototype.join.call(arguments, "__") : String(arg); return key in cache && (!refetch || cache[key] != refetch) || (cache[key] = source.apply(source, arguments)), cache[key]; }; From bfad1249d31d312aaeecda69960a6383a6736599 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EB=8F=99=EC=9C=A4=20=28Donny=29?= Date: Tue, 28 May 2024 23:42:26 +0900 Subject: [PATCH 7/9] Add a test --- .../tests/fixture/issues/ts-enum/multi-enum/input.js | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 crates/swc_ecma_minifier/tests/fixture/issues/ts-enum/multi-enum/input.js diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/ts-enum/multi-enum/input.js b/crates/swc_ecma_minifier/tests/fixture/issues/ts-enum/multi-enum/input.js new file mode 100644 index 000000000000..e534c427b91c --- /dev/null +++ b/crates/swc_ecma_minifier/tests/fixture/issues/ts-enum/multi-enum/input.js @@ -0,0 +1,7 @@ +var Foo; +(function (Foo) { + Foo[Foo["a"] = 1] = "a"; +})(Foo || (Foo = {})); +(function (Foo) { + Foo[Foo["b"] = 2] = "b"; +})(Foo || (Foo = {})); From fa7e2fa428a03dbc9ed6205d59222ed85f26632f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EB=8F=99=EC=9C=A4=20=28Donny=29?= Date: Tue, 28 May 2024 23:42:42 +0900 Subject: [PATCH 8/9] fixup --- .../tests/fixture/issues/ts-enum/multi-enum/input.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/ts-enum/multi-enum/input.js b/crates/swc_ecma_minifier/tests/fixture/issues/ts-enum/multi-enum/input.js index e534c427b91c..b46b15195624 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/ts-enum/multi-enum/input.js +++ b/crates/swc_ecma_minifier/tests/fixture/issues/ts-enum/multi-enum/input.js @@ -5,3 +5,5 @@ var Foo; (function (Foo) { Foo[Foo["b"] = 2] = "b"; })(Foo || (Foo = {})); + +export { Foo } \ No newline at end of file From 155682218fc415fe2136ddf4f4890e6245b051c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EB=8F=99=EC=9C=A4=20=28Donny=29?= Date: Tue, 28 May 2024 23:43:22 +0900 Subject: [PATCH 9/9] Update test refs. --- .../tests/fixture/issues/ts-enum/multi-enum/output.js | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 crates/swc_ecma_minifier/tests/fixture/issues/ts-enum/multi-enum/output.js diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/ts-enum/multi-enum/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/ts-enum/multi-enum/output.js new file mode 100644 index 000000000000..888ec0967ff3 --- /dev/null +++ b/crates/swc_ecma_minifier/tests/fixture/issues/ts-enum/multi-enum/output.js @@ -0,0 +1,3 @@ +var Foo, Foo1, Foo2; +(Foo1 = Foo || (Foo = {}))[Foo1.a = 1] = "a", (Foo2 = Foo || (Foo = {}))[Foo2.b = 2] = "b"; +export { Foo };