From 676f8522a62f8755d65a09aabe7b0541cdb58c2c Mon Sep 17 00:00:00 2001 From: austaras Date: Thu, 10 Nov 2022 22:58:55 +0800 Subject: [PATCH] chore(es/utils): More uniqure name for alias --- .../codegen/comment-1/es5/output/index.tsx | 2 +- .../issues-1xxx/1107/1/output/index.js | 4 +- .../issues-1xxx/1333/case2/output/index.js | 8 +- .../issues-1xxx/1333/case3/output/index.js | 8 +- .../issues-1xxx/1449/case1/output/index.js | 4 +- .../issues-1xxx/1477/case1/output/index.js | 4 +- .../pr-1524/comment-1/output/index.tsx | 2 +- .../fixture/issues-2xxx/2063/output/index.js | 4 +- .../fixture/issues-2xxx/2139/output/index.tsx | 6 +- .../issues-2xxx/2232/case1/output/index.js | 4 +- .../issues-2xxx/2232/case2/output/index.ts | 4 +- .../fixture/issues-2xxx/2336/output/input.tsx | 8 +- .../issues-2xxx/2854/1/output/index.js | 2 +- .../issues-2xxx/2858/1/output/index.js | 8 +- .../issues-2xxx/2858/2/output/index.js | 8 +- .../issues-4xxx/4108/1/output/index.ts | 8 +- .../fixture/issues-5xxx/5102/output/index.js | 22 +- .../shared/lib/router/1/output/index.ts | 14 +- .../tests/fixture/shopify/002/output/index.js | 2 +- .../fixture/shopify/003-env/output/index.js | 2 +- .../fixture/shopify/004-jest/output/index.js | 2 +- .../shopify/005-no-module/output/index.js | 2 +- .../tsc-references/ES5For-of26.1.normal.js | 2 +- .../tsc-references/ES5For-of26.2.minified.js | 4 +- .../tsc-references/ES5For-of27.1.normal.js | 2 +- .../tsc-references/ES5For-of27.2.minified.js | 4 +- .../tsc-references/ES5For-of28.1.normal.js | 2 +- .../tsc-references/ES5For-of28.2.minified.js | 4 +- .../tsc-references/ES5For-of29.1.normal.js | 2 +- .../tsc-references/ES5For-of29.2.minified.js | 4 +- .../tsc-references/ES5For-of35.1.normal.js | 2 +- .../tsc-references/ES5For-of35.2.minified.js | 4 +- .../tsc-references/ES5For-of36.1.normal.js | 2 +- .../tsc-references/ES5For-of36.2.minified.js | 4 +- ...mentExpressionContextualTyping.1.normal.js | 6 +- ...ntExpressionContextualTyping.2.minified.js | 4 +- .../arrayLiterals2ES5.1.normal.js | 4 +- .../arrayLiterals2ES5.2.minified.js | 4 +- .../tsc-references/arrayLiterals3.1.normal.js | 4 +- .../arrayLiterals3.2.minified.js | 4 +- .../arrowFunctionExpressions.1.normal.js | 8 +- .../tsc-references/callChain.1.normal.js | 30 +-- .../tsc-references/callChain.2.1.normal.js | 4 +- .../tsc-references/callChain.2.2.minified.js | 4 +- .../tsc-references/callChain.2.minified.js | 16 +- .../tsc-references/callChain.3.1.normal.js | 12 +- .../tsc-references/callChain.3.2.minified.js | 12 +- ...lChainWithSuper(target=es2015).1.normal.js | 8 +- ...lChainWithSuper(target=es2016).1.normal.js | 8 +- ...lChainWithSuper(target=es2017).1.normal.js | 8 +- ...lChainWithSuper(target=es2018).1.normal.js | 8 +- ...lChainWithSuper(target=es2019).1.normal.js | 8 +- ...callChainWithSuper(target=es5).1.normal.js | 8 +- .../tsc-references/callWithSpread.1.normal.js | 28 +-- .../callWithSpread.2.minified.js | 24 +- ...checkJsxChildrenCanBeTupleType.1.normal.js | 4 +- ...xSubtleSkipContextSensitiveBug.1.normal.js | 4 +- .../circularImportAlias.1.normal.js | 4 +- .../circularImportAlias.2.minified.js | 4 +- .../classExtendingClassLikeType.1.normal.js | 20 +- .../classExtendingNonConstructor.1.normal.js | 4 +- .../classExtendsItselfIndirectly2.1.normal.js | 16 +- ...lassExtendsItselfIndirectly2.2.minified.js | 16 +- .../computedPropertyNames24_ES5.1.normal.js | 4 +- .../computedPropertyNames24_ES6.1.normal.js | 4 +- .../computedPropertyNames26_ES5.1.normal.js | 4 +- .../computedPropertyNames26_ES6.1.normal.js | 4 +- .../computedPropertyNames27_ES5.1.normal.js | 4 +- .../computedPropertyNames27_ES6.1.normal.js | 4 +- ...xtuallyTypedBindingInitializer.1.normal.js | 18 +- ...ypedBindingInitializerNegative.1.normal.js | 10 +- .../contextuallyTypedIife.1.normal.js | 10 +- .../contextuallyTypedIife.2.minified.js | 8 +- .../contextuallyTypedIifeStrict.1.normal.js | 10 +- .../contextuallyTypedIifeStrict.2.minified.js | 8 +- ...olFlowDestructuringDeclaration.1.normal.js | 18 +- .../controlFlowOptionalChain.1.normal.js | 48 ++-- .../controlFlowOptionalChain.2.minified.js | 4 +- .../declarationsAndAssignments.1.normal.js | 80 +++---- .../declarationsAndAssignments.2.minified.js | 4 +- .../defineProperty(target=es5).1.normal.js | 4 +- .../tsc-references/deleteChain.1.normal.js | 20 +- .../tsc-references/deleteChain.2.minified.js | 4 +- .../derivedClassSuperProperties.1.normal.js | 8 +- ...indingPatternAndAssignment1ES5.1.normal.js | 14 +- ...dingPatternAndAssignment1ES5.2.minified.js | 8 +- ...tternAndAssignment1ES5iterable.1.normal.js | 14 +- ...ernAndAssignment1ES5iterable.2.minified.js | 8 +- ...ayBindingPatternAndAssignment2.1.normal.js | 14 +- ...BindingPatternAndAssignment2.2.minified.js | 24 +- ...ayBindingPatternAndAssignment3.1.normal.js | 12 +- ...estructuringAssignabilityCheck.1.normal.js | 6 +- ...tructuringAssignabilityCheck.2.minified.js | 2 +- .../destructuringCatch.1.normal.js | 2 +- .../destructuringCatch.2.minified.js | 4 +- .../destructuringControlFlow.1.normal.js | 4 +- ...EvaluationOrder(target=es2015).1.normal.js | 4 +- ...aluationOrder(target=es2015).2.minified.js | 4 +- ...ingEvaluationOrder(target=es5).1.normal.js | 12 +- ...gEvaluationOrder(target=es5).2.minified.js | 10 +- ...indingPatternAndAssignment1ES5.1.normal.js | 24 +- ...ctBindingPatternAndAssignment4.1.normal.js | 4 +- ...BindingPatternAndAssignment4.2.minified.js | 2 +- ...ternAndAssignment6(target=es5).1.normal.js | 4 +- ...rnAndAssignment6(target=es5).2.minified.js | 4 +- ...ternAndAssignment7(target=es5).1.normal.js | 4 +- ...rnAndAssignment7(target=es5).2.minified.js | 4 +- ...ternAndAssignment8(target=es5).1.normal.js | 4 +- ...rnAndAssignment8(target=es5).2.minified.js | 4 +- ...rameterDeclaration3ES5iterable.1.normal.js | 4 +- ...meterDeclaration3ES5iterable.2.minified.js | 8 +- ...ructuringParameterDeclaration8.1.normal.js | 2 +- .../destructuringSpread.1.normal.js | 8 +- .../destructuringSpread.2.minified.js | 8 +- ...cturingVariableDeclaration1ES5.1.normal.js | 36 +-- ...uringVariableDeclaration1ES5.2.minified.js | 22 +- ...ariableDeclaration1ES5iterable.1.normal.js | 36 +-- ...iableDeclaration1ES5iterable.2.minified.js | 22 +- ...tructuringVariableDeclaration2.1.normal.js | 14 +- ...ucturingVariableDeclaration2.2.minified.js | 10 +- ...cturingWithLiteralInitializers.1.normal.js | 28 +-- ...uringWithLiteralInitializers.2.minified.js | 30 +-- ...turingWithLiteralInitializers2.1.normal.js | 50 ++-- .../elementAccessChain.1.normal.js | 20 +- .../elementAccessChain.2.1.normal.js | 6 +- .../elementAccessChain.2.2.minified.js | 4 +- .../elementAccessChain.2.minified.js | 4 +- ...owFunctionWhenUsingArguments18.1.normal.js | 4 +- ...ropertyAccessInHeritageClause1.1.normal.js | 4 +- ...ArrayBindingPatternParameter04.1.normal.js | 2 +- .../emptyAssignmentPatterns01_ES5.1.normal.js | 2 +- ...bjectBindingPatternParameter04.1.normal.js | 4 +- ...clarationBindingPatterns01_ES5.1.normal.js | 24 +- ...arationBindingPatterns01_ES5.2.minified.js | 14 +- ...nBindingPatterns01_ES5iterable.1.normal.js | 24 +- ...indingPatterns01_ES5iterable.2.minified.js | 14 +- .../exhaustiveSwitchStatements1.1.normal.js | 4 +- .../tests/tsc-references/for-of30.1.normal.js | 4 +- .../tsc-references/for-of30.2.minified.js | 4 +- ...nericClassExpressionInFunction.1.normal.js | 4 +- ...ricClassExpressionInFunction.2.minified.js | 4 +- .../inferFromBindingPattern.1.normal.js | 12 +- .../inferFromBindingPattern.2.minified.js | 4 +- ...MemberWithComputedPropertyName.1.normal.js | 4 +- ...rfaceExtendsObjectIntersection.1.normal.js | 44 ++-- ...xtendsObjectIntersectionErrors.1.normal.js | 20 +- ...DeclarationsReexportedCjsAlias.1.normal.js | 2 +- ...clarationsReexportedCjsAlias.2.minified.js | 2 +- .../jsDeclarationsTypeReferences2.1.normal.js | 2 +- ...sDeclarationsTypeReferences2.2.minified.js | 2 +- ...defPropertyAndExportAssignment.1.normal.js | 2 +- ...fPropertyAndExportAssignment.2.minified.js | 4 +- .../tsc-references/literalTypes2.1.normal.js | 8 +- .../literalTypesAndDestructuring.1.normal.js | 14 +- .../literalTypesAndTypeAssertions.1.normal.js | 16 +- ...calAssignment10(target=es2015).1.normal.js | 10 +- ...lAssignment10(target=es2015).2.minified.js | 6 +- ...calAssignment10(target=es2020).1.normal.js | 6 +- ...lAssignment10(target=es2020).2.minified.js | 6 +- ...icalAssignment2(target=es2015).1.normal.js | 22 +- ...alAssignment2(target=es2015).2.minified.js | 4 +- ...icalAssignment2(target=es2020).1.normal.js | 14 +- ...alAssignment2(target=es2020).2.minified.js | 4 +- ...icalAssignment8(target=es2015).1.normal.js | 12 +- .../missingAndExcessProperties.1.normal.js | 16 +- .../mixinAccessModifiers.1.normal.js | 24 +- .../mixinAccessModifiers.2.minified.js | 12 +- .../nestedDestructuringOfRequire.1.normal.js | 2 +- .../nullishCoalescingOperator1.1.normal.js | 4 +- .../nullishCoalescingOperator10.1.normal.js | 4 +- .../nullishCoalescingOperator12.1.normal.js | 4 +- .../nullishCoalescingOperator12.2.minified.js | 4 +- .../nullishCoalescingOperator3.1.normal.js | 4 +- .../nullishCoalescingOperator8.1.normal.js | 12 +- .../nullishCoalescingOperator8.2.minified.js | 4 +- ...nAsyncGenerator(target=es2015).1.normal.js | 4 +- ...orInAsyncGenerator(target=es5).1.normal.js | 4 +- ...rBindingPattern(target=es2015).1.normal.js | 4 +- ...eterBindingPattern(target=es5).1.normal.js | 4 +- ...indingPattern.2(target=es2015).1.normal.js | 8 +- ...erBindingPattern.2(target=es5).1.normal.js | 8 +- ...BindingPattern.2(target=es5).2.minified.js | 6 +- ...eterInitializer(target=es2015).1.normal.js | 4 +- ...rameterInitializer(target=es5).1.normal.js | 4 +- ...erInitializer.2(target=es2015).1.normal.js | 8 +- ...meterInitializer.2(target=es5).1.normal.js | 8 +- ...ingPatternKeywordIdentifiers06.1.normal.js | 4 +- .../objectRestForOf.1.normal.js | 6 +- .../objectRestForOf.2.minified.js | 6 +- .../objectRestParameterES5.1.normal.js | 4 +- .../optionalBindingParameters3.1.normal.js | 2 +- .../optionalChainingInLoop.1.normal.js | 4 +- .../optionalChainingInLoop.2.minified.js | 4 +- ...rBindingPattern(target=es2015).1.normal.js | 4 +- ...eterBindingPattern(target=es5).1.normal.js | 4 +- ...indingPattern.2(target=es2015).1.normal.js | 6 +- ...erBindingPattern.2(target=es5).1.normal.js | 6 +- ...BindingPattern.2(target=es5).2.minified.js | 6 +- ...eterInitializer(target=es2015).1.normal.js | 4 +- ...rameterInitializer(target=es5).1.normal.js | 4 +- ...meterInitializer(target=es5).2.minified.js | 4 +- ...erInitializer.2(target=es2015).1.normal.js | 6 +- ...meterInitializer.2(target=es5).1.normal.js | 6 +- ...terInitializer.2(target=es5).2.minified.js | 6 +- ...nTypeAssertions(target=es2015).1.normal.js | 10 +- ...ypeAssertions(target=es2015).2.minified.js | 4 +- ...ackwardReferencing(target=es5).1.normal.js | 4 +- ...rwardReferencing.2(target=es5).1.normal.js | 2 +- .../parserES5ForOfStatement11.1.normal.js | 2 +- .../parserES5ForOfStatement11.2.minified.js | 4 +- .../parserES5ForOfStatement12.1.normal.js | 2 +- .../parserES5ForOfStatement12.2.minified.js | 4 +- .../parserES5ForOfStatement13.1.normal.js | 2 +- .../parserES5ForOfStatement13.2.minified.js | 4 +- .../parserES5ForOfStatement14.1.normal.js | 2 +- .../parserES5ForOfStatement14.2.minified.js | 4 +- .../parserES5ForOfStatement15.1.normal.js | 2 +- .../parserES5ForOfStatement15.2.minified.js | 4 +- .../parserES5ForOfStatement16.1.normal.js | 2 +- .../parserES5ForOfStatement16.2.minified.js | 4 +- .../parserES5SymbolProperty6.1.normal.js | 4 +- .../parserSymbolProperty6.1.normal.js | 4 +- ...ateNameAccessorsCallExpression.1.normal.js | 4 +- ...edPropertyName2(target=es2015).1.normal.js | 4 +- ...edPropertyName3(target=es2015).1.normal.js | 4 +- ...PropertyName3(target=es2015).2.minified.js | 4 +- .../privateNameFieldAssignment.1.normal.js | 26 +- ...privateNameFieldCallExpression.1.normal.js | 8 +- .../privateNameFieldUnaryMutation.1.normal.js | 10 +- ...ateNameInLhsReceiverExpression.1.normal.js | 6 +- ...rivateNameMethodCallExpression.1.normal.js | 10 +- ...ivateNameStaticFieldAssignment.1.normal.js | 26 +- ...eNameStaticFieldCallExpression.1.normal.js | 4 +- ...sAreNotAccessibleDestructuring.1.normal.js | 8 +- ...reNotAccessibleDestructuring.2.minified.js | 4 +- .../propertyAccessChain.1.normal.js | 10 +- .../propertyAccessChain.2.1.normal.js | 4 +- .../propertyAccessChain.2.2.minified.js | 4 +- .../propertyAccessChain.2.minified.js | 4 +- .../reexportClassDefinition.1.normal.js | 4 +- ...restElementWithBindingPattern2.1.normal.js | 4 +- ...restElementWithNullInitializer.1.normal.js | 8 +- ...dContextualTypedBindingPattern.1.normal.js | 2 +- ...ontextualTypedBindingPattern.2.minified.js | 4 +- .../superMethodCall.1.normal.js | 8 +- .../symbolDeclarationEmit11.1.normal.js | 10 +- .../symbolDeclarationEmit11.2.minified.js | 8 +- .../symbolDeclarationEmit2.1.normal.js | 4 +- .../symbolProperty6.1.normal.js | 8 +- .../symbolProperty7.1.normal.js | 8 +- .../thisInInvalidContexts.1.normal.js | 4 +- .../tsc-references/thisMethodCall.1.normal.js | 4 +- ...rectlyParseLessThanComparison1.1.normal.js | 4 +- ...ctlyParseLessThanComparison1.2.minified.js | 4 +- .../tsxDynamicTagName5.1.normal.js | 4 +- .../tsxDynamicTagName5.2.minified.js | 4 +- .../tsxDynamicTagName7.1.normal.js | 4 +- .../tsxDynamicTagName7.2.minified.js | 4 +- .../tsxDynamicTagName8.1.normal.js | 4 +- .../tsxDynamicTagName8.2.minified.js | 4 +- .../tsxDynamicTagName9.1.normal.js | 4 +- .../tsxDynamicTagName9.2.minified.js | 4 +- .../tsxExternalModuleEmit1.1.normal.js | 8 +- .../tsxExternalModuleEmit1.2.minified.js | 8 +- ...sxSpreadAttributesResolution17.1.normal.js | 4 +- ...SpreadAttributesResolution17.2.minified.js | 4 +- .../tupleElementTypes1.1.normal.js | 4 +- .../tupleElementTypes1.2.minified.js | 4 +- .../tupleElementTypes3.1.normal.js | 4 +- .../tupleElementTypes3.2.minified.js | 4 +- .../tupleElementTypes4.1.normal.js | 4 +- .../typeFromPropertyAssignment25.1.normal.js | 4 +- ...typeFromPropertyAssignment25.2.minified.js | 4 +- .../typeFromPropertyAssignment26.1.normal.js | 4 +- ...omPropertyAssignmentOutOfOrder.1.normal.js | 8 +- ...PropertyAssignmentOutOfOrder.2.minified.js | 8 +- ...StaticMembers12(target=es2015).1.normal.js | 8 +- ...aticMembers12(target=es2015).2.minified.js | 8 +- ...sInStaticMembers12(target=es5).1.normal.js | 8 +- ...nStaticMembers12(target=es5).2.minified.js | 8 +- ...StaticMembers13(target=es2015).1.normal.js | 8 +- ...aticMembers13(target=es2015).2.minified.js | 8 +- ...sInStaticMembers13(target=es5).1.normal.js | 8 +- ...nStaticMembers13(target=es5).2.minified.js | 8 +- ...mberNarrowedWithLoopAntecedent.1.normal.js | 4 +- .../unionTypeReduction2.1.normal.js | 4 +- .../wideningTuples5.1.normal.js | 4 +- .../wideningTuples5.2.minified.js | 4 +- .../wideningTuples6.1.normal.js | 4 +- .../wideningTuples6.2.minified.js | 4 +- .../vercel/loader-only/2/output/index.js | 6 +- .../next-39460/output/snippetSession.js | 12 +- .../react-autowhatever/1/output/index.js | 2 +- .../react-instantsearch/1/output/index.js | 14 +- .../tests/es2015_function_name.rs | 4 +- .../src/es2015/mod.rs | 4 +- .../src/es2018/object_rest_spread.rs | 2 +- .../mod.rs => nullish_coalescing.rs} | 3 - .../src/es2020/opt_chaining.rs | 9 +- .../tests/es2015_classes.rs | 24 +- .../tests/es2015_destructuring.rs | 175 +++++++------- .../tests/es2015_parameters.rs | 32 +-- .../tests/es2015_spread.rs | 16 +- .../tests/es2017_async_to_generator.rs | 6 +- .../tests/es2018_object_rest_spread.rs | 41 ++-- .../es2020_nullish_coalescing.rs} | 29 ++- .../tests/es2020_optional_chaining.rs | 225 ++++++++---------- .../tests/es2022_class_properties.rs | 84 +++---- .../tests/strip.rs | 22 +- crates/swc_ecma_utils/src/lib.rs | 53 ++++- .../pass/issue-1138/example-1/output/entry.js | 2 +- .../pass/issue-1138/example-2/output/entry.js | 2 +- 312 files changed, 1532 insertions(+), 1519 deletions(-) rename crates/swc_ecma_transforms_compat/src/es2020/{nullish_coalescing/mod.rs => nullish_coalescing.rs} (99%) rename crates/swc_ecma_transforms_compat/{src/es2020/nullish_coalescing/tests.rs => tests/es2020_nullish_coalescing.rs} (77%) diff --git a/crates/swc/tests/fixture/codegen/comment-1/es5/output/index.tsx b/crates/swc/tests/fixture/codegen/comment-1/es5/output/index.tsx index 23ef66766745..0e96d05a8b45 100644 --- a/crates/swc/tests/fixture/codegen/comment-1/es5/output/index.tsx +++ b/crates/swc/tests/fixture/codegen/comment-1/es5/output/index.tsx @@ -1,6 +1,6 @@ import _to_consumable_array from "@swc/helpers/src/_to_consumable_array.mjs"; function a(param) { - var _b = param.b, b = _b === void 0 ? [] : _b; + var _param_b = param.b, b = _param_b === void 0 ? [] : _param_b; var t = useMemo(function() { return(// Cmt1 _to_consumable_array(a.slice(0, 1)).concat(// Cmt2 diff --git a/crates/swc/tests/fixture/issues-1xxx/1107/1/output/index.js b/crates/swc/tests/fixture/issues-1xxx/1107/1/output/index.js index 0bcf7f755c87..4364638b4ce2 100644 --- a/crates/swc/tests/fixture/issues-1xxx/1107/1/output/index.js +++ b/crates/swc/tests/fixture/issues-1xxx/1107/1/output/index.js @@ -1,13 +1,13 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; export var Class1 = function Class1(param) { "use strict"; - var _name = param.name, name = _name === void 0 ? "" : _name; + var _param_name = param.name, name = _param_name === void 0 ? "" : _param_name; _class_call_check(this, Class1); console.log(name); }; export var Class2 = function Class2(param) { "use strict"; - var _name = param.name, name = _name === void 0 ? "" : _name; + var _param_name = param.name, name = _param_name === void 0 ? "" : _param_name; _class_call_check(this, Class2); console.log(name); }; diff --git a/crates/swc/tests/fixture/issues-1xxx/1333/case2/output/index.js b/crates/swc/tests/fixture/issues-1xxx/1333/case2/output/index.js index c016b7402a46..e73093f00353 100644 --- a/crates/swc/tests/fixture/issues-1xxx/1333/case2/output/index.js +++ b/crates/swc/tests/fixture/issues-1xxx/1333/case2/output/index.js @@ -271,9 +271,9 @@ class Shard extends _utils.Emitter { * Called whenever the websocket opens. * @private */ _open() { - var ref; + var _class_private_field_get; this.status = _utils.Status.HANDSHAKING; - this._debug(`Connected. ${(ref = _classPrivateFieldGet(this, _ws1)) === null || ref === void 0 ? void 0 : ref.url} in ${Date.now() - this.connectedAt}`); + this._debug(`Connected. ${(_class_private_field_get = _classPrivateFieldGet(this, _ws1)) === null || _class_private_field_get === void 0 ? void 0 : _class_private_field_get.url} in ${Date.now() - this.connectedAt}`); if (_classPrivateFieldGet(this, _queue).length) { this._debug(`${_classPrivateFieldGet(this, _queue).length} packets waiting... sending all now.`); while(_classPrivateFieldGet(this, _queue).length){ @@ -300,8 +300,8 @@ class Shard extends _utils.Emitter { * @param {WebSocket.CloseEvent} evt * @private */ _close(evt) { - var ref; - const reason = (ref = evt.reason || _utils.GatewayCloseCode[evt.code]) !== null && ref !== void 0 ? ref : "unknown"; + var _ref; + const reason = (_ref = evt.reason || _utils.GatewayCloseCode[evt.code]) !== null && _ref !== void 0 ? _ref : "unknown"; this._debug(`Closed; Code = ${evt.code}, Clean? = ${evt.wasClean}, Reason = ${reason}`); if (_classPrivateFieldGet(this, _seq) !== -1) { _classPrivateFieldSet(this, _closingSeq, _classPrivateFieldGet(this, _seq)); diff --git a/crates/swc/tests/fixture/issues-1xxx/1333/case3/output/index.js b/crates/swc/tests/fixture/issues-1xxx/1333/case3/output/index.js index 4eb315835028..8a62b13def1a 100644 --- a/crates/swc/tests/fixture/issues-1xxx/1333/case3/output/index.js +++ b/crates/swc/tests/fixture/issues-1xxx/1333/case3/output/index.js @@ -59,8 +59,8 @@ class RequestHandler { ].includes(p) ? match : `/${p}/:id`).replace(/\/reactions\/[^/]+/g, "/reactions/:id").replace(/\/webhooks\/(\d+)\/[\w-]{64,}/, "webhooks/$1/:token").replace(/\?.*$/, ""); let ending = ";"; if (method === "delete" && route.endsWith("/message/:id")) { - var ref; - const id = (ref = /\d{16,19}$/.exec(route)) === null || ref === void 0 ? void 0 : ref[0]; + var _exec; + const id = (_exec = /\d{16,19}$/.exec(route)) === null || _exec === void 0 ? void 0 : _exec[0]; const snowflake = _utils.Snowflake.deconstruct(id); if (Date.now() - snowflake.timestamp > 1000 * 60 * 60 * 24 * 14) { ending += "deletes-old"; @@ -73,8 +73,8 @@ class RequestHandler { * @param {Response} res * @return {* | Promise} */ static async parseResponse(res) { - var ref; - if ((ref = res.headers.get("Content-Type")) === null || ref === void 0 ? void 0 : ref.startsWith("application/json")) { + var _res_headers_get; + if ((_res_headers_get = res.headers.get("Content-Type")) === null || _res_headers_get === void 0 ? void 0 : _res_headers_get.startsWith("application/json")) { return await res.json(); } return res.buffer(); diff --git a/crates/swc/tests/fixture/issues-1xxx/1449/case1/output/index.js b/crates/swc/tests/fixture/issues-1xxx/1449/case1/output/index.js index 7c4a08ab9e6f..5076a66a0d21 100644 --- a/crates/swc/tests/fixture/issues-1xxx/1449/case1/output/index.js +++ b/crates/swc/tests/fixture/issues-1xxx/1449/case1/output/index.js @@ -6,9 +6,9 @@ function foo() { } function _foo() { _foo = _async_to_generator(function() { - var tmp, ref, ref; + var tmp, _ref, _ref; return _ts_generator(this, function(_state) { - tmp = baz.bar, ref = tmp === void 0 ? {} : tmp, ref = ref !== null ? ref : _throw(new TypeError("Cannot destructure undefined")); + tmp = baz.bar, _ref = tmp === void 0 ? {} : tmp, _ref = _ref !== null ? _ref : _throw(new TypeError("Cannot destructure undefined")); return [ 2 ]; diff --git a/crates/swc/tests/fixture/issues-1xxx/1477/case1/output/index.js b/crates/swc/tests/fixture/issues-1xxx/1477/case1/output/index.js index 912c41294696..a9a3bdc4c7a4 100644 --- a/crates/swc/tests/fixture/issues-1xxx/1477/case1/output/index.js +++ b/crates/swc/tests/fixture/issues-1xxx/1477/case1/output/index.js @@ -6,9 +6,9 @@ function f(a, b) { } function _f() { _f = _async_to_generator(function(a, b) { - var ref, ref1, tmp, a_; + var _JSON_parse, _JSON_parse_, tmp, a_; return _ts_generator(this, function(_state) { - ref = _sliced_to_array(JSON.parse(b), 1), ref1 = ref[0], tmp = ref1.a, a_ = tmp === void 0 ? 1 : tmp; + _JSON_parse = _sliced_to_array(JSON.parse(b), 1), _JSON_parse_ = _JSON_parse[0], tmp = _JSON_parse_.a, a_ = tmp === void 0 ? 1 : tmp; return [ 2 ]; diff --git a/crates/swc/tests/fixture/issues-1xxx/pr-1524/comment-1/output/index.tsx b/crates/swc/tests/fixture/issues-1xxx/pr-1524/comment-1/output/index.tsx index d33078781ac0..12d3bc181cd1 100644 --- a/crates/swc/tests/fixture/issues-1xxx/pr-1524/comment-1/output/index.tsx +++ b/crates/swc/tests/fixture/issues-1xxx/pr-1524/comment-1/output/index.tsx @@ -1,6 +1,6 @@ import _sliced_to_array from "@swc/helpers/src/_sliced_to_array.mjs"; function Bar() { - var ref = _sliced_to_array(useState(0), 2), foo = ref[0], setFoo = ref[1]; + var _useState = _sliced_to_array(useState(0), 2), foo = _useState[0], setFoo = _useState[1]; // @refresh reset React.useEffect(function() {}); return /*#__PURE__*/ React.createElement("h1", null, foo, " "); diff --git a/crates/swc/tests/fixture/issues-2xxx/2063/output/index.js b/crates/swc/tests/fixture/issues-2xxx/2063/output/index.js index a95d615614c7..da143ae30e31 100644 --- a/crates/swc/tests/fixture/issues-2xxx/2063/output/index.js +++ b/crates/swc/tests/fixture/issues-2xxx/2063/output/index.js @@ -1,7 +1,7 @@ -var _value, ref; +var _myVar_target_value, _myVar_target_value_toLowerCase; var myVar = { target: { value: "ABC" } }; -console.log((ref = (_value = myVar.target.value).toLowerCase) === null || ref === void 0 ? void 0 : ref.call(_value)); +console.log((_myVar_target_value_toLowerCase = (_myVar_target_value = myVar.target.value).toLowerCase) === null || _myVar_target_value_toLowerCase === void 0 ? void 0 : _myVar_target_value_toLowerCase.call(_myVar_target_value)); diff --git a/crates/swc/tests/fixture/issues-2xxx/2139/output/index.tsx b/crates/swc/tests/fixture/issues-2xxx/2139/output/index.tsx index 630287216d4c..dd271f8a57c3 100644 --- a/crates/swc/tests/fixture/issues-2xxx/2139/output/index.tsx +++ b/crates/swc/tests/fixture/issues-2xxx/2139/output/index.tsx @@ -8,7 +8,7 @@ class ReusablePayments extends PureComponent { } } setDefaultReusablePayment(skipPaymentSource) { - var _props = this.props, reusablePaymentSources = _props.reusablePaymentSources, selectedReusablePayment = _props.selectedReusablePayment, onChange = _props.onChange; + var _this_props = this.props, reusablePaymentSources = _this_props.reusablePaymentSources, selectedReusablePayment = _this_props.selectedReusablePayment, onChange = _this_props.onChange; var validReusablePaymentSources = reusablePaymentSources.filter((ps)=>ps.__typename === "StripePaymentSource" && ps !== skipPaymentSource); if (selectedReusablePayment === null) { return; @@ -25,7 +25,7 @@ class ReusablePayments extends PureComponent { onChange(ps || validReusablePaymentSources[0]); } render() { - var _props = this.props, selectedReusablePayment = _props.selectedReusablePayment, reusablePaymentSources = _props.reusablePaymentSources; + var _this_props = this.props, selectedReusablePayment = _this_props.selectedReusablePayment, reusablePaymentSources = _this_props.reusablePaymentSources; var stripePaymentSources = reusablePaymentSources.filter((ps)=>ps.__typename === "StripePaymentSource"); if (!stripePaymentSources.length) { return null; @@ -85,7 +85,7 @@ class ReusablePayments extends PureComponent { return this.props.onChange(selected); }; this.handleDeletePaymentSource = (id, deletePaymentSource)=>{ - var _props = this.props, selectedReusablePayment = _props.selectedReusablePayment, onChange = _props.onChange; + var _this_props = this.props, selectedReusablePayment = _this_props.selectedReusablePayment, onChange = _this_props.onChange; if (onChange && selectedReusablePayment && selectedReusablePayment.id === id) { this.setDefaultReusablePayment(selectedReusablePayment); } diff --git a/crates/swc/tests/fixture/issues-2xxx/2232/case1/output/index.js b/crates/swc/tests/fixture/issues-2xxx/2232/case1/output/index.js index 617c6a218af9..9975f02b0846 100644 --- a/crates/swc/tests/fixture/issues-2xxx/2232/case1/output/index.js +++ b/crates/swc/tests/fixture/issues-2xxx/2232/case1/output/index.js @@ -13,9 +13,9 @@ var Foo = /*#__PURE__*/ function() { key: "sendSomeMessage", value: function sendSomeMessage(_parent, _param, _param1) { return _async_to_generator(function() { - var _input, toNumber, messageBody, all, dataSources; + var _param_input, toNumber, messageBody, all, dataSources; return _ts_generator(this, function(_state) { - _input = _param.input, toNumber = _input.toNumber, messageBody = _input.messageBody, all = _object_without_properties(_param.input, [ + _param_input = _param.input, toNumber = _param_input.toNumber, messageBody = _param_input.messageBody, all = _object_without_properties(_param.input, [ "toNumber", "messageBody" ]), dataSources = _param1.dataSources; diff --git a/crates/swc/tests/fixture/issues-2xxx/2232/case2/output/index.ts b/crates/swc/tests/fixture/issues-2xxx/2232/case2/output/index.ts index f4241398b4c6..0a6b59a8ed5b 100644 --- a/crates/swc/tests/fixture/issues-2xxx/2232/case2/output/index.ts +++ b/crates/swc/tests/fixture/issues-2xxx/2232/case2/output/index.ts @@ -4,9 +4,9 @@ import _ts_generator from "@swc/helpers/src/_ts_generator.mjs"; var resolver = { sendSomeMessage: function sendSomeMessage(_parent, _param, _param1) { return _async_to_generator(function() { - var _input, toNumber, messageBody, all, dataSources; + var _param_input, toNumber, messageBody, all, dataSources; return _ts_generator(this, function(_state) { - _input = _param.input, toNumber = _input.toNumber, messageBody = _input.messageBody, all = _object_without_properties(_param.input, [ + _param_input = _param.input, toNumber = _param_input.toNumber, messageBody = _param_input.messageBody, all = _object_without_properties(_param.input, [ "toNumber", "messageBody" ]), dataSources = _param1.dataSources; diff --git a/crates/swc/tests/fixture/issues-2xxx/2336/output/input.tsx b/crates/swc/tests/fixture/issues-2xxx/2336/output/input.tsx index 4e9edb6f3abc..68d3ec2f8b5b 100644 --- a/crates/swc/tests/fixture/issues-2xxx/2336/output/input.tsx +++ b/crates/swc/tests/fixture/issues-2xxx/2336/output/input.tsx @@ -1,5 +1,5 @@ import _sliced_to_array from "@swc/helpers/src/_sliced_to_array.mjs"; -var ref = _sliced_to_array(createQuery(), 2); -export var useQuery = ref[0], query = ref[1].query; -var ref1 = _sliced_to_array(createMutation(), 2); -export var useMutation = ref1[0], mutate = ref1[1].mutate; +var _createQuery = _sliced_to_array(createQuery(), 2); +export var useQuery = _createQuery[0], query = _createQuery[1].query; +var _createMutation = _sliced_to_array(createMutation(), 2); +export var useMutation = _createMutation[0], mutate = _createMutation[1].mutate; diff --git a/crates/swc/tests/fixture/issues-2xxx/2854/1/output/index.js b/crates/swc/tests/fixture/issues-2xxx/2854/1/output/index.js index 91e947c2e413..fb6df143c295 100644 --- a/crates/swc/tests/fixture/issues-2xxx/2854/1/output/index.js +++ b/crates/swc/tests/fixture/issues-2xxx/2854/1/output/index.js @@ -2,7 +2,7 @@ export function App() { return React.createElement(Form, null); } export function Form(param) { - var _onChange = param.onChange, onChange = _onChange === void 0 ? function() {} : _onChange; + var _param_onChange = param.onChange, onChange = _param_onChange === void 0 ? function() {} : _param_onChange; return React.createElement("input", { onChange: function onChange1() { onChange(); diff --git a/crates/swc/tests/fixture/issues-2xxx/2858/1/output/index.js b/crates/swc/tests/fixture/issues-2xxx/2858/1/output/index.js index b404ebbeff34..5a522f59d0c3 100644 --- a/crates/swc/tests/fixture/issues-2xxx/2858/1/output/index.js +++ b/crates/swc/tests/fixture/issues-2xxx/2858/1/output/index.js @@ -1,9 +1,9 @@ -var ref = { +var _ref = { a: 1, b: 2 -}, a1 = ref.a, b1 = ref.b; -var ref1 = { +}, a1 = _ref.a, b1 = _ref.b; +var _ref1 = { a: 1, b: 2 }; -export var a2 = ref1.a, b2 = ref1.b; +export var a2 = _ref1.a, b2 = _ref1.b; diff --git a/crates/swc/tests/fixture/issues-2xxx/2858/2/output/index.js b/crates/swc/tests/fixture/issues-2xxx/2858/2/output/index.js index b965bcc4ff40..4c028a9861cb 100644 --- a/crates/swc/tests/fixture/issues-2xxx/2858/2/output/index.js +++ b/crates/swc/tests/fixture/issues-2xxx/2858/2/output/index.js @@ -16,12 +16,12 @@ _export(exports, { return b2; } }); -var ref = { +var _ref = { a: 1, b: 2 -}, a1 = ref.a, b1 = ref.b; -var ref1 = { +}, a1 = _ref.a, b1 = _ref.b; +var _ref1 = { a: 1, b: 2 }; -var a2 = ref1.a, b2 = ref1.b; +var a2 = _ref1.a, b2 = _ref1.b; diff --git a/crates/swc/tests/fixture/issues-4xxx/4108/1/output/index.ts b/crates/swc/tests/fixture/issues-4xxx/4108/1/output/index.ts index c118404be45d..caf20e541753 100644 --- a/crates/swc/tests/fixture/issues-4xxx/4108/1/output/index.ts +++ b/crates/swc/tests/fixture/issues-4xxx/4108/1/output/index.ts @@ -484,7 +484,7 @@ export var sendTransaction = function() { }(); export var sendTransactionWithRetry = function() { var _ref = _async_to_generator(function(connection, wallet, instructions, signers) { - var commitment, includesFeePayer, block, beforeSend, transaction, _tmp, _transaction, _transaction1, _transaction2, ref, txid, slot; + var commitment, includesFeePayer, block, beforeSend, transaction, _tmp, _transaction, _transaction1, _transaction2, _ref, txid, slot; var _arguments = arguments; return _ts_generator(this, function(_state) { switch(_state.label){ @@ -550,7 +550,7 @@ export var sendTransactionWithRetry = function() { }) ]; case 5: - ref = _state.sent(), txid = ref.txid, slot = ref.slot; + _ref = _state.sent(), txid = _ref.txid, slot = _ref.slot; return [ 2, { @@ -574,11 +574,11 @@ export function sendSignedTransaction(_) { } function _sendSignedTransaction() { _sendSignedTransaction = _async_to_generator(function(param) { - var signedTransaction, connection, _timeout, timeout, rawTransaction, startTime, slot, txid, done, confirmation, err, simulateResult, e, i, line; + var signedTransaction, connection, _param_timeout, timeout, rawTransaction, startTime, slot, txid, done, confirmation, err, simulateResult, e, i, line; return _ts_generator(this, function(_state) { switch(_state.label){ case 0: - signedTransaction = param.signedTransaction, connection = param.connection, _timeout = param.timeout, timeout = _timeout === void 0 ? DEFAULT_TIMEOUT : _timeout; + signedTransaction = param.signedTransaction, connection = param.connection, _param_timeout = param.timeout, timeout = _param_timeout === void 0 ? DEFAULT_TIMEOUT : _param_timeout; rawTransaction = signedTransaction.serialize(); startTime = getUnixTs(); slot = 0; diff --git a/crates/swc/tests/fixture/issues-5xxx/5102/output/index.js b/crates/swc/tests/fixture/issues-5xxx/5102/output/index.js index abb0dd97d318..0d0af8dfa944 100644 --- a/crates/swc/tests/fixture/issues-5xxx/5102/output/index.js +++ b/crates/swc/tests/fixture/issues-5xxx/5102/output/index.js @@ -4,22 +4,22 @@ var a = function a() { "use strict"; _class_call_check(this, a); }; -var ref = [ +var _ref = [ function _class() { "use strict"; _class_call_check(this, _class); } -], b = ref[0]; -var ref1 = [], tmp = ref1[0], c = tmp === void 0 ? function c() { +], b = _ref[0]; +var _ref1 = [], tmp = _ref1[0], c = tmp === void 0 ? function c() { "use strict"; _class_call_check(this, c); } : tmp; -var ref2 = [ +var _ref2 = [ function _class() { "use strict"; _class_call_check(this, _class); } -], tmp1 = ref2[0], d = tmp1 === void 0 ? function d() { +], tmp1 = _ref2[0], d = tmp1 === void 0 ? function d() { "use strict"; _class_call_check(this, d); } : tmp1; @@ -29,20 +29,20 @@ var e = { _class_call_check(this, e); } }.e; -var ref3 = {}, _f = ref3.f, f = _f === void 0 ? function f() { +var _ref3 = {}, _ref_f = _ref3.f, f = _ref_f === void 0 ? function f() { "use strict"; _class_call_check(this, f); -} : _f; -var ref4 = { +} : _ref_f; +var _ref4 = { g: function g() { "use strict"; _class_call_check(this, g); } -}, _g = ref4.g, g = _g === void 0 ? function g() { +}, _ref_g = _ref4.g, g = _ref_g === void 0 ? function g() { "use strict"; _class_call_check(this, g); -} : _g; -var ref5 = {}, tmp2 = ref5._, h = tmp2 === void 0 ? function h() { +} : _ref_g; +var _ref5 = {}, tmp2 = _ref5._, h = tmp2 === void 0 ? function h() { "use strict"; _class_call_check(this, h); } : tmp2; diff --git a/crates/swc/tests/fixture/next.js/shared/lib/router/1/output/index.ts b/crates/swc/tests/fixture/next.js/shared/lib/router/1/output/index.ts index 586d89c76b2f..c1cfad6f6ef0 100644 --- a/crates/swc/tests/fixture/next.js/shared/lib/router/1/output/index.ts +++ b/crates/swc/tests/fixture/next.js/shared/lib/router/1/output/index.ts @@ -10,7 +10,7 @@ var Router = /*#__PURE__*/ function() { _proto.change = function change(method, url, as, options, forcedScroll) { var _this = this; return _async_to_generator(function() { - var shouldResolveHref, prevLocale, parsedAs, localePathResult, didNavigate, ref, detectedDomain, asNoBasePath, _shallow, shallow, routeProps, cleanedAs, localeChange, parsed, pathname, query, pages, rewrites, ref1, err, resolvedAs, rewritesResult, route, parsedAs1, asPathname, routeRegex, routeMatch, shouldInterpolate, interpolatedAs, missingParams, ref2, ref3, routeInfo, error, props, __N_SSG, __N_SSP, destination, parsedHref, ref4, newUrl, newAs, notFoundRoute, _, isValidShallowRoute, _scroll, shouldScroll, resetScroll, err1; + var shouldResolveHref, prevLocale, parsedAs, localePathResult, didNavigate, _this_locales, detectedDomain, asNoBasePath, _options_shallow, shallow, routeProps, cleanedAs, localeChange, parsed, pathname, query, pages, rewrites, ref, err, resolvedAs, rewritesResult, route, parsedAs1, asPathname, routeRegex, routeMatch, shouldInterpolate, interpolatedAs, missingParams, _self___NEXT_DATA___props, _self___NEXT_DATA___props_pageProps, routeInfo, error, props, __N_SSG, __N_SSP, destination, parsedHref, _prepareUrlAs, newUrl, newAs, notFoundRoute, _, isValidShallowRoute, _options_scroll, shouldScroll, resetScroll, err1; return _ts_generator(this, function(_state) { switch(_state.label){ case 0: @@ -47,7 +47,7 @@ var Router = /*#__PURE__*/ function() { if (process.env.__NEXT_I18N_SUPPORT) { ; // if the locale isn't configured hard navigate to show 404 page - if (!((ref = _this.locales) === null || ref === void 0 ? void 0 : ref.includes(_this.locale))) { + if (!((_this_locales = _this.locales) === null || _this_locales === void 0 ? void 0 : _this_locales.includes(_this.locale))) { parsedAs.pathname = addLocale(parsedAs.pathname, _this.locale); window.location.href = formatWithValidation(parsedAs); // this was previously a return but was removed in favor @@ -83,7 +83,7 @@ var Router = /*#__PURE__*/ function() { if (ST) { performance.mark("routeChange"); } - _shallow = options.shallow, shallow = _shallow === void 0 ? false : _shallow; + _options_shallow = options.shallow, shallow = _options_shallow === void 0 ? false : _options_shallow; routeProps = { shallow: shallow }; @@ -133,7 +133,7 @@ var Router = /*#__PURE__*/ function() { getClientBuildManifest() ]; case 3: - ref1 = _state.sent(), rewrites = ref1.__rewrites, ref1; + ref = _state.sent(), rewrites = ref.__rewrites, ref; return [ 3, 5 @@ -251,7 +251,7 @@ var Router = /*#__PURE__*/ function() { if (destination.startsWith("/") && props.pageProps.__N_REDIRECT_BASE_PATH !== false) { parsedHref = parseRelativeUrl(destination); parsedHref.pathname = resolveDynamicRoute(parsedHref.pathname, pages); - ref4 = prepareUrlAs(_this, destination, destination), newUrl = ref4.url, newAs = ref4.as; + _prepareUrlAs = prepareUrlAs(_this, destination, destination), newUrl = _prepareUrlAs.url, newAs = _prepareUrlAs.as; return [ 2, _this.change(method, newUrl, newAs, options) @@ -307,13 +307,13 @@ var Router = /*#__PURE__*/ function() { case 13: Router.events.emit("beforeHistoryChange", as, routeProps); _this.changeState(method, url, as, options); - if (options._h && pathname === "/_error" && ((ref2 = self.__NEXT_DATA__.props) === null || ref2 === void 0 ? void 0 : (ref3 = ref2.pageProps) === null || ref3 === void 0 ? void 0 : ref3.statusCode) === 500 && (props === null || props === void 0 ? void 0 : props.pageProps)) { + if (options._h && pathname === "/_error" && ((_self___NEXT_DATA___props = self.__NEXT_DATA__.props) === null || _self___NEXT_DATA___props === void 0 ? void 0 : (_self___NEXT_DATA___props_pageProps = _self___NEXT_DATA___props.pageProps) === null || _self___NEXT_DATA___props_pageProps === void 0 ? void 0 : _self___NEXT_DATA___props_pageProps.statusCode) === 500 && (props === null || props === void 0 ? void 0 : props.pageProps)) { // ensure statusCode is still correct for static 500 page // when updating query information props.pageProps.statusCode = 500; } isValidShallowRoute = options.shallow && _this.route === route; - shouldScroll = (_scroll = options.scroll) !== null && _scroll !== void 0 ? _scroll : !isValidShallowRoute; + shouldScroll = (_options_scroll = options.scroll) !== null && _options_scroll !== void 0 ? _options_scroll : !isValidShallowRoute; resetScroll = shouldScroll ? { x: 0, y: 0 diff --git a/crates/swc/tests/fixture/shopify/002/output/index.js b/crates/swc/tests/fixture/shopify/002/output/index.js index 06d72a5200c3..a7974d80c5b6 100644 --- a/crates/swc/tests/fixture/shopify/002/output/index.js +++ b/crates/swc/tests/fixture/shopify/002/output/index.js @@ -13,6 +13,6 @@ var _slicedToArray = require("@swc/helpers/lib/_sliced_to_array.js").default; var _react = /*#__PURE__*/ _interopRequireDefault(require("react")); var _reactI18N = require("@shopify/react-i18n"); function App() { - var ref = _slicedToArray((0, _reactI18N.useI18n)(), 1), i18n = ref[0]; + var _useI18n = _slicedToArray((0, _reactI18N.useI18n)(), 1), i18n = _useI18n[0]; return /*#__PURE__*/ _react.default.createElement("h1", null, i18n.translate("foo")); } diff --git a/crates/swc/tests/fixture/shopify/003-env/output/index.js b/crates/swc/tests/fixture/shopify/003-env/output/index.js index 06d72a5200c3..a7974d80c5b6 100644 --- a/crates/swc/tests/fixture/shopify/003-env/output/index.js +++ b/crates/swc/tests/fixture/shopify/003-env/output/index.js @@ -13,6 +13,6 @@ var _slicedToArray = require("@swc/helpers/lib/_sliced_to_array.js").default; var _react = /*#__PURE__*/ _interopRequireDefault(require("react")); var _reactI18N = require("@shopify/react-i18n"); function App() { - var ref = _slicedToArray((0, _reactI18N.useI18n)(), 1), i18n = ref[0]; + var _useI18n = _slicedToArray((0, _reactI18N.useI18n)(), 1), i18n = _useI18n[0]; return /*#__PURE__*/ _react.default.createElement("h1", null, i18n.translate("foo")); } diff --git a/crates/swc/tests/fixture/shopify/004-jest/output/index.js b/crates/swc/tests/fixture/shopify/004-jest/output/index.js index 06d72a5200c3..a7974d80c5b6 100644 --- a/crates/swc/tests/fixture/shopify/004-jest/output/index.js +++ b/crates/swc/tests/fixture/shopify/004-jest/output/index.js @@ -13,6 +13,6 @@ var _slicedToArray = require("@swc/helpers/lib/_sliced_to_array.js").default; var _react = /*#__PURE__*/ _interopRequireDefault(require("react")); var _reactI18N = require("@shopify/react-i18n"); function App() { - var ref = _slicedToArray((0, _reactI18N.useI18n)(), 1), i18n = ref[0]; + var _useI18n = _slicedToArray((0, _reactI18N.useI18n)(), 1), i18n = _useI18n[0]; return /*#__PURE__*/ _react.default.createElement("h1", null, i18n.translate("foo")); } diff --git a/crates/swc/tests/fixture/shopify/005-no-module/output/index.js b/crates/swc/tests/fixture/shopify/005-no-module/output/index.js index 4d1017ce8ff1..2bc9aab67943 100644 --- a/crates/swc/tests/fixture/shopify/005-no-module/output/index.js +++ b/crates/swc/tests/fixture/shopify/005-no-module/output/index.js @@ -2,6 +2,6 @@ import _sliced_to_array from "@swc/helpers/src/_sliced_to_array.mjs"; import React from "react"; import { useI18n } from "@shopify/react-i18n"; export function App() { - var ref = _sliced_to_array(useI18n(), 1), i18n = ref[0]; + var _useI18n = _sliced_to_array(useI18n(), 1), i18n = _useI18n[0]; return /*#__PURE__*/ React.createElement("h1", null, i18n.translate("foo")); } diff --git a/crates/swc/tests/tsc-references/ES5For-of26.1.normal.js b/crates/swc/tests/tsc-references/ES5For-of26.1.normal.js index d88f7d6b6cc0..ec61ca95b346 100644 --- a/crates/swc/tests/tsc-references/ES5For-of26.1.normal.js +++ b/crates/swc/tests/tsc-references/ES5For-of26.1.normal.js @@ -4,7 +4,7 @@ for(var _i = 0, _iter = [ 2, 3 ]; _i < _iter.length; _i++){ - var __i = _sliced_to_array(_iter[_i], 2), tmp = __i[0], a = tmp === void 0 ? 0 : tmp, tmp1 = __i[1], b = tmp1 === void 0 ? 1 : tmp1; + var _iter__i = _sliced_to_array(_iter[_i], 2), tmp = _iter__i[0], a = tmp === void 0 ? 0 : tmp, tmp1 = _iter__i[1], b = tmp1 === void 0 ? 1 : tmp1; a; b; } diff --git a/crates/swc/tests/tsc-references/ES5For-of26.2.minified.js b/crates/swc/tests/tsc-references/ES5For-of26.2.minified.js index 85fedfc8b634..666d510aee00 100644 --- a/crates/swc/tests/tsc-references/ES5For-of26.2.minified.js +++ b/crates/swc/tests/tsc-references/ES5For-of26.2.minified.js @@ -4,6 +4,6 @@ for(var _i = 0, _iter = [ 2, 3 ]; _i < _iter.length; _i++){ - var __i = _sliced_to_array(_iter[_i], 2); - __i[0], __i[1]; + var _iter__i = _sliced_to_array(_iter[_i], 2); + _iter__i[0], _iter__i[1]; } diff --git a/crates/swc/tests/tsc-references/ES5For-of27.1.normal.js b/crates/swc/tests/tsc-references/ES5For-of27.1.normal.js index 78ef3b5a2065..256a15374c09 100644 --- a/crates/swc/tests/tsc-references/ES5For-of27.1.normal.js +++ b/crates/swc/tests/tsc-references/ES5For-of27.1.normal.js @@ -3,7 +3,7 @@ for(var _i = 0, _iter = [ 2, 3 ]; _i < _iter.length; _i++){ - var __i = _iter[_i], tmp = __i.x, a = tmp === void 0 ? 0 : tmp, tmp1 = __i.y, b = tmp1 === void 0 ? 1 : tmp1; + var _iter__i = _iter[_i], tmp = _iter__i.x, a = tmp === void 0 ? 0 : tmp, tmp1 = _iter__i.y, b = tmp1 === void 0 ? 1 : tmp1; a; b; } diff --git a/crates/swc/tests/tsc-references/ES5For-of27.2.minified.js b/crates/swc/tests/tsc-references/ES5For-of27.2.minified.js index 2f1cf2e44666..1443282f0a9a 100644 --- a/crates/swc/tests/tsc-references/ES5For-of27.2.minified.js +++ b/crates/swc/tests/tsc-references/ES5For-of27.2.minified.js @@ -3,6 +3,6 @@ for(var _i = 0, _iter = [ 2, 3 ]; _i < _iter.length; _i++){ - var __i = _iter[_i]; - __i.x, __i.y; + var _iter__i = _iter[_i]; + _iter__i.x, _iter__i.y; } diff --git a/crates/swc/tests/tsc-references/ES5For-of28.1.normal.js b/crates/swc/tests/tsc-references/ES5For-of28.1.normal.js index 6826b2e36cf6..058aa082467c 100644 --- a/crates/swc/tests/tsc-references/ES5For-of28.1.normal.js +++ b/crates/swc/tests/tsc-references/ES5For-of28.1.normal.js @@ -4,7 +4,7 @@ for(var _i = 0, _iter = [ 2, 3 ]; _i < _iter.length; _i++){ - var __i = _sliced_to_array(_iter[_i], 2), tmp = __i[0], a = tmp === void 0 ? 0 : tmp, tmp1 = __i[1], b = tmp1 === void 0 ? 1 : tmp1; + var _iter__i = _sliced_to_array(_iter[_i], 2), tmp = _iter__i[0], a = tmp === void 0 ? 0 : tmp, tmp1 = _iter__i[1], b = tmp1 === void 0 ? 1 : tmp1; a; b; } diff --git a/crates/swc/tests/tsc-references/ES5For-of28.2.minified.js b/crates/swc/tests/tsc-references/ES5For-of28.2.minified.js index 96abbb96a7f6..5a3f1ce3ef53 100644 --- a/crates/swc/tests/tsc-references/ES5For-of28.2.minified.js +++ b/crates/swc/tests/tsc-references/ES5For-of28.2.minified.js @@ -4,6 +4,6 @@ for(var _i = 0, _iter = [ 2, 3 ]; _i < _iter.length; _i++){ - var __i = _sliced_to_array(_iter[_i], 2); - __i[0], __i[1]; + var _iter__i = _sliced_to_array(_iter[_i], 2); + _iter__i[0], _iter__i[1]; } diff --git a/crates/swc/tests/tsc-references/ES5For-of29.1.normal.js b/crates/swc/tests/tsc-references/ES5For-of29.1.normal.js index 45f6fea568e3..a21646e81934 100644 --- a/crates/swc/tests/tsc-references/ES5For-of29.1.normal.js +++ b/crates/swc/tests/tsc-references/ES5For-of29.1.normal.js @@ -3,7 +3,7 @@ for(var _i = 0, _iter = [ 2, 3 ]; _i < _iter.length; _i++){ - var __i = _iter[_i], tmp = __i.x, a = tmp === void 0 ? 0 : tmp, tmp1 = __i.y, b = tmp1 === void 0 ? 1 : tmp1; + var _iter__i = _iter[_i], tmp = _iter__i.x, a = tmp === void 0 ? 0 : tmp, tmp1 = _iter__i.y, b = tmp1 === void 0 ? 1 : tmp1; a; b; } diff --git a/crates/swc/tests/tsc-references/ES5For-of29.2.minified.js b/crates/swc/tests/tsc-references/ES5For-of29.2.minified.js index 871e90af490b..deac3d70e261 100644 --- a/crates/swc/tests/tsc-references/ES5For-of29.2.minified.js +++ b/crates/swc/tests/tsc-references/ES5For-of29.2.minified.js @@ -3,6 +3,6 @@ for(var _i = 0, _iter = [ 2, 3 ]; _i < _iter.length; _i++){ - var __i = _iter[_i]; - __i.x, __i.y; + var _iter__i = _iter[_i]; + _iter__i.x, _iter__i.y; } diff --git a/crates/swc/tests/tsc-references/ES5For-of35.1.normal.js b/crates/swc/tests/tsc-references/ES5For-of35.1.normal.js index 257c601be13c..4ee48653dc92 100644 --- a/crates/swc/tests/tsc-references/ES5For-of35.1.normal.js +++ b/crates/swc/tests/tsc-references/ES5For-of35.1.normal.js @@ -3,7 +3,7 @@ for(var _i = 0, _iter = [ 2, 3 ]; _i < _iter.length; _i++){ - var __i = _iter[_i], tmp = __i.x, a = tmp === void 0 ? 0 : tmp, tmp1 = __i.y, b = tmp1 === void 0 ? 1 : tmp1; + var _iter__i = _iter[_i], tmp = _iter__i.x, a = tmp === void 0 ? 0 : tmp, tmp1 = _iter__i.y, b = tmp1 === void 0 ? 1 : tmp1; a; b; } diff --git a/crates/swc/tests/tsc-references/ES5For-of35.2.minified.js b/crates/swc/tests/tsc-references/ES5For-of35.2.minified.js index 5f9ef49b8262..c7168e2ac535 100644 --- a/crates/swc/tests/tsc-references/ES5For-of35.2.minified.js +++ b/crates/swc/tests/tsc-references/ES5For-of35.2.minified.js @@ -3,6 +3,6 @@ for(var _i = 0, _iter = [ 2, 3 ]; _i < _iter.length; _i++){ - var __i = _iter[_i]; - __i.x, __i.y; + var _iter__i = _iter[_i]; + _iter__i.x, _iter__i.y; } diff --git a/crates/swc/tests/tsc-references/ES5For-of36.1.normal.js b/crates/swc/tests/tsc-references/ES5For-of36.1.normal.js index 17c715ccb28e..c4aa01e3ef4a 100644 --- a/crates/swc/tests/tsc-references/ES5For-of36.1.normal.js +++ b/crates/swc/tests/tsc-references/ES5For-of36.1.normal.js @@ -4,7 +4,7 @@ for(var _i = 0, _iter = [ 2, 3 ]; _i < _iter.length; _i++){ - var __i = _sliced_to_array(_iter[_i], 2), tmp = __i[0], a = tmp === void 0 ? 0 : tmp, tmp1 = __i[1], b = tmp1 === void 0 ? 1 : tmp1; + var _iter__i = _sliced_to_array(_iter[_i], 2), tmp = _iter__i[0], a = tmp === void 0 ? 0 : tmp, tmp1 = _iter__i[1], b = tmp1 === void 0 ? 1 : tmp1; a; b; } diff --git a/crates/swc/tests/tsc-references/ES5For-of36.2.minified.js b/crates/swc/tests/tsc-references/ES5For-of36.2.minified.js index 8bb06af1d4fa..ddfa1abf91fc 100644 --- a/crates/swc/tests/tsc-references/ES5For-of36.2.minified.js +++ b/crates/swc/tests/tsc-references/ES5For-of36.2.minified.js @@ -4,6 +4,6 @@ for(var _i = 0, _iter = [ 2, 3 ]; _i < _iter.length; _i++){ - var __i = _sliced_to_array(_iter[_i], 2); - __i[0], __i[1]; + var _iter__i = _sliced_to_array(_iter[_i], 2); + _iter__i[0], _iter__i[1]; } diff --git a/crates/swc/tests/tsc-references/argumentExpressionContextualTyping.1.normal.js b/crates/swc/tests/tsc-references/argumentExpressionContextualTyping.1.normal.js index d99668de5889..1aa96e335a28 100644 --- a/crates/swc/tests/tsc-references/argumentExpressionContextualTyping.1.normal.js +++ b/crates/swc/tests/tsc-references/argumentExpressionContextualTyping.1.normal.js @@ -3,12 +3,12 @@ import _sliced_to_array from "@swc/helpers/src/_sliced_to_array.mjs"; import _to_consumable_array from "@swc/helpers/src/_to_consumable_array.mjs"; function foo(param) { - var _x = _sliced_to_array(param.x, 2), a = _x[0], b = _x[1], _y = param.y, c = _y.c, d = _y.d, e = _y.e; + var _param_x = _sliced_to_array(param.x, 2), a = _param_x[0], b = _param_x[1], _param_y = param.y, c = _param_y.c, d = _param_y.d, e = _param_y.e; } function bar(param) { - var _x = _sliced_to_array(param.x, 2), a = _x[0], tmp = _x[1], b = tmp === void 0 ? 10 : tmp, _y = param.y, c = _y.c, d = _y.d, _e = _y.e, e = _e === void 0 ? { + var _param_x = _sliced_to_array(param.x, 2), a = _param_x[0], tmp = _param_x[1], b = tmp === void 0 ? 10 : tmp, _param_y = param.y, c = _param_y.c, d = _param_y.d, _param_y_e = _param_y.e, e = _param_y_e === void 0 ? { f: 1 - } : _e; + } : _param_y_e; } function baz(x) {} var o = { diff --git a/crates/swc/tests/tsc-references/argumentExpressionContextualTyping.2.minified.js b/crates/swc/tests/tsc-references/argumentExpressionContextualTyping.2.minified.js index b31f017f4401..43be12fc510c 100644 --- a/crates/swc/tests/tsc-references/argumentExpressionContextualTyping.2.minified.js +++ b/crates/swc/tests/tsc-references/argumentExpressionContextualTyping.2.minified.js @@ -2,8 +2,8 @@ import _sliced_to_array from "@swc/helpers/src/_sliced_to_array.mjs"; import _to_consumable_array from "@swc/helpers/src/_to_consumable_array.mjs"; function foo(param) { - var _x = _sliced_to_array(param.x, 2), _y = (_x[0], _x[1], param.y); - _y.c, _y.d, _y.e; + var _param_x = _sliced_to_array(param.x, 2), _param_y = (_param_x[0], _param_x[1], param.y); + _param_y.c, _param_y.d, _param_y.e; } foo({ x: [ diff --git a/crates/swc/tests/tsc-references/arrayLiterals2ES5.1.normal.js b/crates/swc/tests/tsc-references/arrayLiterals2ES5.1.normal.js index 1ee8353fa05f..b214f5f555ec 100644 --- a/crates/swc/tests/tsc-references/arrayLiterals2ES5.1.normal.js +++ b/crates/swc/tests/tsc-references/arrayLiterals2ES5.1.normal.js @@ -64,11 +64,11 @@ var b1 = [ // - If the array literal contains no spread elements and is an array assignment pattern in a destructuring assignment (section 4.17.1), // the resulting type is a tuple type constructed from the types of the element expressions. var c0 = 1, c1 = 2; // tuple type [number, number] -var ref = [ +var _ref = [ 1, 2, true -], c2 = ref[0], c3 = ref[1]; // tuple type [number, number, boolean] +], c2 = _ref[0], c3 = _ref[1]; // tuple type [number, number, boolean] // The resulting type an array literal expression is determined as follows: // - the resulting type is an array type with an element type that is the union of the types of the // non - spread element expressions and the numeric index signature types of the spread element expressions diff --git a/crates/swc/tests/tsc-references/arrayLiterals2ES5.2.minified.js b/crates/swc/tests/tsc-references/arrayLiterals2ES5.2.minified.js index 053aa964f302..42ec0827c54e 100644 --- a/crates/swc/tests/tsc-references/arrayLiterals2ES5.2.minified.js +++ b/crates/swc/tests/tsc-references/arrayLiterals2ES5.2.minified.js @@ -19,12 +19,12 @@ var a0 = [ ].concat(_to_consumable_array(a0)), _to_consumable_array(a0).concat([ , ]); -var ref = [ +var _ref = [ 1, 2, !0 ]; -ref[0], ref[1]; +_ref[0], _ref[1]; var temp = [ "s", "t", diff --git a/crates/swc/tests/tsc-references/arrayLiterals3.1.normal.js b/crates/swc/tests/tsc-references/arrayLiterals3.1.normal.js index 34bfe82bb01b..d122490d3c93 100644 --- a/crates/swc/tests/tsc-references/arrayLiterals3.1.normal.js +++ b/crates/swc/tests/tsc-references/arrayLiterals3.1.normal.js @@ -16,12 +16,12 @@ var a1 = [ // The resulting type an array literal expression is determined as follows: // - If the array literal contains no spread elements and is an array assignment pattern in a destructuring assignment (section 4.17.1), // the resulting type is a tuple type constructed from the types of the element expressions. -var ref = [ +var _ref = [ 1, 2, "string", true -], b1 = ref[0], b2 = ref[1]; +], b1 = _ref[0], b2 = _ref[1]; // The resulting type an array literal expression is determined as follows: // - the resulting type is an array type with an element type that is the union of the types of the // non - spread element expressions and the numeric index signature types of the spread element expressions diff --git a/crates/swc/tests/tsc-references/arrayLiterals3.2.minified.js b/crates/swc/tests/tsc-references/arrayLiterals3.2.minified.js index 9f6ca0341f71..5b88e228afd2 100644 --- a/crates/swc/tests/tsc-references/arrayLiterals3.2.minified.js +++ b/crates/swc/tests/tsc-references/arrayLiterals3.2.minified.js @@ -1,12 +1,12 @@ //// [arrayLiterals3.ts] import _to_consumable_array from "@swc/helpers/src/_to_consumable_array.mjs"; -var ref = [ +var _ref = [ 1, 2, "string", !0 ]; -ref[0], ref[1]; +_ref[0], _ref[1]; var temp1 = [ 1, 2, diff --git a/crates/swc/tests/tsc-references/arrowFunctionExpressions.1.normal.js b/crates/swc/tests/tsc-references/arrowFunctionExpressions.1.normal.js index f25f8a88cd29..39d27f30c6b6 100644 --- a/crates/swc/tests/tsc-references/arrowFunctionExpressions.1.normal.js +++ b/crates/swc/tests/tsc-references/arrowFunctionExpressions.1.normal.js @@ -48,15 +48,15 @@ var p7 = function(param) { var b = param.a.b; }; var p8 = function(param) { - var _a = param.a, a = _a === void 0 ? 1 : _a; + var _param_a = param.a, a = _param_a === void 0 ? 1 : _param_a; }; var p9 = function(param) { - var tmp = param.a, ref = tmp === void 0 ? { + var tmp = param.a, _ref = tmp === void 0 ? { b: 1 - } : tmp, _b = ref.b, b = _b === void 0 ? 1 : _b; + } : tmp, _ref_b = _ref.b, b = _ref_b === void 0 ? 1 : _ref_b; }; var p10 = function(param) { - var _param = _sliced_to_array(param, 1), ref = _param[0], value = ref.value, done = ref.done; + var _param = _sliced_to_array(param, 1), _param_ = _param[0], value = _param_.value, done = _param_.done; }; // Arrow function used in class member initializer // Arrow function used in class member function diff --git a/crates/swc/tests/tsc-references/callChain.1.normal.js b/crates/swc/tests/tsc-references/callChain.1.normal.js index 0015a9e7ce5a..4de61c932303 100644 --- a/crates/swc/tests/tsc-references/callChain.1.normal.js +++ b/crates/swc/tests/tsc-references/callChain.1.normal.js @@ -1,6 +1,6 @@ //// [callChain.ts] -var _o2, _o21, _o22, _o23, _ref, _ref1, _ref2, _ref3, _ref4, _ref5; -var ref, ref1, ref2, ref3, ref4, ref5, ref6, ref7, ref8, ref9, ref10, ref11, ref12; +var _o2, _o21, _o22, _o23, _o3_b, _o3_b1, _o3_b2, _o3_b3, _o3_b4, _o3_b5; +var _o3_b6, _o3_b7, _o3_b8, _o3_b9, _o3_b10, _o3_b11, _o3_b12, _o3_b13, _o3_b14, _o3_b15, _o3_b16, _o3_b17, _o5; o1 === null || o1 === void 0 ? void 0 : o1(); o1 === null || o1 === void 0 ? void 0 : o1(1); o1 === null || o1 === void 0 ? void 0 : o1.apply(void 0, [ @@ -37,42 +37,42 @@ o2 === null || o2 === void 0 ? void 0 : (_o23 = o2)["b"].apply(_o23, [ 3, 4 ]); -(ref = o3.b) === null || ref === void 0 ? void 0 : ref.call(o3).c; -(ref1 = o3.b) === null || ref1 === void 0 ? void 0 : ref1.call(o3, 1).c; -(ref2 = o3.b) === null || ref2 === void 0 ? void 0 : (_ref = ref2).call.apply(_ref, [ +(_o3_b6 = o3.b) === null || _o3_b6 === void 0 ? void 0 : _o3_b6.call(o3).c; +(_o3_b7 = o3.b) === null || _o3_b7 === void 0 ? void 0 : _o3_b7.call(o3, 1).c; +(_o3_b8 = o3.b) === null || _o3_b8 === void 0 ? void 0 : (_o3_b = _o3_b8).call.apply(_o3_b, [ o3, 1, 2 ]).c; -(ref3 = o3.b) === null || ref3 === void 0 ? void 0 : (_ref1 = ref3).call.apply(_ref1, [ +(_o3_b9 = o3.b) === null || _o3_b9 === void 0 ? void 0 : (_o3_b1 = _o3_b9).call.apply(_o3_b1, [ o3, 1, 2, 3, 4 ]).c; -(ref4 = o3.b) === null || ref4 === void 0 ? void 0 : ref4.call(o3)["c"]; -(ref5 = o3.b) === null || ref5 === void 0 ? void 0 : ref5.call(o3, 1)["c"]; -(ref6 = o3.b) === null || ref6 === void 0 ? void 0 : (_ref2 = ref6).call.apply(_ref2, [ +(_o3_b10 = o3.b) === null || _o3_b10 === void 0 ? void 0 : _o3_b10.call(o3)["c"]; +(_o3_b11 = o3.b) === null || _o3_b11 === void 0 ? void 0 : _o3_b11.call(o3, 1)["c"]; +(_o3_b12 = o3.b) === null || _o3_b12 === void 0 ? void 0 : (_o3_b2 = _o3_b12).call.apply(_o3_b2, [ o3, 1, 2 ])["c"]; -(ref7 = o3.b) === null || ref7 === void 0 ? void 0 : (_ref3 = ref7).call.apply(_ref3, [ +(_o3_b13 = o3.b) === null || _o3_b13 === void 0 ? void 0 : (_o3_b3 = _o3_b13).call.apply(_o3_b3, [ o3, 1, 2, 3, 4 ])["c"]; -(ref8 = o3["b"]) === null || ref8 === void 0 ? void 0 : ref8.call(o3).c; -(ref9 = o3["b"]) === null || ref9 === void 0 ? void 0 : ref9.call(o3, 1).c; -(ref10 = o3["b"]) === null || ref10 === void 0 ? void 0 : (_ref4 = ref10).call.apply(_ref4, [ +(_o3_b14 = o3["b"]) === null || _o3_b14 === void 0 ? void 0 : _o3_b14.call(o3).c; +(_o3_b15 = o3["b"]) === null || _o3_b15 === void 0 ? void 0 : _o3_b15.call(o3, 1).c; +(_o3_b16 = o3["b"]) === null || _o3_b16 === void 0 ? void 0 : (_o3_b4 = _o3_b16).call.apply(_o3_b4, [ o3, 1, 2 ]).c; -(ref11 = o3["b"]) === null || ref11 === void 0 ? void 0 : (_ref5 = ref11).call.apply(_ref5, [ +(_o3_b17 = o3["b"]) === null || _o3_b17 === void 0 ? void 0 : (_o3_b5 = _o3_b17).call.apply(_o3_b5, [ o3, 1, 2, @@ -80,7 +80,7 @@ o2 === null || o2 === void 0 ? void 0 : (_o23 = o2)["b"].apply(_o23, [ 4 ]).c; var v = o4 === null || o4 === void 0 ? void 0 : o4(incr); -(ref12 = o5()) === null || ref12 === void 0 ? void 0 : ref12(); +(_o5 = o5()) === null || _o5 === void 0 ? void 0 : _o5(); // GH#36031 o2 === null || o2 === void 0 ? void 0 : o2.b().toString; o2 === null || o2 === void 0 ? void 0 : o2.b().toString; diff --git a/crates/swc/tests/tsc-references/callChain.2.1.normal.js b/crates/swc/tests/tsc-references/callChain.2.1.normal.js index 44a71508997a..3bbc5c0421f8 100644 --- a/crates/swc/tests/tsc-references/callChain.2.1.normal.js +++ b/crates/swc/tests/tsc-references/callChain.2.1.normal.js @@ -1,5 +1,5 @@ //// [callChain.2.ts] -var ref; +var _o3_b; o1 === null || o1 === void 0 ? void 0 : o1(); o2 === null || o2 === void 0 ? void 0 : o2.b(); -(ref = o3.b) === null || ref === void 0 ? void 0 : ref.call(o3).c; +(_o3_b = o3.b) === null || _o3_b === void 0 ? void 0 : _o3_b.call(o3).c; diff --git a/crates/swc/tests/tsc-references/callChain.2.2.minified.js b/crates/swc/tests/tsc-references/callChain.2.2.minified.js index ded3e7775c97..f6718e2799c7 100644 --- a/crates/swc/tests/tsc-references/callChain.2.2.minified.js +++ b/crates/swc/tests/tsc-references/callChain.2.2.minified.js @@ -1,3 +1,3 @@ //// [callChain.2.ts] -var ref; -null == o1 || o1(), null == o2 || o2.b(), null === (ref = o3.b) || void 0 === ref || ref.call(o3).c; +var _o3_b; +null == o1 || o1(), null == o2 || o2.b(), null === (_o3_b = o3.b) || void 0 === _o3_b || _o3_b.call(o3).c; diff --git a/crates/swc/tests/tsc-references/callChain.2.minified.js b/crates/swc/tests/tsc-references/callChain.2.minified.js index 5d1edc21cbcb..df0350c87759 100644 --- a/crates/swc/tests/tsc-references/callChain.2.minified.js +++ b/crates/swc/tests/tsc-references/callChain.2.minified.js @@ -1,5 +1,5 @@ //// [callChain.ts] -var _o2, _o21, _o22, _o23, ref, ref1, ref2, ref3, ref4, ref5, ref6, ref7, ref8, ref9, ref10, ref11, ref12; +var _o2, _o21, _o22, _o23, _o3_b, _o3_b1, _o3_b2, _o3_b3, _o3_b4, _o3_b5, _o3_b6, _o3_b7, _o3_b8, _o3_b9, _o3_b10, _o3_b11, _o5; null == o1 || o1(), null == o1 || o1(1), null == o1 || o1.apply(void 0, [ 1, 2 @@ -24,34 +24,34 @@ null == o1 || o1(), null == o1 || o1(1), null == o1 || o1.apply(void 0, [ 2, 3, 4 -]), null === (ref = o3.b) || void 0 === ref || ref.call(o3).c, null === (ref1 = o3.b) || void 0 === ref1 || ref1.call(o3, 1).c, null === (ref2 = o3.b) || void 0 === ref2 || ref2.call.apply(ref2, [ +]), null === (_o3_b = o3.b) || void 0 === _o3_b || _o3_b.call(o3).c, null === (_o3_b1 = o3.b) || void 0 === _o3_b1 || _o3_b1.call(o3, 1).c, null === (_o3_b2 = o3.b) || void 0 === _o3_b2 || _o3_b2.call.apply(_o3_b2, [ o3, 1, 2 -]).c, null === (ref3 = o3.b) || void 0 === ref3 || ref3.call.apply(ref3, [ +]).c, null === (_o3_b3 = o3.b) || void 0 === _o3_b3 || _o3_b3.call.apply(_o3_b3, [ o3, 1, 2, 3, 4 -]).c, null === (ref4 = o3.b) || void 0 === ref4 || ref4.call(o3).c, null === (ref5 = o3.b) || void 0 === ref5 || ref5.call(o3, 1).c, null === (ref6 = o3.b) || void 0 === ref6 || ref6.call.apply(ref6, [ +]).c, null === (_o3_b4 = o3.b) || void 0 === _o3_b4 || _o3_b4.call(o3).c, null === (_o3_b5 = o3.b) || void 0 === _o3_b5 || _o3_b5.call(o3, 1).c, null === (_o3_b6 = o3.b) || void 0 === _o3_b6 || _o3_b6.call.apply(_o3_b6, [ o3, 1, 2 -]).c, null === (ref7 = o3.b) || void 0 === ref7 || ref7.call.apply(ref7, [ +]).c, null === (_o3_b7 = o3.b) || void 0 === _o3_b7 || _o3_b7.call.apply(_o3_b7, [ o3, 1, 2, 3, 4 -]).c, null === (ref8 = o3.b) || void 0 === ref8 || ref8.call(o3).c, null === (ref9 = o3.b) || void 0 === ref9 || ref9.call(o3, 1).c, null === (ref10 = o3.b) || void 0 === ref10 || ref10.call.apply(ref10, [ +]).c, null === (_o3_b8 = o3.b) || void 0 === _o3_b8 || _o3_b8.call(o3).c, null === (_o3_b9 = o3.b) || void 0 === _o3_b9 || _o3_b9.call(o3, 1).c, null === (_o3_b10 = o3.b) || void 0 === _o3_b10 || _o3_b10.call.apply(_o3_b10, [ o3, 1, 2 -]).c, null === (ref11 = o3.b) || void 0 === ref11 || ref11.call.apply(ref11, [ +]).c, null === (_o3_b11 = o3.b) || void 0 === _o3_b11 || _o3_b11.call.apply(_o3_b11, [ o3, 1, 2, 3, 4 -]).c, null == o4 || o4(incr), null === (ref12 = o5()) || void 0 === ref12 || ref12(), null == o2 || o2.b().toString, null == o2 || o2.b().toString; +]).c, null == o4 || o4(incr), null === (_o5 = o5()) || void 0 === _o5 || _o5(), null == o2 || o2.b().toString, null == o2 || o2.b().toString; diff --git a/crates/swc/tests/tsc-references/callChain.3.1.normal.js b/crates/swc/tests/tsc-references/callChain.3.1.normal.js index f31360481c8c..c8e1c745cc2d 100644 --- a/crates/swc/tests/tsc-references/callChain.3.1.normal.js +++ b/crates/swc/tests/tsc-references/callChain.3.1.normal.js @@ -1,19 +1,19 @@ //// [callChain.3.ts] -var ref, ref1, ref2, ref3, ref4; -var n1 = a === null || a === void 0 ? void 0 : (ref = a.m) === null || ref === void 0 ? void 0 : ref.call(a, { +var _a_m, _a_m1, _a_m2, _a_m3, _a_m4; +var n1 = a === null || a === void 0 ? void 0 : (_a_m = a.m) === null || _a_m === void 0 ? void 0 : _a_m.call(a, { x: 12 }); // should be an error (`undefined` is not assignable to `number`) -var n2 = a === null || a === void 0 ? void 0 : (ref1 = a.m) === null || ref1 === void 0 ? void 0 : ref1.call(a, { +var n2 = a === null || a === void 0 ? void 0 : (_a_m1 = a.m) === null || _a_m1 === void 0 ? void 0 : _a_m1.call(a, { x: absorb() }); // likewise -var n3 = a === null || a === void 0 ? void 0 : (ref2 = a.m) === null || ref2 === void 0 ? void 0 : ref2.call(a, { +var n3 = a === null || a === void 0 ? void 0 : (_a_m2 = a.m) === null || _a_m2 === void 0 ? void 0 : _a_m2.call(a, { x: 12 }); // should be ok -var n4 = a === null || a === void 0 ? void 0 : (ref3 = a.m) === null || ref3 === void 0 ? void 0 : ref3.call(a, { +var n4 = a === null || a === void 0 ? void 0 : (_a_m3 = a.m) === null || _a_m3 === void 0 ? void 0 : _a_m3.call(a, { x: absorb() }); // likewise // Also a test showing `!` vs `?` for good measure -var t1 = a === null || a === void 0 ? void 0 : (ref4 = a.m) === null || ref4 === void 0 ? void 0 : ref4.call(a, { +var t1 = a === null || a === void 0 ? void 0 : (_a_m4 = a.m) === null || _a_m4 === void 0 ? void 0 : _a_m4.call(a, { x: 12 }); t1 = a.m({ diff --git a/crates/swc/tests/tsc-references/callChain.3.2.minified.js b/crates/swc/tests/tsc-references/callChain.3.2.minified.js index 2f26f8114f5c..b2640d160227 100644 --- a/crates/swc/tests/tsc-references/callChain.3.2.minified.js +++ b/crates/swc/tests/tsc-references/callChain.3.2.minified.js @@ -1,14 +1,14 @@ //// [callChain.3.ts] -var ref, ref1, ref2, ref3, ref4; -null == a || null === (ref = a.m) || void 0 === ref || ref.call(a, { +var _a_m, _a_m1, _a_m2, _a_m3, _a_m4; +null == a || null === (_a_m = a.m) || void 0 === _a_m || _a_m.call(a, { x: 12 -}), null == a || null === (ref1 = a.m) || void 0 === ref1 || ref1.call(a, { +}), null == a || null === (_a_m1 = a.m) || void 0 === _a_m1 || _a_m1.call(a, { x: absorb() -}), null == a || null === (ref2 = a.m) || void 0 === ref2 || ref2.call(a, { +}), null == a || null === (_a_m2 = a.m) || void 0 === _a_m2 || _a_m2.call(a, { x: 12 -}), null == a || null === (ref3 = a.m) || void 0 === ref3 || ref3.call(a, { +}), null == a || null === (_a_m3 = a.m) || void 0 === _a_m3 || _a_m3.call(a, { x: absorb() -}), null == a || null === (ref4 = a.m) || void 0 === ref4 || ref4.call(a, { +}), null == a || null === (_a_m4 = a.m) || void 0 === _a_m4 || _a_m4.call(a, { x: 12 }), a.m({ x: 12 diff --git a/crates/swc/tests/tsc-references/callChainWithSuper(target=es2015).1.normal.js b/crates/swc/tests/tsc-references/callChainWithSuper(target=es2015).1.normal.js index bed7b9c70b63..c2c6ba7e81ab 100644 --- a/crates/swc/tests/tsc-references/callChainWithSuper(target=es2015).1.normal.js +++ b/crates/swc/tests/tsc-references/callChainWithSuper(target=es2015).1.normal.js @@ -5,11 +5,11 @@ class Base { } class Derived extends Base { method1() { - var ref; - return (ref = super.method) === null || ref === void 0 ? void 0 : ref.call(this); + var _super_method; + return (_super_method = super.method) === null || _super_method === void 0 ? void 0 : _super_method.call(this); } method2() { - var ref; - return (ref = super["method"]) === null || ref === void 0 ? void 0 : ref.call(this); + var _super_method; + return (_super_method = super["method"]) === null || _super_method === void 0 ? void 0 : _super_method.call(this); } } diff --git a/crates/swc/tests/tsc-references/callChainWithSuper(target=es2016).1.normal.js b/crates/swc/tests/tsc-references/callChainWithSuper(target=es2016).1.normal.js index bed7b9c70b63..c2c6ba7e81ab 100644 --- a/crates/swc/tests/tsc-references/callChainWithSuper(target=es2016).1.normal.js +++ b/crates/swc/tests/tsc-references/callChainWithSuper(target=es2016).1.normal.js @@ -5,11 +5,11 @@ class Base { } class Derived extends Base { method1() { - var ref; - return (ref = super.method) === null || ref === void 0 ? void 0 : ref.call(this); + var _super_method; + return (_super_method = super.method) === null || _super_method === void 0 ? void 0 : _super_method.call(this); } method2() { - var ref; - return (ref = super["method"]) === null || ref === void 0 ? void 0 : ref.call(this); + var _super_method; + return (_super_method = super["method"]) === null || _super_method === void 0 ? void 0 : _super_method.call(this); } } diff --git a/crates/swc/tests/tsc-references/callChainWithSuper(target=es2017).1.normal.js b/crates/swc/tests/tsc-references/callChainWithSuper(target=es2017).1.normal.js index bed7b9c70b63..c2c6ba7e81ab 100644 --- a/crates/swc/tests/tsc-references/callChainWithSuper(target=es2017).1.normal.js +++ b/crates/swc/tests/tsc-references/callChainWithSuper(target=es2017).1.normal.js @@ -5,11 +5,11 @@ class Base { } class Derived extends Base { method1() { - var ref; - return (ref = super.method) === null || ref === void 0 ? void 0 : ref.call(this); + var _super_method; + return (_super_method = super.method) === null || _super_method === void 0 ? void 0 : _super_method.call(this); } method2() { - var ref; - return (ref = super["method"]) === null || ref === void 0 ? void 0 : ref.call(this); + var _super_method; + return (_super_method = super["method"]) === null || _super_method === void 0 ? void 0 : _super_method.call(this); } } diff --git a/crates/swc/tests/tsc-references/callChainWithSuper(target=es2018).1.normal.js b/crates/swc/tests/tsc-references/callChainWithSuper(target=es2018).1.normal.js index bed7b9c70b63..c2c6ba7e81ab 100644 --- a/crates/swc/tests/tsc-references/callChainWithSuper(target=es2018).1.normal.js +++ b/crates/swc/tests/tsc-references/callChainWithSuper(target=es2018).1.normal.js @@ -5,11 +5,11 @@ class Base { } class Derived extends Base { method1() { - var ref; - return (ref = super.method) === null || ref === void 0 ? void 0 : ref.call(this); + var _super_method; + return (_super_method = super.method) === null || _super_method === void 0 ? void 0 : _super_method.call(this); } method2() { - var ref; - return (ref = super["method"]) === null || ref === void 0 ? void 0 : ref.call(this); + var _super_method; + return (_super_method = super["method"]) === null || _super_method === void 0 ? void 0 : _super_method.call(this); } } diff --git a/crates/swc/tests/tsc-references/callChainWithSuper(target=es2019).1.normal.js b/crates/swc/tests/tsc-references/callChainWithSuper(target=es2019).1.normal.js index bed7b9c70b63..c2c6ba7e81ab 100644 --- a/crates/swc/tests/tsc-references/callChainWithSuper(target=es2019).1.normal.js +++ b/crates/swc/tests/tsc-references/callChainWithSuper(target=es2019).1.normal.js @@ -5,11 +5,11 @@ class Base { } class Derived extends Base { method1() { - var ref; - return (ref = super.method) === null || ref === void 0 ? void 0 : ref.call(this); + var _super_method; + return (_super_method = super.method) === null || _super_method === void 0 ? void 0 : _super_method.call(this); } method2() { - var ref; - return (ref = super["method"]) === null || ref === void 0 ? void 0 : ref.call(this); + var _super_method; + return (_super_method = super["method"]) === null || _super_method === void 0 ? void 0 : _super_method.call(this); } } diff --git a/crates/swc/tests/tsc-references/callChainWithSuper(target=es5).1.normal.js b/crates/swc/tests/tsc-references/callChainWithSuper(target=es5).1.normal.js index ba2b399197e1..61ac235e6eb2 100644 --- a/crates/swc/tests/tsc-references/callChainWithSuper(target=es5).1.normal.js +++ b/crates/swc/tests/tsc-references/callChainWithSuper(target=es5).1.normal.js @@ -24,12 +24,12 @@ var Derived = /*#__PURE__*/ function(Base) { } var _proto = Derived.prototype; _proto.method1 = function method1() { - var ref; - return (ref = _get(_get_prototype_of(Derived.prototype), "method", this)) === null || ref === void 0 ? void 0 : ref.call(this); + var _super_method; + return (_super_method = _get(_get_prototype_of(Derived.prototype), "method", this)) === null || _super_method === void 0 ? void 0 : _super_method.call(this); }; _proto.method2 = function method2() { - var ref; - return (ref = _get(_get_prototype_of(Derived.prototype), "method", this)) === null || ref === void 0 ? void 0 : ref.call(this); + var _super_method; + return (_super_method = _get(_get_prototype_of(Derived.prototype), "method", this)) === null || _super_method === void 0 ? void 0 : _super_method.call(this); }; return Derived; }(Base); diff --git a/crates/swc/tests/tsc-references/callWithSpread.1.normal.js b/crates/swc/tests/tsc-references/callWithSpread.1.normal.js index d776f588d2af..f3a7da00fe9c 100644 --- a/crates/swc/tests/tsc-references/callWithSpread.1.normal.js +++ b/crates/swc/tests/tsc-references/callWithSpread.1.normal.js @@ -5,7 +5,7 @@ import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; import _inherits from "@swc/helpers/src/_inherits.mjs"; import _to_consumable_array from "@swc/helpers/src/_to_consumable_array.mjs"; import _create_super from "@swc/helpers/src/_create_super.mjs"; -var _obj, _obj1, _obj2, _obj3, _instance, _obj4, _instance1, _obj5, _obj6, _obj7, _obj8, _instance2, _obj9, _instance3, _instance4, _instance5, _instance6; +var _obj, _obj1, _obj2, _obj3, _foo_apply, _obj4, _foo_apply1, _obj5, _obj6, _obj7, _obj8, _foo_apply2, _obj9, _foo_apply3, _xa_, _xa_1, _xa_2; function foo(x, y) { for(var _len = arguments.length, z = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++){ z[_key - 2] = arguments[_key]; @@ -41,17 +41,17 @@ obj.foo(1, 2, "abc"); 1, 2 ].concat(_to_consumable_array(a))).foo(1, 2, "abc"); -(_instance = (_obj3 = obj).foo.apply(_obj3, [ +(_foo_apply = (_obj3 = obj).foo.apply(_obj3, [ 1, 2 -].concat(_to_consumable_array(a)))).foo.apply(_instance, [ +].concat(_to_consumable_array(a)))).foo.apply(_foo_apply, [ 1, 2 ].concat(_to_consumable_array(a))); -(_instance1 = (_obj4 = obj).foo.apply(_obj4, [ +(_foo_apply1 = (_obj4 = obj).foo.apply(_obj4, [ 1, 2 -].concat(_to_consumable_array(a)))).foo.apply(_instance1, [ +].concat(_to_consumable_array(a)))).foo.apply(_foo_apply1, [ 1, 2 ].concat(_to_consumable_array(a), [ @@ -72,34 +72,34 @@ obj.foo(1, 2, "abc"); 1, 2 ].concat(_to_consumable_array(a))).foo(1, 2, "abc"); -(_instance2 = (_obj8 = obj).foo.apply(_obj8, [ +(_foo_apply2 = (_obj8 = obj).foo.apply(_obj8, [ 1, 2 -].concat(_to_consumable_array(a)))).foo.apply(_instance2, [ +].concat(_to_consumable_array(a)))).foo.apply(_foo_apply2, [ 1, 2 ].concat(_to_consumable_array(a))); -(_instance3 = (_obj9 = obj).foo.apply(_obj9, [ +(_foo_apply3 = (_obj9 = obj).foo.apply(_obj9, [ 1, 2 -].concat(_to_consumable_array(a)))).foo.apply(_instance3, [ +].concat(_to_consumable_array(a)))).foo.apply(_foo_apply3, [ 1, 2 ].concat(_to_consumable_array(a), [ "abc" ])); xa[1].foo(1, 2, "abc"); -(_instance4 = xa[1]).foo.apply(_instance4, [ +(_xa_ = xa[1]).foo.apply(_xa_, [ 1, 2 ].concat(_to_consumable_array(a))); -(_instance5 = xa[1]).foo.apply(_instance5, [ +(_xa_1 = xa[1]).foo.apply(_xa_1, [ 1, 2 ].concat(_to_consumable_array(a), [ "abc" ])); -(_instance6 = xa[1]).foo.apply(_instance6, [ +(_xa_2 = xa[1]).foo.apply(_xa_2, [ 1, 2, "abc" @@ -140,9 +140,9 @@ var D = /*#__PURE__*/ function(C) { } var _proto = D.prototype; _proto.foo = function foo() { - var _instance; + var _$_get; _get(_get_prototype_of(D.prototype), "foo", this).call(this, 1, 2); - (_instance = _get(_get_prototype_of(D.prototype), "foo", this)).call.apply(_instance, [ + (_$_get = _get(_get_prototype_of(D.prototype), "foo", this)).call.apply(_$_get, [ this, 1, 2 diff --git a/crates/swc/tests/tsc-references/callWithSpread.2.minified.js b/crates/swc/tests/tsc-references/callWithSpread.2.minified.js index 38531c1d719e..d18bc18b3fcc 100644 --- a/crates/swc/tests/tsc-references/callWithSpread.2.minified.js +++ b/crates/swc/tests/tsc-references/callWithSpread.2.minified.js @@ -1,5 +1,5 @@ //// [callWithSpread.ts] -var _instance, _instance1, _instance2, _instance3, _instance4, _instance5, _instance6, a, obj, xa; +var _foo_apply, _foo_apply1, _foo_apply2, _foo_apply3, _xa_, _xa_1, _xa_2, a, obj, xa; import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; import _get from "@swc/helpers/src/_get.mjs"; import _get_prototype_of from "@swc/helpers/src/_get_prototype_of.mjs"; @@ -28,16 +28,16 @@ foo(1, 2, "abc"), foo.apply(void 0, [ ])), obj.foo.apply(obj, [ 1, 2 -].concat(_to_consumable_array(a))).foo(1, 2, "abc"), (_instance = obj.foo.apply(obj, [ +].concat(_to_consumable_array(a))).foo(1, 2, "abc"), (_foo_apply = obj.foo.apply(obj, [ 1, 2 -].concat(_to_consumable_array(a)))).foo.apply(_instance, [ +].concat(_to_consumable_array(a)))).foo.apply(_foo_apply, [ 1, 2 -].concat(_to_consumable_array(a))), (_instance1 = obj.foo.apply(obj, [ +].concat(_to_consumable_array(a))), (_foo_apply1 = obj.foo.apply(obj, [ 1, 2 -].concat(_to_consumable_array(a)))).foo.apply(_instance1, [ +].concat(_to_consumable_array(a)))).foo.apply(_foo_apply1, [ 1, 2 ].concat(_to_consumable_array(a), [ @@ -53,29 +53,29 @@ foo(1, 2, "abc"), foo.apply(void 0, [ ])), obj.foo.apply(obj, [ 1, 2 -].concat(_to_consumable_array(a))).foo(1, 2, "abc"), (_instance2 = obj.foo.apply(obj, [ +].concat(_to_consumable_array(a))).foo(1, 2, "abc"), (_foo_apply2 = obj.foo.apply(obj, [ 1, 2 -].concat(_to_consumable_array(a)))).foo.apply(_instance2, [ +].concat(_to_consumable_array(a)))).foo.apply(_foo_apply2, [ 1, 2 -].concat(_to_consumable_array(a))), (_instance3 = obj.foo.apply(obj, [ +].concat(_to_consumable_array(a))), (_foo_apply3 = obj.foo.apply(obj, [ 1, 2 -].concat(_to_consumable_array(a)))).foo.apply(_instance3, [ +].concat(_to_consumable_array(a)))).foo.apply(_foo_apply3, [ 1, 2 ].concat(_to_consumable_array(a), [ "abc" -])), xa[1].foo(1, 2, "abc"), (_instance4 = xa[1]).foo.apply(_instance4, [ +])), xa[1].foo(1, 2, "abc"), (_xa_ = xa[1]).foo.apply(_xa_, [ 1, 2 -].concat(_to_consumable_array(a))), (_instance5 = xa[1]).foo.apply(_instance5, [ +].concat(_to_consumable_array(a))), (_xa_1 = xa[1]).foo.apply(_xa_1, [ 1, 2 ].concat(_to_consumable_array(a), [ "abc" -])), (_instance6 = xa[1]).foo.apply(_instance6, [ +])), (_xa_2 = xa[1]).foo.apply(_xa_2, [ 1, 2, "abc" diff --git a/crates/swc/tests/tsc-references/checkJsxChildrenCanBeTupleType.1.normal.js b/crates/swc/tests/tsc-references/checkJsxChildrenCanBeTupleType.1.normal.js index 6e6a0b4df4ab..efc678b0ffc9 100644 --- a/crates/swc/tests/tsc-references/checkJsxChildrenCanBeTupleType.1.normal.js +++ b/crates/swc/tests/tsc-references/checkJsxChildrenCanBeTupleType.1.normal.js @@ -4,9 +4,9 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; import _inherits from "@swc/helpers/src/_inherits.mjs"; import _create_super from "@swc/helpers/src/_create_super.mjs"; import React from "react"; -var ResizablePanel = /*#__PURE__*/ function(_Component) { +var ResizablePanel = /*#__PURE__*/ function(_React_Component) { "use strict"; - _inherits(ResizablePanel, _Component); + _inherits(ResizablePanel, _React_Component); var _super = _create_super(ResizablePanel); function ResizablePanel() { _class_call_check(this, ResizablePanel); diff --git a/crates/swc/tests/tsc-references/checkJsxSubtleSkipContextSensitiveBug.1.normal.js b/crates/swc/tests/tsc-references/checkJsxSubtleSkipContextSensitiveBug.1.normal.js index cc64fb597a3b..1e4ae1e29083 100644 --- a/crates/swc/tests/tsc-references/checkJsxSubtleSkipContextSensitiveBug.1.normal.js +++ b/crates/swc/tests/tsc-references/checkJsxSubtleSkipContextSensitiveBug.1.normal.js @@ -6,9 +6,9 @@ import _inherits from "@swc/helpers/src/_inherits.mjs"; import _create_super from "@swc/helpers/src/_create_super.mjs"; import _ts_generator from "@swc/helpers/src/_ts_generator.mjs"; import * as React from "react"; -var AsyncLoader = /*#__PURE__*/ function(_Component) { +var AsyncLoader = /*#__PURE__*/ function(_React_Component) { "use strict"; - _inherits(AsyncLoader, _Component); + _inherits(AsyncLoader, _React_Component); var _super = _create_super(AsyncLoader); function AsyncLoader() { _class_call_check(this, AsyncLoader); diff --git a/crates/swc/tests/tsc-references/circularImportAlias.1.normal.js b/crates/swc/tests/tsc-references/circularImportAlias.1.normal.js index 1e66f97b9679..b28ef28cea2c 100644 --- a/crates/swc/tests/tsc-references/circularImportAlias.1.normal.js +++ b/crates/swc/tests/tsc-references/circularImportAlias.1.normal.js @@ -7,9 +7,9 @@ var B; (function(B) { var a = A; B.a = a; - var D = /*#__PURE__*/ function(_C) { + var D = /*#__PURE__*/ function(_a_C) { "use strict"; - _inherits(D, _C); + _inherits(D, _a_C); var _super = _create_super(D); function D() { _class_call_check(this, D); diff --git a/crates/swc/tests/tsc-references/circularImportAlias.2.minified.js b/crates/swc/tests/tsc-references/circularImportAlias.2.minified.js index 51c4f569c1f1..fd98f48b9df2 100644 --- a/crates/swc/tests/tsc-references/circularImportAlias.2.minified.js +++ b/crates/swc/tests/tsc-references/circularImportAlias.2.minified.js @@ -6,9 +6,9 @@ import _create_super from "@swc/helpers/src/_create_super.mjs"; !function(B) { var a = A; B.a = a; - var D = function(_C) { + var D = function(_a_C) { "use strict"; - _inherits(D, _C); + _inherits(D, _a_C); var _super = _create_super(D); function D() { return _class_call_check(this, D), _super.apply(this, arguments); diff --git a/crates/swc/tests/tsc-references/classExtendingClassLikeType.1.normal.js b/crates/swc/tests/tsc-references/classExtendingClassLikeType.1.normal.js index 36640cb0454e..77f3eba7a3ec 100644 --- a/crates/swc/tests/tsc-references/classExtendingClassLikeType.1.normal.js +++ b/crates/swc/tests/tsc-references/classExtendingClassLikeType.1.normal.js @@ -13,9 +13,9 @@ var D0 = /*#__PURE__*/ function(Base1) { } return D0; }(Base); -var D1 = /*#__PURE__*/ function(_superClass) { +var D1 = /*#__PURE__*/ function(_getBase) { "use strict"; - _inherits(D1, _superClass); + _inherits(D1, _getBase); var _super = _create_super(D1); function D1() { _class_call_check(this, D1); @@ -27,9 +27,9 @@ var D1 = /*#__PURE__*/ function(_superClass) { } return D1; }(getBase()); -var D2 = /*#__PURE__*/ function(_superClass) { +var D2 = /*#__PURE__*/ function(_getBase) { "use strict"; - _inherits(D2, _superClass); + _inherits(D2, _getBase); var _super = _create_super(D2); function D2() { _class_call_check(this, D2); @@ -42,9 +42,9 @@ var D2 = /*#__PURE__*/ function(_superClass) { } return D2; }(getBase()); -var D3 = /*#__PURE__*/ function(_superClass) { +var D3 = /*#__PURE__*/ function(_getBase) { "use strict"; - _inherits(D3, _superClass); + _inherits(D3, _getBase); var _super = _create_super(D3); function D3() { _class_call_check(this, D3); @@ -57,9 +57,9 @@ var D3 = /*#__PURE__*/ function(_superClass) { return D3; }(getBase()); // Error, no constructors with three type arguments -var D4 = /*#__PURE__*/ function(_superClass) { +var D4 = /*#__PURE__*/ function(_getBase) { "use strict"; - _inherits(D4, _superClass); + _inherits(D4, _getBase); var _super = _create_super(D4); function D4() { _class_call_check(this, D4); @@ -68,9 +68,9 @@ var D4 = /*#__PURE__*/ function(_superClass) { return D4; }(getBase()); // Error, constructor return types differ -var D5 = /*#__PURE__*/ function(_superClass) { +var D5 = /*#__PURE__*/ function(_getBadBase) { "use strict"; - _inherits(D5, _superClass); + _inherits(D5, _getBadBase); var _super = _create_super(D5); function D5() { _class_call_check(this, D5); diff --git a/crates/swc/tests/tsc-references/classExtendingNonConstructor.1.normal.js b/crates/swc/tests/tsc-references/classExtendingNonConstructor.1.normal.js index eca4c31dd28e..904c6e5e1abe 100644 --- a/crates/swc/tests/tsc-references/classExtendingNonConstructor.1.normal.js +++ b/crates/swc/tests/tsc-references/classExtendingNonConstructor.1.normal.js @@ -46,9 +46,9 @@ var C4 = /*#__PURE__*/ function(_superClass) { } return C4; }(42); -var C5 = /*#__PURE__*/ function(_superClass) { +var C5 = /*#__PURE__*/ function(_hello) { "use strict"; - _inherits(C5, _superClass); + _inherits(C5, _hello); var _super = _create_super(C5); function C5() { _class_call_check(this, C5); diff --git a/crates/swc/tests/tsc-references/classExtendsItselfIndirectly2.1.normal.js b/crates/swc/tests/tsc-references/classExtendsItselfIndirectly2.1.normal.js index 8c195cc64de7..b96f60e4657b 100644 --- a/crates/swc/tests/tsc-references/classExtendsItselfIndirectly2.1.normal.js +++ b/crates/swc/tests/tsc-references/classExtendsItselfIndirectly2.1.normal.js @@ -2,9 +2,9 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; import _inherits from "@swc/helpers/src/_inherits.mjs"; import _create_super from "@swc/helpers/src/_create_super.mjs"; -var C = /*#__PURE__*/ function(_E) { +var C = /*#__PURE__*/ function(_N_E) { "use strict"; - _inherits(C, _E); + _inherits(C, _N_E); var _super = _create_super(C); function C() { _class_call_check(this, C); @@ -29,9 +29,9 @@ var M; })(M || (M = {})); var N; (function(N) { - var E = /*#__PURE__*/ function(_D) { + var E = /*#__PURE__*/ function(_M_D) { "use strict"; - _inherits(E, _D); + _inherits(E, _M_D); var _super = _create_super(E); function E() { _class_call_check(this, E); @@ -43,9 +43,9 @@ var N; })(N || (N = {})); var O; (function(O) { - var C2 = /*#__PURE__*/ function(_E2) { + var C2 = /*#__PURE__*/ function(_Q_E2) { "use strict"; - _inherits(C2, _E2); + _inherits(C2, _Q_E2); var _super = _create_super(C2); function C2() { _class_call_check(this, C2); @@ -70,9 +70,9 @@ var O; })(P || (P = {})); var Q; (function(Q) { - var E2 = /*#__PURE__*/ function(_D2) { + var E2 = /*#__PURE__*/ function(_P_D2) { "use strict"; - _inherits(E2, _D2); + _inherits(E2, _P_D2); var _super = _create_super(E2); function E2() { _class_call_check(this, E2); diff --git a/crates/swc/tests/tsc-references/classExtendsItselfIndirectly2.2.minified.js b/crates/swc/tests/tsc-references/classExtendsItselfIndirectly2.2.minified.js index 1bca648219f3..d67d63ab8b3a 100644 --- a/crates/swc/tests/tsc-references/classExtendsItselfIndirectly2.2.minified.js +++ b/crates/swc/tests/tsc-references/classExtendsItselfIndirectly2.2.minified.js @@ -2,9 +2,9 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; import _inherits from "@swc/helpers/src/_inherits.mjs"; import _create_super from "@swc/helpers/src/_create_super.mjs"; -var M, N, O, C = function(_E) { +var M, N, O, C = function(_N_E) { "use strict"; - _inherits(C, _E); + _inherits(C, _N_E); var _super = _create_super(C); function C() { return _class_call_check(this, C), _super.apply(this, arguments); @@ -23,9 +23,9 @@ var M, N, O, C = function(_E) { }(C); M.D = D; }(M || (M = {})), function(N) { - var E = function(_D) { + var E = function(_M_D) { "use strict"; - _inherits(E, _D); + _inherits(E, _M_D); var _super = _create_super(E); function E() { return _class_call_check(this, E), _super.apply(this, arguments); @@ -34,9 +34,9 @@ var M, N, O, C = function(_E) { }(M.D); N.E = E; }(N || (N = {})), function(O) { - var P, D2, Q, E2, P1, Q1, C2 = function(_E2) { + var P, D2, Q, E2, P1, Q1, C2 = function(_Q_E2) { "use strict"; - _inherits(C2, _E2); + _inherits(C2, _Q_E2); var _super = _create_super(C2); function C2() { return _class_call_check(this, C2), _super.apply(this, arguments); @@ -51,9 +51,9 @@ var M, N, O, C = function(_E) { return _class_call_check(this, D2), _super.apply(this, arguments); } return D2; - }(C2), P.D2 = D2, Q = Q1 || (Q1 = {}), E2 = function(_D2) { + }(C2), P.D2 = D2, Q = Q1 || (Q1 = {}), E2 = function(_P_D2) { "use strict"; - _inherits(E2, _D2); + _inherits(E2, _P_D2); var _super = _create_super(E2); function E2() { return _class_call_check(this, E2), _super.apply(this, arguments); diff --git a/crates/swc/tests/tsc-references/computedPropertyNames24_ES5.1.normal.js b/crates/swc/tests/tsc-references/computedPropertyNames24_ES5.1.normal.js index 735217ba4e17..1605f18cb678 100644 --- a/crates/swc/tests/tsc-references/computedPropertyNames24_ES5.1.normal.js +++ b/crates/swc/tests/tsc-references/computedPropertyNames24_ES5.1.normal.js @@ -13,7 +13,7 @@ var Base = /*#__PURE__*/ function() { }; return Base; }(); -var tmp = super.bar(); +var _super_bar = super.bar(); var C = /*#__PURE__*/ function(Base) { "use strict"; _inherits(C, Base); @@ -23,6 +23,6 @@ var C = /*#__PURE__*/ function(Base) { return _super.apply(this, arguments); } var _proto = C.prototype; - _proto[tmp] = function() {}; + _proto[_super_bar] = function() {}; return C; }(Base); diff --git a/crates/swc/tests/tsc-references/computedPropertyNames24_ES6.1.normal.js b/crates/swc/tests/tsc-references/computedPropertyNames24_ES6.1.normal.js index 9eb86a26dc27..fa9fb6be3193 100644 --- a/crates/swc/tests/tsc-references/computedPropertyNames24_ES6.1.normal.js +++ b/crates/swc/tests/tsc-references/computedPropertyNames24_ES6.1.normal.js @@ -4,9 +4,9 @@ class Base { return 0; } } -let tmp = super.bar(); +let _super_bar = super.bar(); class C extends Base { // Gets emitted as super, not _super, which is consistent with // use of super in static properties initializers. - [tmp]() {} + [_super_bar]() {} } diff --git a/crates/swc/tests/tsc-references/computedPropertyNames26_ES5.1.normal.js b/crates/swc/tests/tsc-references/computedPropertyNames26_ES5.1.normal.js index ad7781a7b634..13bafec9309c 100644 --- a/crates/swc/tests/tsc-references/computedPropertyNames26_ES5.1.normal.js +++ b/crates/swc/tests/tsc-references/computedPropertyNames26_ES5.1.normal.js @@ -14,7 +14,7 @@ var Base = /*#__PURE__*/ function() { }; return Base; }(); -var tmp = _define_property({}, super.bar(), 1)[0]; +var _ = _define_property({}, super.bar(), 1)[0]; var C = /*#__PURE__*/ function(Base) { "use strict"; _inherits(C, Base); @@ -24,6 +24,6 @@ var C = /*#__PURE__*/ function(Base) { return _super.apply(this, arguments); } var _proto = C.prototype; - _proto[tmp] = function() {}; + _proto[_] = function() {}; return C; }(Base); diff --git a/crates/swc/tests/tsc-references/computedPropertyNames26_ES6.1.normal.js b/crates/swc/tests/tsc-references/computedPropertyNames26_ES6.1.normal.js index 3732c3107e94..abd4f9580352 100644 --- a/crates/swc/tests/tsc-references/computedPropertyNames26_ES6.1.normal.js +++ b/crates/swc/tests/tsc-references/computedPropertyNames26_ES6.1.normal.js @@ -4,11 +4,11 @@ class Base { return 0; } } -let tmp = { +let _ = { [super.bar()]: 1 }[0]; class C extends Base { // Gets emitted as super, not _super, which is consistent with // use of super in static properties initializers. - [tmp]() {} + [_]() {} } diff --git a/crates/swc/tests/tsc-references/computedPropertyNames27_ES5.1.normal.js b/crates/swc/tests/tsc-references/computedPropertyNames27_ES5.1.normal.js index 91673d68df57..e9e36a3dc927 100644 --- a/crates/swc/tests/tsc-references/computedPropertyNames27_ES5.1.normal.js +++ b/crates/swc/tests/tsc-references/computedPropertyNames27_ES5.1.normal.js @@ -6,7 +6,7 @@ var Base = function Base() { "use strict"; _class_call_check(this, Base); }; -var tmp = (super(), "prop"); +var _tmp = (super(), "prop"); var C = /*#__PURE__*/ function(Base) { "use strict"; _inherits(C, Base); @@ -16,6 +16,6 @@ var C = /*#__PURE__*/ function(Base) { return _super.apply(this, arguments); } var _proto = C.prototype; - _proto[tmp] = function() {}; + _proto[_tmp] = function() {}; return C; }(Base); diff --git a/crates/swc/tests/tsc-references/computedPropertyNames27_ES6.1.normal.js b/crates/swc/tests/tsc-references/computedPropertyNames27_ES6.1.normal.js index 626fb37eae9b..6ab20e84d70a 100644 --- a/crates/swc/tests/tsc-references/computedPropertyNames27_ES6.1.normal.js +++ b/crates/swc/tests/tsc-references/computedPropertyNames27_ES6.1.normal.js @@ -1,7 +1,7 @@ //// [computedPropertyNames27_ES6.ts] class Base { } -let tmp = (super(), "prop"); +let _tmp = (super(), "prop"); class C extends Base { - [tmp]() {} + [_tmp]() {} } diff --git a/crates/swc/tests/tsc-references/contextuallyTypedBindingInitializer.1.normal.js b/crates/swc/tests/tsc-references/contextuallyTypedBindingInitializer.1.normal.js index c7aac59d2bc8..1dfc76fedb93 100644 --- a/crates/swc/tests/tsc-references/contextuallyTypedBindingInitializer.1.normal.js +++ b/crates/swc/tests/tsc-references/contextuallyTypedBindingInitializer.1.normal.js @@ -1,8 +1,8 @@ //// [contextuallyTypedBindingInitializer.ts] function f(param) { - var _show = param.show, show = _show === void 0 ? function(v) { + var _param_show = param.show, show = _param_show === void 0 ? function(v) { return v.toString(); - } : _show; + } : _param_show; } function f2(param) { var tmp = param["show"], showRename = tmp === void 0 ? function(v) { @@ -15,25 +15,25 @@ function f3(param) { } : tmp; } function ff(param) { - var _nested = param.nested, nested = _nested === void 0 ? { + var _param_nested = param.nested, nested = _param_nested === void 0 ? { show: function(v) { return v.toString(); } - } : _nested; + } : _param_nested; } function g(param) { - var _prop = param.prop, prop = _prop === void 0 ? [ + var _param_prop = param.prop, prop = _param_prop === void 0 ? [ "hello", 1234 - ] : _prop; + ] : _param_prop; } function h(param) { - var _prop = param.prop, prop = _prop === void 0 ? "foo" : _prop; + var _param_prop = param.prop, prop = _param_prop === void 0 ? "foo" : _param_prop; } -var ref = { +var _ref = { stringIdentity: function(x) { return x; } -}, tmp = ref.stringIdentity, id = tmp === void 0 ? function(arg) { +}, tmp = _ref.stringIdentity, id = tmp === void 0 ? function(arg) { return arg; } : tmp; diff --git a/crates/swc/tests/tsc-references/contextuallyTypedBindingInitializerNegative.1.normal.js b/crates/swc/tests/tsc-references/contextuallyTypedBindingInitializerNegative.1.normal.js index a14fbc4068a6..a006196dff76 100644 --- a/crates/swc/tests/tsc-references/contextuallyTypedBindingInitializerNegative.1.normal.js +++ b/crates/swc/tests/tsc-references/contextuallyTypedBindingInitializerNegative.1.normal.js @@ -21,19 +21,19 @@ function ff(param) { } } : tmp; } -var ref = { +var _ref = { stringIdentity: function(x) { return x; } -}, tmp = ref.stringIdentity, id = tmp === void 0 ? function(arg) { +}, tmp = _ref.stringIdentity, id = tmp === void 0 ? function(arg) { return arg.length; } : tmp; function g(param) { - var _prop = param.prop, prop = _prop === void 0 ? [ + var _param_prop = param.prop, prop = _param_prop === void 0 ? [ 101, 1234 - ] : _prop; + ] : _param_prop; } function h(param) { - var _prop = param.prop, prop = _prop === void 0 ? "baz" : _prop; + var _param_prop = param.prop, prop = _param_prop === void 0 ? "baz" : _param_prop; } diff --git a/crates/swc/tests/tsc-references/contextuallyTypedIife.1.normal.js b/crates/swc/tests/tsc-references/contextuallyTypedIife.1.normal.js index 6cb00ab9c5a9..fb14dc4490e7 100644 --- a/crates/swc/tests/tsc-references/contextuallyTypedIife.1.normal.js +++ b/crates/swc/tests/tsc-references/contextuallyTypedIife.1.normal.js @@ -68,23 +68,23 @@ q: 13 }); (function(param) { - var _p = param.p, p = _p === void 0 ? 14 : _p; + var _param_p = param.p, p = _param_p === void 0 ? 14 : _param_p; return p; })({ p: 15 }); (function() { - var ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : { + var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : { r: 18 - }, _r = ref.r, r = _r === void 0 ? 17 : _r; + }, _ref_r = _ref.r, r = _ref_r === void 0 ? 17 : _ref_r; return r; })({ r: 19 }); (function() { - var ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : { + var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : { u: 23 - }, _u = ref.u, u = _u === void 0 ? 22 : _u; + }, _ref_u = _ref.u, u = _ref_u === void 0 ? 22 : _ref_u; return u; })(); // contextually typed parameters. diff --git a/crates/swc/tests/tsc-references/contextuallyTypedIife.2.minified.js b/crates/swc/tests/tsc-references/contextuallyTypedIife.2.minified.js index ca7afce92bad..e81126c1886f 100644 --- a/crates/swc/tests/tsc-references/contextuallyTypedIife.2.minified.js +++ b/crates/swc/tests/tsc-references/contextuallyTypedIife.2.minified.js @@ -21,17 +21,17 @@ }(), function(first) { for(var _len = arguments.length, rest = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++)rest[_key - 1] = arguments[_key]; }(8, 9, 10), function() { - var ref = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : { + var _ref = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : { r: 18 }; - ref.r; + _ref.r; }({ r: 19 }), function() { - var ref = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : { + var _ref = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : { u: 23 }; - ref.u; + _ref.u; }(), function(o) { o.a(11); }({ diff --git a/crates/swc/tests/tsc-references/contextuallyTypedIifeStrict.1.normal.js b/crates/swc/tests/tsc-references/contextuallyTypedIifeStrict.1.normal.js index a33f92cbcf02..831c80e13c5b 100644 --- a/crates/swc/tests/tsc-references/contextuallyTypedIifeStrict.1.normal.js +++ b/crates/swc/tests/tsc-references/contextuallyTypedIifeStrict.1.normal.js @@ -68,23 +68,23 @@ q: 13 }); (function(param) { - var _p = param.p, p = _p === void 0 ? 14 : _p; + var _param_p = param.p, p = _param_p === void 0 ? 14 : _param_p; return p; })({ p: 15 }); (function() { - var ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : { + var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : { r: 18 - }, _r = ref.r, r = _r === void 0 ? 17 : _r; + }, _ref_r = _ref.r, r = _ref_r === void 0 ? 17 : _ref_r; return r; })({ r: 19 }); (function() { - var ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : { + var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : { u: 23 - }, _u = ref.u, u = _u === void 0 ? 22 : _u; + }, _ref_u = _ref.u, u = _ref_u === void 0 ? 22 : _ref_u; return u; })(); // contextually typed parameters. diff --git a/crates/swc/tests/tsc-references/contextuallyTypedIifeStrict.2.minified.js b/crates/swc/tests/tsc-references/contextuallyTypedIifeStrict.2.minified.js index 3f306031c173..a69b0c7a3eca 100644 --- a/crates/swc/tests/tsc-references/contextuallyTypedIifeStrict.2.minified.js +++ b/crates/swc/tests/tsc-references/contextuallyTypedIifeStrict.2.minified.js @@ -21,17 +21,17 @@ }(), function(first) { for(var _len = arguments.length, rest = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++)rest[_key - 1] = arguments[_key]; }(8, 9, 10), function() { - var ref = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : { + var _ref = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : { r: 18 }; - ref.r; + _ref.r; }({ r: 19 }), function() { - var ref = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : { + var _ref = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : { u: 23 }; - ref.u; + _ref.u; }(), function(o) { o.a(11); }({ diff --git a/crates/swc/tests/tsc-references/controlFlowDestructuringDeclaration.1.normal.js b/crates/swc/tests/tsc-references/controlFlowDestructuringDeclaration.1.normal.js index 8671dd168afc..7d8bbdf981b7 100644 --- a/crates/swc/tests/tsc-references/controlFlowDestructuringDeclaration.1.normal.js +++ b/crates/swc/tests/tsc-references/controlFlowDestructuringDeclaration.1.normal.js @@ -10,9 +10,9 @@ function f2() { x; var y = ""; y; - var ref = [ + var _ref = [ undefined - ], tmp = ref[0], z = tmp === void 0 ? "" : tmp; + ], tmp = _ref[0], z = tmp === void 0 ? "" : tmp; z; } function f3() { @@ -20,9 +20,9 @@ function f3() { x; var y = ""; y; - var ref = [ + var _ref = [ undefined - ], tmp = ref[0], z = tmp === void 0 ? "" : tmp; + ], tmp = _ref[0], z = tmp === void 0 ? "" : tmp; z; } function f4() { @@ -34,9 +34,9 @@ function f4() { y: "" }.y; y; - var ref = { + var _ref = { z: undefined - }, _z = ref.z, z = _z === void 0 ? "" : _z; + }, _ref_z = _ref.z, z = _ref_z === void 0 ? "" : _ref_z; z; } function f5() { @@ -48,9 +48,9 @@ function f5() { y: "" }.y; y; - var ref = { + var _ref = { z: undefined - }, _z = ref.z, z = _z === void 0 ? "" : _z; + }, _ref_z = _ref.z, z = _ref_z === void 0 ? "" : _ref_z; z; } function f6() { @@ -58,7 +58,7 @@ function f6() { x; var y = {}.y; y; - var ref = {}, _z = ref.z, z = _z === void 0 ? "" : _z; + var _ref = {}, _ref_z = _ref.z, z = _ref_z === void 0 ? "" : _ref_z; z; } function f7() { diff --git a/crates/swc/tests/tsc-references/controlFlowOptionalChain.1.normal.js b/crates/swc/tests/tsc-references/controlFlowOptionalChain.1.normal.js index 246d73d4bb75..32ddc6f4a8a8 100644 --- a/crates/swc/tests/tsc-references/controlFlowOptionalChain.1.normal.js +++ b/crates/swc/tests/tsc-references/controlFlowOptionalChain.1.normal.js @@ -2,7 +2,7 @@ // assignments in shortcutting chain import _instanceof from "@swc/helpers/src/_instanceof.mjs"; import _type_of from "@swc/helpers/src/_type_of.mjs"; -var ref, ref1, ref2, ref3, ref4, ref5, ref6, ref7, ref8; +var _o4_x, _o4_x1, _o5_x, _ref, _o5_x1, _o5_x2, _o5_x3, _ref1, _arr_i; var a; o === null || o === void 0 ? void 0 : o[a = 1]; a.toString(); @@ -54,42 +54,42 @@ if ((o3 === null || o3 === void 0 ? void 0 : o3.x) === 1) { o3; o3 === null || o3 === void 0 ? void 0 : o3.x; o3.x; -if ((ref = o4.x) === null || ref === void 0 ? void 0 : ref.y) { - var ref9; +if ((_o4_x = o4.x) === null || _o4_x === void 0 ? void 0 : _o4_x.y) { + var _o4_x2; o4.x; // { y: boolean } o4.x.y; // true - (ref9 = o4.x) === null || ref9 === void 0 ? void 0 : ref9.y; // true + (_o4_x2 = o4.x) === null || _o4_x2 === void 0 ? void 0 : _o4_x2.y; // true } else { - var ref10; + var _o4_x3; o4.x; - (ref10 = o4.x) === null || ref10 === void 0 ? void 0 : ref10.y; + (_o4_x3 = o4.x) === null || _o4_x3 === void 0 ? void 0 : _o4_x3.y; o4.x.y; } o4.x; -(ref1 = o4.x) === null || ref1 === void 0 ? void 0 : ref1.y; +(_o4_x1 = o4.x) === null || _o4_x1 === void 0 ? void 0 : _o4_x1.y; o4.x.y; -if ((ref3 = (ref2 = o5.x) === null || ref2 === void 0 ? void 0 : ref2.y.z) === null || ref3 === void 0 ? void 0 : ref3.w) { - var ref11, ref12, ref13, ref14; +if ((_ref = (_o5_x = o5.x) === null || _o5_x === void 0 ? void 0 : _o5_x.y.z) === null || _ref === void 0 ? void 0 : _ref.w) { + var _o5_x_y_z, _o5_x4, _o5_x5, _ref2; o5.x; o5.x.y; o5.x.y.z; o5.x.y.z.w; // true - (ref11 = o5.x.y.z) === null || ref11 === void 0 ? void 0 : ref11.w; // true - (ref12 = o5.x) === null || ref12 === void 0 ? void 0 : ref12.y.z.w; // true - (ref14 = (ref13 = o5.x) === null || ref13 === void 0 ? void 0 : ref13.y.z) === null || ref14 === void 0 ? void 0 : ref14.w; // true + (_o5_x_y_z = o5.x.y.z) === null || _o5_x_y_z === void 0 ? void 0 : _o5_x_y_z.w; // true + (_o5_x4 = o5.x) === null || _o5_x4 === void 0 ? void 0 : _o5_x4.y.z.w; // true + (_ref2 = (_o5_x5 = o5.x) === null || _o5_x5 === void 0 ? void 0 : _o5_x5.y.z) === null || _ref2 === void 0 ? void 0 : _ref2.w; // true } else { - var ref15, ref16, ref17, ref18; + var _o5_x6, _o5_x7, _o5_x8, _ref3; o5.x; - (ref15 = o5.x) === null || ref15 === void 0 ? void 0 : ref15.y; - (ref16 = o5.x) === null || ref16 === void 0 ? void 0 : ref16.y.z; - (ref18 = (ref17 = o5.x) === null || ref17 === void 0 ? void 0 : ref17.y.z) === null || ref18 === void 0 ? void 0 : ref18.w; + (_o5_x6 = o5.x) === null || _o5_x6 === void 0 ? void 0 : _o5_x6.y; + (_o5_x7 = o5.x) === null || _o5_x7 === void 0 ? void 0 : _o5_x7.y.z; + (_ref3 = (_o5_x8 = o5.x) === null || _o5_x8 === void 0 ? void 0 : _o5_x8.y.z) === null || _ref3 === void 0 ? void 0 : _ref3.w; o5.x.y; o5.x.y.z.w; } o5.x; -(ref4 = o5.x) === null || ref4 === void 0 ? void 0 : ref4.y; -(ref5 = o5.x) === null || ref5 === void 0 ? void 0 : ref5.y.z; -(ref7 = (ref6 = o5.x) === null || ref6 === void 0 ? void 0 : ref6.y.z) === null || ref7 === void 0 ? void 0 : ref7.w; +(_o5_x1 = o5.x) === null || _o5_x1 === void 0 ? void 0 : _o5_x1.y; +(_o5_x2 = o5.x) === null || _o5_x2 === void 0 ? void 0 : _o5_x2.y.z; +(_ref1 = (_o5_x3 = o5.x) === null || _o5_x3 === void 0 ? void 0 : _o5_x3.y.z) === null || _ref1 === void 0 ? void 0 : _ref1.w; o5.x.y; o5.x.y.z.w; if (o6 === null || o6 === void 0 ? void 0 : o6.f()) { @@ -452,8 +452,8 @@ function getArea(shape) { } } function extractCoordinates(f1) { - var ref; - if (((ref = f1.geometry) === null || ref === void 0 ? void 0 : ref.type) !== "test") { + var _f_geometry; + if (((_f_geometry = f1.geometry) === null || _f_geometry === void 0 ? void 0 : _f_geometry.type) !== "test") { return []; } return f1.geometry.coordinates; @@ -473,10 +473,10 @@ someFunction(someObject); someFunction(undefined); // Repro from #35970 var i = 0; -while(((ref8 = arr[i]) === null || ref8 === void 0 ? void 0 : ref8.tag) === "left"){ - var ref19; +while(((_arr_i = arr[i]) === null || _arr_i === void 0 ? void 0 : _arr_i.tag) === "left"){ + var _arr_i1; i += 1; - if (((ref19 = arr[i]) === null || ref19 === void 0 ? void 0 : ref19.tag) === "right") { + if (((_arr_i1 = arr[i]) === null || _arr_i1 === void 0 ? void 0 : _arr_i1.tag) === "right") { console.log("I should ALSO be reachable"); } } diff --git a/crates/swc/tests/tsc-references/controlFlowOptionalChain.2.minified.js b/crates/swc/tests/tsc-references/controlFlowOptionalChain.2.minified.js index 3b90d3892805..79b8ecd11f3c 100644 --- a/crates/swc/tests/tsc-references/controlFlowOptionalChain.2.minified.js +++ b/crates/swc/tests/tsc-references/controlFlowOptionalChain.2.minified.js @@ -2,7 +2,7 @@ function someFunction(someOptionalObject) { (null == someOptionalObject ? void 0 : someOptionalObject.someProperty) !== lastSomeProperty && (console.log(someOptionalObject), console.log(someOptionalObject.someProperty), lastSomeProperty = null == someOptionalObject ? void 0 : someOptionalObject.someProperty); } -null == o || o[a = 1], a.toString(), null == o || o.x[b = 1], b.toString(), null == o || o(c = 1), c.toString(), null == o || o.x(d = 1), d.toString(), null == f || f(x), f(x), f(x), (null == o2 ? void 0 : o2.f(x)) ? (o2.f, null == o2 || o2.f, null == o2 || o2.f(x)) : (null == o2 || o2.f, o2.f), null == o2 || o2.f, o2.f, (null == o3 ? void 0 : o3.x) === 1 ? (o3.x, null == o3 || o3.x) : (null == o3 || o3.x, o3.x), null == o3 || o3.x, o3.x, (null === (ref = o4.x) || void 0 === ref ? void 0 : ref.y) ? (o4.x, o4.x.y, null === (ref9 = o4.x) || void 0 === ref9 || ref9.y) : (o4.x, null === (ref10 = o4.x) || void 0 === ref10 || ref10.y, o4.x.y), o4.x, null === (ref1 = o4.x) || void 0 === ref1 || ref1.y, o4.x.y, (null === (ref3 = null === (ref2 = o5.x) || void 0 === ref2 ? void 0 : ref2.y.z) || void 0 === ref3 ? void 0 : ref3.w) ? (o5.x, o5.x.y, o5.x.y.z, o5.x.y.z.w, null === (ref11 = o5.x.y.z) || void 0 === ref11 || ref11.w, null === (ref12 = o5.x) || void 0 === ref12 || ref12.y.z.w, null === (ref14 = null === (ref13 = o5.x) || void 0 === ref13 ? void 0 : ref13.y.z) || void 0 === ref14 || ref14.w) : (o5.x, null === (ref15 = o5.x) || void 0 === ref15 || ref15.y, null === (ref16 = o5.x) || void 0 === ref16 || ref16.y.z, null === (ref18 = null === (ref17 = o5.x) || void 0 === ref17 ? void 0 : ref17.y.z) || void 0 === ref18 || ref18.w, o5.x.y, o5.x.y.z.w), o5.x, null === (ref4 = o5.x) || void 0 === ref4 || ref4.y, null === (ref5 = o5.x) || void 0 === ref5 || ref5.y.z, null === (ref7 = null === (ref6 = o5.x) || void 0 === ref6 ? void 0 : ref6.y.z) || void 0 === ref7 || ref7.w, o5.x.y, o5.x.y.z.w, (null == o6 ? void 0 : o6.f()) || null == o6 || o6.f, o6.f, null == o6 || o6.f, o6.f, someFunction({ +null == o || o[a = 1], a.toString(), null == o || o.x[b = 1], b.toString(), null == o || o(c = 1), c.toString(), null == o || o.x(d = 1), d.toString(), null == f || f(x), f(x), f(x), (null == o2 ? void 0 : o2.f(x)) ? (o2.f, null == o2 || o2.f, null == o2 || o2.f(x)) : (null == o2 || o2.f, o2.f), null == o2 || o2.f, o2.f, (null == o3 ? void 0 : o3.x) === 1 ? (o3.x, null == o3 || o3.x) : (null == o3 || o3.x, o3.x), null == o3 || o3.x, o3.x, (null === (_o4_x = o4.x) || void 0 === _o4_x ? void 0 : _o4_x.y) ? (o4.x, o4.x.y, null === (_o4_x2 = o4.x) || void 0 === _o4_x2 || _o4_x2.y) : (o4.x, null === (_o4_x3 = o4.x) || void 0 === _o4_x3 || _o4_x3.y, o4.x.y), o4.x, null === (_o4_x1 = o4.x) || void 0 === _o4_x1 || _o4_x1.y, o4.x.y, (null === (_ref = null === (_o5_x = o5.x) || void 0 === _o5_x ? void 0 : _o5_x.y.z) || void 0 === _ref ? void 0 : _ref.w) ? (o5.x, o5.x.y, o5.x.y.z, o5.x.y.z.w, null === (_o5_x_y_z = o5.x.y.z) || void 0 === _o5_x_y_z || _o5_x_y_z.w, null === (_o5_x4 = o5.x) || void 0 === _o5_x4 || _o5_x4.y.z.w, null === (_ref2 = null === (_o5_x5 = o5.x) || void 0 === _o5_x5 ? void 0 : _o5_x5.y.z) || void 0 === _ref2 || _ref2.w) : (o5.x, null === (_o5_x6 = o5.x) || void 0 === _o5_x6 || _o5_x6.y, null === (_o5_x7 = o5.x) || void 0 === _o5_x7 || _o5_x7.y.z, null === (_ref3 = null === (_o5_x8 = o5.x) || void 0 === _o5_x8 ? void 0 : _o5_x8.y.z) || void 0 === _ref3 || _ref3.w, o5.x.y, o5.x.y.z.w), o5.x, null === (_o5_x1 = o5.x) || void 0 === _o5_x1 || _o5_x1.y, null === (_o5_x2 = o5.x) || void 0 === _o5_x2 || _o5_x2.y.z, null === (_ref1 = null === (_o5_x3 = o5.x) || void 0 === _o5_x3 ? void 0 : _o5_x3.y.z) || void 0 === _ref1 || _ref1.w, o5.x.y, o5.x.y.z.w, (null == o6 ? void 0 : o6.f()) || null == o6 || o6.f, o6.f, null == o6 || o6.f, o6.f, someFunction({ someProperty: 42 }), someFunction(void 0); -for(var ref, ref1, ref2, ref3, ref4, ref5, ref6, ref7, ref8, a, b, c, d, ref9, ref10, ref11, ref12, ref13, ref14, ref15, ref16, ref17, ref18, lastSomeProperty, ref19, i = 0; (null === (ref8 = arr[i]) || void 0 === ref8 ? void 0 : ref8.tag) === "left";)i += 1, (null === (ref19 = arr[i]) || void 0 === ref19 ? void 0 : ref19.tag) === "right" && console.log("I should ALSO be reachable"); +for(var _o4_x, _o4_x1, _o5_x, _ref, _o5_x1, _o5_x2, _o5_x3, _ref1, _arr_i, a, b, c, d, _o4_x2, _o4_x3, _o5_x_y_z, _o5_x4, _o5_x5, _ref2, _o5_x6, _o5_x7, _o5_x8, _ref3, lastSomeProperty, _arr_i1, i = 0; (null === (_arr_i = arr[i]) || void 0 === _arr_i ? void 0 : _arr_i.tag) === "left";)i += 1, (null === (_arr_i1 = arr[i]) || void 0 === _arr_i1 ? void 0 : _arr_i1.tag) === "right" && console.log("I should ALSO be reachable"); diff --git a/crates/swc/tests/tsc-references/declarationsAndAssignments.1.normal.js b/crates/swc/tests/tsc-references/declarationsAndAssignments.1.normal.js index ea031acf8aa5..31f6831269c2 100644 --- a/crates/swc/tests/tsc-references/declarationsAndAssignments.1.normal.js +++ b/crates/swc/tests/tsc-references/declarationsAndAssignments.1.normal.js @@ -3,19 +3,19 @@ import _sliced_to_array from "@swc/helpers/src/_sliced_to_array.mjs"; import _throw from "@swc/helpers/src/_throw.mjs"; import _to_array from "@swc/helpers/src/_to_array.mjs"; function f0() { - var ref = [ + var _ref = [ 1, "hello" ]; - var ref1 = [ + var _ref1 = [ 1, "hello" - ], x = ref1[0]; + ], x = _ref1[0]; var x = 1, y = "hello"; - var ref2 = [ + var _ref2 = [ 1, "hello" - ], x = ref2[0], y = ref2[1], z = ref2[2]; + ], x = _ref2[0], y = _ref2[1], z = _ref2[2]; var x = 2; var x; var y; @@ -33,10 +33,10 @@ function f1() { var z; } function f2() { - var ref = { + var _ref = { x: 5, y: "hello" - }, ref = ref !== null ? ref : _throw(new TypeError("Cannot destructure undefined")); // Ok, empty binding pattern means nothing + }, _ref = _ref !== null ? _ref : _throw(new TypeError("Cannot destructure undefined")); // Ok, empty binding pattern means nothing var x = { x: 5, y: "hello" @@ -45,24 +45,24 @@ function f2() { x: 5, y: "hello" }.y; // Error, no x in target - var ref1 = { + var _ref1 = { x: 5, y: "hello" - }, x = ref1.x, y = ref1.y; + }, x = _ref1.x, y = _ref1.y; var x; var y; - var ref2 = { + var _ref2 = { x: 5, y: "hello" - }, a = ref2.x; // Error, no y in target - var ref3 = { + }, a = _ref2.x; // Error, no y in target + var _ref3 = { x: 5, y: "hello" - }, b = ref3.y; // Error, no x in target - var ref4 = { + }, b = _ref3.y; // Error, no x in target + var _ref4 = { x: 5, y: "hello" - }, a = ref4.x, b = ref4.y; + }, a = _ref4.x, b = _ref4.y; var a; var b; } @@ -73,7 +73,7 @@ function f3() { var z; } function f4() { - var ref = { + var _ref = { a: 1, b: { a: "hello", @@ -81,7 +81,7 @@ function f4() { a: true } } - }, x = ref.a, _b = ref.b, y = _b.a, _b1 = _b.b, z = _b1.a; + }, x = _ref.a, _ref_b = _ref.b, y = _ref_b.a, _ref_b_b = _ref_b.b, z = _ref_b_b.a; var x; var y; var z; @@ -97,40 +97,40 @@ function f7() { var y; } function f8() { - var ref = [], a = ref[0], b = ref[1], c = ref[2]; // Error, [] is an empty tuple - var ref1 = [ + var _ref = [], a = _ref[0], b = _ref[1], c = _ref[2]; // Error, [] is an empty tuple + var _ref1 = [ 1 - ], d = ref1[0], e = ref1[1], f = ref1[2]; // Error, [1] is a tuple + ], d = _ref1[0], e = _ref1[1], f = _ref1[2]; // Error, [1] is a tuple } function f9() { - var ref = _sliced_to_array({}, 2), a = ref[0], b = ref[1]; // Error, not array type - var ref1 = _sliced_to_array({ + var _ref = _sliced_to_array({}, 2), a = _ref[0], b = _ref[1]; // Error, not array type + var _ref1 = _sliced_to_array({ 0: 10, 1: 20 - }, 2), c = ref1[0], d = ref1[1]; // Error, not array type + }, 2), c = _ref1[0], d = _ref1[1]; // Error, not array type var e = 10, f = 20; } function f10() { - var ref = {}, a = ref.a, b = ref.b; // Error - var ref1 = [], a = ref1.a, b = ref1.b; // Error + var _ref = {}, a = _ref.a, b = _ref.b; // Error + var _ref1 = [], a = _ref1.a, b = _ref1.b; // Error } function f11() { - var ref = { + var _ref = { x: 10, y: "hello" - }, a = ref.x, b = ref.y; - var ref1 = { + }, a = _ref.x, b = _ref.y; + var _ref1 = { 0: 10, 1: "hello" - }, a = ref1[0], b = ref1[1]; - var ref2 = { + }, a = _ref1[0], b = _ref1[1]; + var _ref2 = { "<": 10, ">": "hello" - }, a = ref2["<"], b = ref2[">"]; - var ref3 = [ + }, a = _ref2["<"], b = _ref2[">"]; + var _ref3 = [ 10, "hello" - ], a = ref3[0], b = ref3[1]; + ], a = _ref3[0], b = _ref3[1]; var a; var b; } @@ -141,13 +141,13 @@ function f12() { x: 5, y: true } - ], ref = _sliced_to_array(tmp === void 0 ? [ + ], _ref = _sliced_to_array(tmp === void 0 ? [ "abc", { x: 10, y: false } - ] : tmp, 2), b = ref[0], ref1 = ref[1], x = ref1.x, c = ref1.y; + ] : tmp, 2), b = _ref[0], _ref_ = _ref[1], x = _ref_.x, c = _ref_.y; var a; var b; var x; @@ -155,7 +155,7 @@ function f12() { } function f13() { var x = 1, y = "hello"; - var ref = [ + var _ref = [ [ x, y @@ -164,10 +164,10 @@ function f13() { x: x, y: y } - ], a = ref[0], b = ref[1]; + ], a = _ref[0], b = _ref[1]; } function f14(param) { - var _param = _sliced_to_array(param, 2), tmp = _param[0], a = tmp === void 0 ? 1 : tmp, ref = _sliced_to_array(_param[1], 2), tmp1 = ref[0], b = tmp1 === void 0 ? "hello" : tmp1, ref1 = ref[1], x = ref1.x, tmp2 = ref1.y, c = tmp2 === void 0 ? false : tmp2; + var _param = _sliced_to_array(param, 2), tmp = _param[0], a = tmp === void 0 ? 1 : tmp, _param_ = _sliced_to_array(_param[1], 2), tmp1 = _param_[0], b = tmp1 === void 0 ? "hello" : tmp1, _param__ = _param_[1], x = _param__.x, tmp2 = _param__.y, c = tmp2 === void 0 ? false : tmp2; var a; var b; var c; @@ -215,10 +215,10 @@ function f15() { }; } function f16() { - var ref = f15(), a = ref.a, b = ref.b, c = ref.c; + var _f15 = f15(), a = _f15.a, b = _f15.b, c = _f15.c; } function f17(param) { - var _a = param.a, a = _a === void 0 ? "" : _a, _b = param.b, b = _b === void 0 ? 0 : _b, _c = param.c, c = _c === void 0 ? false : _c; + var _param_a = param.a, a = _param_a === void 0 ? "" : _param_a, _param_b = param.b, b = _param_b === void 0 ? 0 : _param_b, _param_c = param.c, c = _param_c === void 0 ? false : _param_c; } f17({}); f17({ diff --git a/crates/swc/tests/tsc-references/declarationsAndAssignments.2.minified.js b/crates/swc/tests/tsc-references/declarationsAndAssignments.2.minified.js index 78cf0f11317f..ca614eee86cd 100644 --- a/crates/swc/tests/tsc-references/declarationsAndAssignments.2.minified.js +++ b/crates/swc/tests/tsc-references/declarationsAndAssignments.2.minified.js @@ -2,8 +2,8 @@ var M; import _sliced_to_array from "@swc/helpers/src/_sliced_to_array.mjs"; function f14(param) { - var _param = _sliced_to_array(param, 2), ref = (_param[0], _sliced_to_array(_param[1], 2)), ref1 = (ref[0], ref[1]); - ref1.x, ref1.y; + var _param = _sliced_to_array(param, 2), _param_ = (_param[0], _sliced_to_array(_param[1], 2)), _param__ = (_param_[0], _param_[1]); + _param__.x, _param__.y; } function f17(param) { param.a, param.b, param.c; diff --git a/crates/swc/tests/tsc-references/defineProperty(target=es5).1.normal.js b/crates/swc/tests/tsc-references/defineProperty(target=es5).1.normal.js index 77f8f5678658..d2d7360e0845 100644 --- a/crates/swc/tests/tsc-references/defineProperty(target=es5).1.normal.js +++ b/crates/swc/tests/tsc-references/defineProperty(target=es5).1.normal.js @@ -7,7 +7,7 @@ import _inherits from "@swc/helpers/src/_inherits.mjs"; import _create_super from "@swc/helpers/src/_create_super.mjs"; var x = "p"; var _x = x; -var __x = _x; +var _x1 = _x; var A = /*#__PURE__*/ function() { "use strict"; function A(y) { @@ -16,7 +16,7 @@ var A = /*#__PURE__*/ function() { _define_property(this, "b", void 0); _define_property(this, "c", void 0); _define_property(this, "computed", void 0); - _define_property(this, __x, void 0); + _define_property(this, _x1, void 0); _define_property(this, "z", void 0); _define_property(this, "y", void 0); this.y = y; diff --git a/crates/swc/tests/tsc-references/deleteChain.1.normal.js b/crates/swc/tests/tsc-references/deleteChain.1.normal.js index ab249ce65441..1cdb6a25eba8 100644 --- a/crates/swc/tests/tsc-references/deleteChain.1.normal.js +++ b/crates/swc/tests/tsc-references/deleteChain.1.normal.js @@ -1,15 +1,15 @@ //// [deleteChain.ts] -var ref, ref1, ref2, ref3, ref4, ref5, ref6, ref7, ref8, ref9, ref10, ref11, ref12, ref13, ref14, ref15; +var _o3_b, _o3_b1, _o4_b, _ref, _o4_b1, _ref1, _o4_b2, _ref2, _o5_b, _ref3, _o5_b1, _ref4, _o6_b, _ref5, _o6_b1, _ref6; o1 === null || o1 === void 0 ? void 0 : delete o1.b; delete (o1 === null || o1 === void 0 ? void 0 : o1.b); o2 === null || o2 === void 0 ? void 0 : delete o2.b.c; o2 === null || o2 === void 0 ? void 0 : delete o2.b.c; -(ref = o3.b) === null || ref === void 0 ? void 0 : delete ref.c; -delete ((ref1 = o3.b) === null || ref1 === void 0 ? void 0 : ref1.c); -(ref3 = (ref2 = o4.b) === null || ref2 === void 0 ? void 0 : ref2.c.d) === null || ref3 === void 0 ? void 0 : delete ref3.e; -(ref5 = (ref4 = o4.b) === null || ref4 === void 0 ? void 0 : ref4.c.d) === null || ref5 === void 0 ? void 0 : delete ref5.e; -delete ((ref7 = (ref6 = o4.b) === null || ref6 === void 0 ? void 0 : ref6.c.d) === null || ref7 === void 0 ? void 0 : ref7.e); -(ref9 = (ref8 = o5.b) === null || ref8 === void 0 ? void 0 : ref8.call(o5).c.d) === null || ref9 === void 0 ? void 0 : delete ref9.e; -delete ((ref11 = (ref10 = o5.b) === null || ref10 === void 0 ? void 0 : ref10.call(o5).c.d) === null || ref11 === void 0 ? void 0 : ref11.e); -(ref13 = (ref12 = o6.b) === null || ref12 === void 0 ? void 0 : ref12["c"].d) === null || ref13 === void 0 ? void 0 : delete ref13["e"]; -delete ((ref15 = (ref14 = o6.b) === null || ref14 === void 0 ? void 0 : ref14["c"].d) === null || ref15 === void 0 ? void 0 : ref15["e"]); +(_o3_b = o3.b) === null || _o3_b === void 0 ? void 0 : delete _o3_b.c; +delete ((_o3_b1 = o3.b) === null || _o3_b1 === void 0 ? void 0 : _o3_b1.c); +(_ref = (_o4_b = o4.b) === null || _o4_b === void 0 ? void 0 : _o4_b.c.d) === null || _ref === void 0 ? void 0 : delete _ref.e; +(_ref1 = (_o4_b1 = o4.b) === null || _o4_b1 === void 0 ? void 0 : _o4_b1.c.d) === null || _ref1 === void 0 ? void 0 : delete _ref1.e; +delete ((_ref2 = (_o4_b2 = o4.b) === null || _o4_b2 === void 0 ? void 0 : _o4_b2.c.d) === null || _ref2 === void 0 ? void 0 : _ref2.e); +(_ref3 = (_o5_b = o5.b) === null || _o5_b === void 0 ? void 0 : _o5_b.call(o5).c.d) === null || _ref3 === void 0 ? void 0 : delete _ref3.e; +delete ((_ref4 = (_o5_b1 = o5.b) === null || _o5_b1 === void 0 ? void 0 : _o5_b1.call(o5).c.d) === null || _ref4 === void 0 ? void 0 : _ref4.e); +(_ref5 = (_o6_b = o6.b) === null || _o6_b === void 0 ? void 0 : _o6_b["c"].d) === null || _ref5 === void 0 ? void 0 : delete _ref5["e"]; +delete ((_ref6 = (_o6_b1 = o6.b) === null || _o6_b1 === void 0 ? void 0 : _o6_b1["c"].d) === null || _ref6 === void 0 ? void 0 : _ref6["e"]); diff --git a/crates/swc/tests/tsc-references/deleteChain.2.minified.js b/crates/swc/tests/tsc-references/deleteChain.2.minified.js index 2a737296b37a..57a234985d4f 100644 --- a/crates/swc/tests/tsc-references/deleteChain.2.minified.js +++ b/crates/swc/tests/tsc-references/deleteChain.2.minified.js @@ -1,3 +1,3 @@ //// [deleteChain.ts] -var ref, ref1, ref2, ref3, ref4, ref5, ref6, ref7, ref8, ref9, ref10, ref11, ref12, ref13, ref14, ref15; -null == o1 || delete o1.b, delete (null == o1 ? void 0 : o1.b), null == o2 || delete o2.b.c, null == o2 || delete o2.b.c, null === (ref = o3.b) || void 0 === ref || delete ref.c, delete (null === (ref1 = o3.b) || void 0 === ref1 ? void 0 : ref1.c), null === (ref3 = null === (ref2 = o4.b) || void 0 === ref2 ? void 0 : ref2.c.d) || void 0 === ref3 || delete ref3.e, null === (ref5 = null === (ref4 = o4.b) || void 0 === ref4 ? void 0 : ref4.c.d) || void 0 === ref5 || delete ref5.e, delete (null === (ref7 = null === (ref6 = o4.b) || void 0 === ref6 ? void 0 : ref6.c.d) || void 0 === ref7 ? void 0 : ref7.e), null === (ref9 = null === (ref8 = o5.b) || void 0 === ref8 ? void 0 : ref8.call(o5).c.d) || void 0 === ref9 || delete ref9.e, delete (null === (ref11 = null === (ref10 = o5.b) || void 0 === ref10 ? void 0 : ref10.call(o5).c.d) || void 0 === ref11 ? void 0 : ref11.e), null === (ref13 = null === (ref12 = o6.b) || void 0 === ref12 ? void 0 : ref12.c.d) || void 0 === ref13 || delete ref13.e, delete (null === (ref15 = null === (ref14 = o6.b) || void 0 === ref14 ? void 0 : ref14.c.d) || void 0 === ref15 ? void 0 : ref15.e); +var _o3_b, _o3_b1, _o4_b, _ref, _o4_b1, _ref1, _o4_b2, _ref2, _o5_b, _ref3, _o5_b1, _ref4, _o6_b, _ref5, _o6_b1, _ref6; +null == o1 || delete o1.b, delete (null == o1 ? void 0 : o1.b), null == o2 || delete o2.b.c, null == o2 || delete o2.b.c, null === (_o3_b = o3.b) || void 0 === _o3_b || delete _o3_b.c, delete (null === (_o3_b1 = o3.b) || void 0 === _o3_b1 ? void 0 : _o3_b1.c), null === (_ref = null === (_o4_b = o4.b) || void 0 === _o4_b ? void 0 : _o4_b.c.d) || void 0 === _ref || delete _ref.e, null === (_ref1 = null === (_o4_b1 = o4.b) || void 0 === _o4_b1 ? void 0 : _o4_b1.c.d) || void 0 === _ref1 || delete _ref1.e, delete (null === (_ref2 = null === (_o4_b2 = o4.b) || void 0 === _o4_b2 ? void 0 : _o4_b2.c.d) || void 0 === _ref2 ? void 0 : _ref2.e), null === (_ref3 = null === (_o5_b = o5.b) || void 0 === _o5_b ? void 0 : _o5_b.call(o5).c.d) || void 0 === _ref3 || delete _ref3.e, delete (null === (_ref4 = null === (_o5_b1 = o5.b) || void 0 === _o5_b1 ? void 0 : _o5_b1.call(o5).c.d) || void 0 === _ref4 ? void 0 : _ref4.e), null === (_ref5 = null === (_o6_b = o6.b) || void 0 === _o6_b ? void 0 : _o6_b.c.d) || void 0 === _ref5 || delete _ref5.e, delete (null === (_ref6 = null === (_o6_b1 = o6.b) || void 0 === _o6_b1 ? void 0 : _o6_b1.c.d) || void 0 === _ref6 ? void 0 : _ref6.e); diff --git a/crates/swc/tests/tsc-references/derivedClassSuperProperties.1.normal.js b/crates/swc/tests/tsc-references/derivedClassSuperProperties.1.normal.js index 9d4a6f459017..d4ccfad66b68 100644 --- a/crates/swc/tests/tsc-references/derivedClassSuperProperties.1.normal.js +++ b/crates/swc/tests/tsc-references/derivedClassSuperProperties.1.normal.js @@ -348,8 +348,8 @@ var DerivedWithClassDeclarationExtendingMember = /*#__PURE__*/ function(Base) { function DerivedWithClassDeclarationExtendingMember() { _class_call_check(this, DerivedWithClassDeclarationExtendingMember); var _this; - var InnerClass = /*#__PURE__*/ function(_memberClass) { - _inherits(InnerClass, _memberClass); + var InnerClass = /*#__PURE__*/ function(_this_memberClass) { + _inherits(InnerClass, _this_memberClass); var _super = _create_super(InnerClass); function InnerClass() { _class_call_check(this, InnerClass); @@ -407,8 +407,8 @@ var DerivedWithClassExpressionExtendingMember = /*#__PURE__*/ function(Base) { function DerivedWithClassExpressionExtendingMember() { _class_call_check(this, DerivedWithClassExpressionExtendingMember); var _this; - console.log(/*#__PURE__*/ function(_memberClass) { - _inherits(_class, _memberClass); + console.log(/*#__PURE__*/ function(_this_memberClass) { + _inherits(_class, _this_memberClass); var _super = _create_super(_class); function _class() { _class_call_check(this, _class); diff --git a/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment1ES5.1.normal.js b/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment1ES5.1.normal.js index f6ff5ed293ba..1d7ba5b507e2 100644 --- a/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment1ES5.1.normal.js +++ b/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment1ES5.1.normal.js @@ -35,23 +35,23 @@ function foo() { 3 ]; } -var ref = _sliced_to_array(foo(), 2), b6 = ref[0], b7 = ref[1]; -var ref1 = _to_array(foo()), b8 = ref1.slice(0); +var _foo = _sliced_to_array(foo(), 2), b6 = _foo[0], b7 = _foo[1]; +var _foo1 = _to_array(foo()), b8 = _foo1.slice(0); // S is not a tuple- like type and the numeric index signature type of S is assignable to the target given in E. var temp = [ 1, 2, 3 ]; -var ref2 = _sliced_to_array(_to_consumable_array(temp), 2), c0 = ref2[0], c1 = ref2[1]; -var ref3 = [], c2 = ref3[0]; -var ref4 = [], c3 = ref4[0], ref5 = [], c4 = ref5[0]; +var _$_to_consumable_array = _sliced_to_array(_to_consumable_array(temp), 2), c0 = _$_to_consumable_array[0], c1 = _$_to_consumable_array[1]; +var _ref = [], c2 = _ref[0]; +var _ref1 = [], c3 = _ref1[0], _ref2 = [], c4 = _ref2[0]; var c5 = 1, c6 = true; -var ref6 = [ +var _ref3 = [ 1, 2, 3 -], c7 = ref6[1]; +], c7 = _ref3[1]; var c8 = 4; var c9 = 4; var c10 = [ diff --git a/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment1ES5.2.minified.js b/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment1ES5.2.minified.js index 4bfcc395079d..81babdc056b9 100644 --- a/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment1ES5.2.minified.js +++ b/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment1ES5.2.minified.js @@ -6,19 +6,19 @@ var _undefined = _sliced_to_array(void 0, 2); _undefined[0], _undefined[1]; var _undefined1 = _sliced_to_array(void 0, 2); _undefined1[0], _undefined1[1]; -var ref = _sliced_to_array([ +var _foo = _sliced_to_array([ 1, 2, 3 ], 2); -ref[0], ref[1], _to_array([ +_foo[0], _foo[1], _to_array([ 1, 2, 3 ]).slice(0); -var ref1 = _sliced_to_array(_to_consumable_array([ +var _$_to_consumable_array = _sliced_to_array(_to_consumable_array([ 1, 2, 3 ]), 2); -ref1[0], ref1[1]; +_$_to_consumable_array[0], _$_to_consumable_array[1]; diff --git a/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment1ES5iterable.1.normal.js b/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment1ES5iterable.1.normal.js index bbc4b3936234..2970a2895323 100644 --- a/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment1ES5iterable.1.normal.js +++ b/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment1ES5iterable.1.normal.js @@ -35,23 +35,23 @@ function foo() { 3 ]; } -var ref = _sliced_to_array(foo(), 2), b6 = ref[0], b7 = ref[1]; -var ref1 = _to_array(foo()), b8 = ref1.slice(0); +var _foo = _sliced_to_array(foo(), 2), b6 = _foo[0], b7 = _foo[1]; +var _foo1 = _to_array(foo()), b8 = _foo1.slice(0); // S is not a tuple- like type and the numeric index signature type of S is assignable to the target given in E. var temp = [ 1, 2, 3 ]; -var ref2 = _sliced_to_array(_to_consumable_array(temp), 2), c0 = ref2[0], c1 = ref2[1]; -var ref3 = [], c2 = ref3[0]; -var ref4 = [], c3 = ref4[0], ref5 = [], c4 = ref5[0]; +var _$_to_consumable_array = _sliced_to_array(_to_consumable_array(temp), 2), c0 = _$_to_consumable_array[0], c1 = _$_to_consumable_array[1]; +var _ref = [], c2 = _ref[0]; +var _ref1 = [], c3 = _ref1[0], _ref2 = [], c4 = _ref2[0]; var c5 = 1, c6 = true; -var ref6 = [ +var _ref3 = [ 1, 2, 3 -], c7 = ref6[1]; +], c7 = _ref3[1]; var c8 = 4; var c9 = 4; var c10 = [ diff --git a/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment1ES5iterable.2.minified.js b/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment1ES5iterable.2.minified.js index ff708d768d9c..e23698457eb9 100644 --- a/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment1ES5iterable.2.minified.js +++ b/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment1ES5iterable.2.minified.js @@ -6,19 +6,19 @@ var _undefined = _sliced_to_array(void 0, 2); _undefined[0], _undefined[1]; var _undefined1 = _sliced_to_array(void 0, 2); _undefined1[0], _undefined1[1]; -var ref = _sliced_to_array([ +var _foo = _sliced_to_array([ 1, 2, 3 ], 2); -ref[0], ref[1], _to_array([ +_foo[0], _foo[1], _to_array([ 1, 2, 3 ]).slice(0); -var ref1 = _sliced_to_array(_to_consumable_array([ +var _$_to_consumable_array = _sliced_to_array(_to_consumable_array([ 1, 2, 3 ]), 2); -ref1[0], ref1[1]; +_$_to_consumable_array[0], _$_to_consumable_array[1]; diff --git a/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment2.1.normal.js b/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment2.1.normal.js index 726c7e3aff4e..4f52d288572c 100644 --- a/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment2.1.normal.js +++ b/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment2.1.normal.js @@ -3,10 +3,10 @@ // S is the type Any, or import _sliced_to_array from "@swc/helpers/src/_sliced_to_array.mjs"; import _to_consumable_array from "@swc/helpers/src/_to_consumable_array.mjs"; -var ref // Error - = [], ref1 = _sliced_to_array(ref[0], 1), a0 = ref1[0], ref2 = _sliced_to_array(ref[1], 1), ref3 = _sliced_to_array(ref2[0], 1), a1 = ref3[0]; +var _ref // Error + = [], _ref_ = _sliced_to_array(_ref[0], 1), a0 = _ref_[0], _ref_1 = _sliced_to_array(_ref[1], 1), _ref__ = _sliced_to_array(_ref_1[0], 1), a1 = _ref__[0]; var _undefined // Error - = _sliced_to_array(undefined, 2), ref4 = _sliced_to_array(_undefined[0], 1), a2 = ref4[0], ref5 = _sliced_to_array(_undefined[1], 1), ref6 = _sliced_to_array(ref5[0], 1), a3 = ref6[0]; + = _sliced_to_array(undefined, 2), _undefined_ = _sliced_to_array(_undefined[0], 1), a2 = _undefined_[0], _undefined_1 = _sliced_to_array(_undefined[1], 1), _undefined__ = _sliced_to_array(_undefined_1[0], 1), a3 = _undefined__[0]; // V is an array assignment pattern, S is the type Any or an array-like type (section 3.3.2), and, for each assignment element E in V, // S is a tuple- like type (section 3.3.3) with a property named N of a type that is assignable to the target given in E, // where N is the numeric index of E in the array assignment pattern, or @@ -18,7 +18,7 @@ function bar() { 3 ]; } -var ref7 = _sliced_to_array(bar(), 3), tmp = ref7[0], b3 = tmp === void 0 ? "string" : tmp, b4 = ref7[1], b5 = ref7[2]; // Error +var _bar = _sliced_to_array(bar(), 3), tmp = _bar[0], b3 = tmp === void 0 ? "string" : tmp, b4 = _bar[1], b5 = _bar[2]; // Error // V is an array assignment pattern, S is the type Any or an array-like type (section 3.3.2), and, for each assignment element E in V, // S is not a tuple- like type and the numeric index signature type of S is assignable to the target given in E. var temp = [ @@ -26,11 +26,11 @@ var temp = [ 2, 3 ]; -var ref8 = _sliced_to_array(_to_consumable_array(temp), 2), c0 = ref8[0], c1 = ref8[1]; // Error -var ref9 = _sliced_to_array(_to_consumable_array(temp), 2), c2 = ref9[0], c3 = ref9[1]; // Error +var _$_to_consumable_array = _sliced_to_array(_to_consumable_array(temp), 2), c0 = _$_to_consumable_array[0], c1 = _$_to_consumable_array[1]; // Error +var _$_to_consumable_array1 = _sliced_to_array(_to_consumable_array(temp), 2), c2 = _$_to_consumable_array1[0], c3 = _$_to_consumable_array1[1]; // Error function foo(idx) { return { 2: true }; } -var ref10 = _sliced_to_array(foo(1), 3), c4 = ref10[0], c5 = ref10[1], c6 = ref10[2]; // Error +var _foo = _sliced_to_array(foo(1), 3), c4 = _foo[0], c5 = _foo[1], c6 = _foo[2]; // Error diff --git a/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment2.2.minified.js b/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment2.2.minified.js index 17fa9bb7857a..b00317eb84f3 100644 --- a/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment2.2.minified.js +++ b/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment2.2.minified.js @@ -1,25 +1,25 @@ //// [destructuringArrayBindingPatternAndAssignment2.ts] import _sliced_to_array from "@swc/helpers/src/_sliced_to_array.mjs"; import _to_consumable_array from "@swc/helpers/src/_to_consumable_array.mjs"; -var ref = (_sliced_to_array([][0], 1)[0], _sliced_to_array([][1], 1)); -_sliced_to_array(ref[0], 1)[0]; -var _undefined = _sliced_to_array(void 0, 2), ref1 = (_sliced_to_array(_undefined[0], 1)[0], _sliced_to_array(_undefined[1], 1)); -_sliced_to_array(ref1[0], 1)[0]; -var ref2 = _sliced_to_array([ +var _ref_ = (_sliced_to_array([][0], 1)[0], _sliced_to_array([][1], 1)); +_sliced_to_array(_ref_[0], 1)[0]; +var _undefined = _sliced_to_array(void 0, 2), _undefined_ = (_sliced_to_array(_undefined[0], 1)[0], _sliced_to_array(_undefined[1], 1)); +_sliced_to_array(_undefined_[0], 1)[0]; +var _bar = _sliced_to_array([ 1, 2, 3 ], 3); -ref2[0], ref2[1], ref2[2]; +_bar[0], _bar[1], _bar[2]; var temp = [ 1, 2, 3 -], ref3 = _sliced_to_array(_to_consumable_array(temp), 2); -ref3[0], ref3[1]; -var ref4 = _sliced_to_array(_to_consumable_array(temp), 2); -ref4[0], ref4[1]; -var ref5 = _sliced_to_array({ +], _$_to_consumable_array = _sliced_to_array(_to_consumable_array(temp), 2); +_$_to_consumable_array[0], _$_to_consumable_array[1]; +var _$_to_consumable_array1 = _sliced_to_array(_to_consumable_array(temp), 2); +_$_to_consumable_array1[0], _$_to_consumable_array1[1]; +var _foo = _sliced_to_array({ 2: !0 }, 3); -ref5[0], ref5[1], ref5[2]; +_foo[0], _foo[1], _foo[2]; diff --git a/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment3.1.normal.js b/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment3.1.normal.js index 30adcf80de3b..caf60c5b414f 100644 --- a/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment3.1.normal.js +++ b/crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment3.1.normal.js @@ -1,14 +1,14 @@ //// [destructuringArrayBindingPatternAndAssignment3.ts] import _sliced_to_array from "@swc/helpers/src/_sliced_to_array.mjs"; -var ref = [ +var _ref = [ 1 -], a = ref[0], tmp = ref[1], b = tmp === void 0 ? a : tmp; // ok -var ref1 = [ +], a = _ref[0], tmp = _ref[1], b = tmp === void 0 ? a : tmp; // ok +var _ref1 = [ 1 -], c = ref1[0], tmp1 = ref1[1], d = tmp1 === void 0 ? c : tmp1, tmp2 = ref1[2], e = tmp2 === void 0 ? e : tmp2; // error for e = e -var ref2 = [ +], c = _ref1[0], tmp1 = _ref1[1], d = tmp1 === void 0 ? c : tmp1, tmp2 = _ref1[2], e = tmp2 === void 0 ? e : tmp2; // error for e = e +var _ref2 = [ 1 -], f = ref2[0], tmp3 = ref2[1], g = tmp3 === void 0 ? f : tmp3, tmp4 = ref2[2], h = tmp4 === void 0 ? i : tmp4, tmp5 = ref2[3], i = tmp5 === void 0 ? f : tmp5; // error for h = i +], f = _ref2[0], tmp3 = _ref2[1], g = tmp3 === void 0 ? f : tmp3, tmp4 = _ref2[2], h = tmp4 === void 0 ? i : tmp4, tmp5 = _ref2[3], i = tmp5 === void 0 ? f : tmp5; // error for h = i (function(param) { var _param = _sliced_to_array(param, 2), a = _param[0], tmp = _param[1], b = tmp === void 0 ? a : tmp; })([ diff --git a/crates/swc/tests/tsc-references/destructuringAssignabilityCheck.1.normal.js b/crates/swc/tests/tsc-references/destructuringAssignabilityCheck.1.normal.js index fcd0c14b1d52..786e1d0d3710 100644 --- a/crates/swc/tests/tsc-references/destructuringAssignabilityCheck.1.normal.js +++ b/crates/swc/tests/tsc-references/destructuringAssignabilityCheck.1.normal.js @@ -1,7 +1,7 @@ //// [destructuringAssignabilityCheck.ts] import _sliced_to_array from "@swc/helpers/src/_sliced_to_array.mjs"; import _throw from "@swc/helpers/src/_throw.mjs"; -var ref = _sliced_to_array({}, 0); // should be error +var _ref = _sliced_to_array({}, 0); // should be error var undefined = undefined !== null ? undefined : _throw(new TypeError("Cannot destructure undefined")); // error correctly (function(param) { var _param = _sliced_to_array(param, 0); @@ -19,5 +19,5 @@ function bar(param) { var _param = _sliced_to_array(param, 0); return 0; } -var ref1 = 1, ref1 = ref1 !== null ? ref1 : _throw(new TypeError("Cannot destructure undefined")); -var ref2 = _sliced_to_array({}, 0); +var _ref1 = 1, _ref1 = _ref1 !== null ? _ref1 : _throw(new TypeError("Cannot destructure undefined")); +var _ref2 = _sliced_to_array({}, 0); diff --git a/crates/swc/tests/tsc-references/destructuringAssignabilityCheck.2.minified.js b/crates/swc/tests/tsc-references/destructuringAssignabilityCheck.2.minified.js index f3bc3d3bdf13..daaa21caf033 100644 --- a/crates/swc/tests/tsc-references/destructuringAssignabilityCheck.2.minified.js +++ b/crates/swc/tests/tsc-references/destructuringAssignabilityCheck.2.minified.js @@ -6,5 +6,5 @@ var undefined = undefined; _sliced_to_array({}, 0), function(param) { var param = null !== param ? param : _throw(new TypeError("Cannot destructure undefined")); }(undefined); -var ref = 1, ref = null !== ref ? ref : _throw(new TypeError("Cannot destructure undefined")); +var _ref = 1, _ref = null !== _ref ? _ref : _throw(new TypeError("Cannot destructure undefined")); _sliced_to_array({}, 0); diff --git a/crates/swc/tests/tsc-references/destructuringCatch.1.normal.js b/crates/swc/tests/tsc-references/destructuringCatch.1.normal.js index 52d8226364a0..beee070403e8 100644 --- a/crates/swc/tests/tsc-references/destructuringCatch.1.normal.js +++ b/crates/swc/tests/tsc-references/destructuringCatch.1.normal.js @@ -28,7 +28,7 @@ try { } ]; } catch (param2) { - var _param1 = _sliced_to_array(param2, 1), ref = _param1[0], _x = _sliced_to_array(ref.x, 1), y = _x[0], z = ref.z; + var _param1 = _sliced_to_array(param2, 1), _param_ = _param1[0], _param__x = _sliced_to_array(_param_.x, 1), y = _param__x[0], z = _param_.z; y + z; } // Test of comment ranges. A fix to GH#11755 should update this. diff --git a/crates/swc/tests/tsc-references/destructuringCatch.2.minified.js b/crates/swc/tests/tsc-references/destructuringCatch.2.minified.js index f74a66759220..89d591858de6 100644 --- a/crates/swc/tests/tsc-references/destructuringCatch.2.minified.js +++ b/crates/swc/tests/tsc-references/destructuringCatch.2.minified.js @@ -27,6 +27,6 @@ try { } ]; } catch (param2) { - var ref = _sliced_to_array(param2, 1)[0]; - _sliced_to_array(ref.x, 1)[0], ref.z; + var _param_ = _sliced_to_array(param2, 1)[0]; + _sliced_to_array(_param_.x, 1)[0], _param_.z; } diff --git a/crates/swc/tests/tsc-references/destructuringControlFlow.1.normal.js b/crates/swc/tests/tsc-references/destructuringControlFlow.1.normal.js index d9920181003f..c0371761b784 100644 --- a/crates/swc/tests/tsc-references/destructuringControlFlow.1.normal.js +++ b/crates/swc/tests/tsc-references/destructuringControlFlow.1.normal.js @@ -36,7 +36,7 @@ function f4() { var ref1; ref1 = 0, x = ref1["x" + ""], ref1; // Errpr } -var ref = [ +var _ref = [ "foo" -], key = ref[0], value = ref[1]; +], key = _ref[0], value = _ref[1]; value.toUpperCase(); // Error diff --git a/crates/swc/tests/tsc-references/destructuringEvaluationOrder(target=es2015).1.normal.js b/crates/swc/tests/tsc-references/destructuringEvaluationOrder(target=es2015).1.normal.js index 1c89ed7a711d..268d63f16648 100644 --- a/crates/swc/tests/tsc-references/destructuringEvaluationOrder(target=es2015).1.normal.js +++ b/crates/swc/tests/tsc-references/destructuringEvaluationOrder(target=es2015).1.normal.js @@ -14,8 +14,8 @@ let [{ [order(1)]: y } = order(0)] = [ // order(0) should evaluate first (destructuring of object literal {}) // order(1) should evaluate next (initializer because property is undefined) // order(2) should evaluate last (evaluate object binding pattern from initializer) -let _ref = {}, key = order(0), key1 = order(2), { [key]: { [key1]: z } = order(1) } = _ref, w = _object_without_properties(_ref, [ - key +let _ref = {}, _order = order(0), _order1 = order(2), { [_order]: { [_order1]: z } = order(1) } = _ref, w = _object_without_properties(_ref, [ + _order ].map(_to_property_key)); // https://github.com/microsoft/TypeScript/issues/39181 // b = a must occur *after* 'a' has been assigned diff --git a/crates/swc/tests/tsc-references/destructuringEvaluationOrder(target=es2015).2.minified.js b/crates/swc/tests/tsc-references/destructuringEvaluationOrder(target=es2015).2.minified.js index 7386316131d3..9ba045803299 100644 --- a/crates/swc/tests/tsc-references/destructuringEvaluationOrder(target=es2015).2.minified.js +++ b/crates/swc/tests/tsc-references/destructuringEvaluationOrder(target=es2015).2.minified.js @@ -4,9 +4,9 @@ import _object_without_properties from "@swc/helpers/src/_object_without_propert import _to_property_key from "@swc/helpers/src/_to_property_key.mjs"; let trace = [], order = (n)=>trace.push(n), [{ [order(1)]: x } = order(0)] = [], [{ [order(1)]: y } = order(0)] = [ {} -], _ref = {}, key = order(0), key1 = order(2), { [key]: { [key1]: z } = order(1) } = _ref; +], _ref = {}, _order = order(0), _order1 = order(2), { [_order]: { [_order1]: z } = order(1) } = _ref; _object_without_properties(_ref, [ - key + _order ].map(_to_property_key)); let _ref1 = [ { diff --git a/crates/swc/tests/tsc-references/destructuringEvaluationOrder(target=es5).1.normal.js b/crates/swc/tests/tsc-references/destructuringEvaluationOrder(target=es5).1.normal.js index 7dfe3b9b8af9..3793fccac709 100644 --- a/crates/swc/tests/tsc-references/destructuringEvaluationOrder(target=es5).1.normal.js +++ b/crates/swc/tests/tsc-references/destructuringEvaluationOrder(target=es5).1.normal.js @@ -10,19 +10,19 @@ var order = function(n) { return trace.push(n); }; // order(0) should evaluate before order(1) because the first element is undefined -var ref = [], tmp = ref[0], ref1 = tmp === void 0 ? order(0) : tmp, x = ref1[order(1)]; +var _ref = [], tmp = _ref[0], _ref1 = tmp === void 0 ? order(0) : tmp, x = _ref1[order(1)]; // order(0) should not evaluate because the first element is defined -var tmp1 = {}, ref2 = tmp1 === void 0 ? order(0) : tmp1, y = ref2[order(1)]; +var tmp1 = {}, _ref2 = tmp1 === void 0 ? order(0) : tmp1, y = _ref2[order(1)]; // order(0) should evaluate first (destructuring of object literal {}) // order(1) should evaluate next (initializer because property is undefined) // order(2) should evaluate last (evaluate object binding pattern from initializer) -var _ref = {}, key = order(0), key1 = order(2), tmp2 = _ref[key], ref3 = tmp2 === void 0 ? order(1) : tmp2, z = ref3[key1], w = _object_without_properties(_ref, [ - key +var _ref3 = {}, _order = order(0), _order1 = order(2), tmp2 = _ref3[_order], _ref4 = tmp2 === void 0 ? order(1) : tmp2, z = _ref4[_order1], w = _object_without_properties(_ref3, [ + _order ].map(_to_property_key)); // https://github.com/microsoft/TypeScript/issues/39181 // b = a must occur *after* 'a' has been assigned -var _ref1 = [ +var _ref5 = [ { x: 1 } -], __ref = _sliced_to_array(_ref1, 2), ref4 = __ref[0], ref4 = ref4 !== null ? ref4 : _throw(new TypeError("Cannot destructure undefined")), tmp3 = __ref[1], b = tmp3 === void 0 ? a : tmp3, a = _extends({}, _ref1[0]); +], _ref6 = _sliced_to_array(_ref5, 2), _ref_ = _ref6[0], _ref_ = _ref_ !== null ? _ref_ : _throw(new TypeError("Cannot destructure undefined")), tmp3 = _ref6[1], b = tmp3 === void 0 ? a : tmp3, a = _extends({}, _ref5[0]); diff --git a/crates/swc/tests/tsc-references/destructuringEvaluationOrder(target=es5).2.minified.js b/crates/swc/tests/tsc-references/destructuringEvaluationOrder(target=es5).2.minified.js index 2b707545203c..3394bad5f4ba 100644 --- a/crates/swc/tests/tsc-references/destructuringEvaluationOrder(target=es5).2.minified.js +++ b/crates/swc/tests/tsc-references/destructuringEvaluationOrder(target=es5).2.minified.js @@ -10,13 +10,13 @@ var trace = [], order = function(n) { (void 0 === tmp ? order(0) : tmp)[order(1)]; var tmp1 = {}; (void 0 === tmp1 ? order(0) : tmp1)[order(1)]; -var _ref = {}, key = order(0), key1 = order(2), tmp2 = _ref[key]; -(void 0 === tmp2 ? order(1) : tmp2)[key1], _object_without_properties(_ref, [ - key +var _ref = {}, _order = order(0), _order1 = order(2), tmp2 = _ref[_order]; +(void 0 === tmp2 ? order(1) : tmp2)[_order1], _object_without_properties(_ref, [ + _order ].map(_to_property_key)); var _ref1 = [ { x: 1 } -], __ref = _sliced_to_array(_ref1, 2), ref = __ref[0], ref = null !== ref ? ref : _throw(new TypeError("Cannot destructure undefined")); -__ref[1], _extends({}, _ref1[0]); +], _ref2 = _sliced_to_array(_ref1, 2), _ref_ = _ref2[0], _ref_ = null !== _ref_ ? _ref_ : _throw(new TypeError("Cannot destructure undefined")); +_ref2[1], _extends({}, _ref1[0]); diff --git a/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment1ES5.1.normal.js b/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment1ES5.1.normal.js index 270491fa6ed2..818fcb7cd1b3 100644 --- a/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment1ES5.1.normal.js +++ b/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment1ES5.1.normal.js @@ -11,24 +11,24 @@ var a2 = {}.a2; var b1 = { b1: 1 }.b1; -var ref = { +var _ref = { b2: { b21: "world" } -}, tmp = ref.b2, b21 = (tmp === void 0 ? { +}, tmp = _ref.b2, b21 = (tmp === void 0 ? { b21: "string" } : tmp).b21; -var ref1 = { +var _ref1 = { 1: "string" -}, b3 = ref1[1]; -var ref2 = { +}, b3 = _ref1[1]; +var _ref2 = { b4: 100000 -}, _b4 = ref2.b4, b4 = _b4 === void 0 ? 1 : _b4; -var ref3 = { +}, _ref_b4 = _ref2.b4, b4 = _ref_b4 === void 0 ? 1 : _ref_b4; +var _ref3 = { b5: { b52: b52 } -}, b52 = ref3.b5.b52; +}, b52 = _ref3.b5.b52; function foo() { return { 1: true @@ -39,12 +39,12 @@ function bar() { 2: true }; } -var ref4 = foo(), c0 = ref4[1]; -var ref5 = bar(), c1 = ref5[1]; +var _foo = foo(), c0 = _foo[1]; +var _bar = bar(), c1 = _bar[1]; function foo1() { return { "prop1": 2 }; } -var ref6 = foo1(), d1 = ref6["prop1"]; -var ref7 = foo1(), d1 = ref7["prop2"]; +var _foo1 = foo1(), d1 = _foo1["prop1"]; +var _foo11 = foo1(), d1 = _foo11["prop2"]; diff --git a/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment4.1.normal.js b/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment4.1.normal.js index da65dcf9e58e..734806a5664f 100644 --- a/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment4.1.normal.js +++ b/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment4.1.normal.js @@ -1,3 +1,3 @@ //// [destructuringObjectBindingPatternAndAssignment4.ts] -var ref = {}, _a = ref.a, a = _a === void 0 ? 1 : _a, _b = ref.b, b = _b === void 0 ? 2 : _b, _c = ref.c, c = _c === void 0 ? b : _c, _d = ref.d, d = _d === void 0 ? a : _d, _e = ref.e, e = _e === void 0 ? f : _e, _f = ref.f, f = _f === void 0 ? f // error - : _f; +var _ref = {}, _ref_a = _ref.a, a = _ref_a === void 0 ? 1 : _ref_a, _ref_b = _ref.b, b = _ref_b === void 0 ? 2 : _ref_b, _ref_c = _ref.c, c = _ref_c === void 0 ? b : _ref_c, _ref_d = _ref.d, d = _ref_d === void 0 ? a : _ref_d, _ref_e = _ref.e, e = _ref_e === void 0 ? f : _ref_e, _ref_f = _ref.f, f = _ref_f === void 0 ? f // error + : _ref_f; diff --git a/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment4.2.minified.js b/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment4.2.minified.js index 177c9258f4b0..2c1b890e052f 100644 --- a/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment4.2.minified.js +++ b/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment4.2.minified.js @@ -1,2 +1,2 @@ //// [destructuringObjectBindingPatternAndAssignment4.ts] -var ref = {}, _f = (ref.a, ref.b, ref.c, ref.d, ref.e, ref.f), f = void 0 === _f ? f : _f; +var _ref = {}, _ref_f = (_ref.a, _ref.b, _ref.c, _ref.d, _ref.e, _ref.f), f = void 0 === _ref_f ? f : _ref_f; diff --git a/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment6(target=es5).1.normal.js b/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment6(target=es5).1.normal.js index 2f3af9cf1b5d..2807d624635f 100644 --- a/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment6(target=es5).1.normal.js +++ b/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment6(target=es5).1.normal.js @@ -2,8 +2,8 @@ import _define_property from "@swc/helpers/src/_define_property.mjs"; var a = "a"; var b = "b"; -var ref = function() { +var _ref = function() { var _obj; return _obj = {}, _define_property(_obj, a, 1), _define_property(_obj, b, 1), _obj; -}(), aVal = ref[a], bVal = ref[b]; +}(), aVal = _ref[a], bVal = _ref[b]; console.log(aVal, bVal); diff --git a/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment6(target=es5).2.minified.js b/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment6(target=es5).2.minified.js index 1ca32065845b..4fc3d251c480 100644 --- a/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment6(target=es5).2.minified.js +++ b/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment6(target=es5).2.minified.js @@ -1,7 +1,7 @@ //// [destructuringObjectBindingPatternAndAssignment6.ts] import _define_property from "@swc/helpers/src/_define_property.mjs"; -var ref = function() { +var _ref = function() { var _obj; return _define_property(_obj = {}, "a", 1), _define_property(_obj, "b", 1), _obj; }(); -console.log(ref.a, ref.b); +console.log(_ref.a, _ref.b); diff --git a/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment7(target=es5).1.normal.js b/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment7(target=es5).1.normal.js index 7b3343473f15..34469e968762 100644 --- a/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment7(target=es5).1.normal.js +++ b/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment7(target=es5).1.normal.js @@ -5,8 +5,8 @@ var K; K["a"] = "a"; K["b"] = "b"; })(K || (K = {})); -var ref = function() { +var _ref = function() { var _obj; return _obj = {}, _define_property(_obj, K.a, 1), _define_property(_obj, K.b, 1), _obj; -}(), aVal = ref[K.a], bVal = ref[K.b]; +}(), aVal = _ref[K.a], bVal = _ref[K.b]; console.log(aVal, bVal); 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 93fb0f447db0..d9044c828483 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 @@ -3,8 +3,8 @@ import _define_property from "@swc/helpers/src/_define_property.mjs"; !function(K) { K.a = "a", K.b = "b"; }(K || (K = {})); -var K, ref = function() { +var K, _ref = function() { var _obj; return _define_property(_obj = {}, K.a, 1), _define_property(_obj, K.b, 1), _obj; }(); -console.log(ref[K.a], ref[K.b]); +console.log(_ref[K.a], _ref[K.b]); diff --git a/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment8(target=es5).1.normal.js b/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment8(target=es5).1.normal.js index 14b9e7bae691..a5aad5371470 100644 --- a/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment8(target=es5).1.normal.js +++ b/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment8(target=es5).1.normal.js @@ -4,8 +4,8 @@ var K = { a: "a", b: "b" }; -var ref = function() { +var _ref = function() { var _obj; return _obj = {}, _define_property(_obj, K.a, 1), _define_property(_obj, K.b, 1), _obj; -}(), aVal = ref[K.a], bVal = ref[K.b]; +}(), aVal = _ref[K.a], bVal = _ref[K.b]; console.log(aVal, bVal); diff --git a/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment8(target=es5).2.minified.js b/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment8(target=es5).2.minified.js index ce3d6cff2f66..b95bc31e17ee 100644 --- a/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment8(target=es5).2.minified.js +++ b/crates/swc/tests/tsc-references/destructuringObjectBindingPatternAndAssignment8(target=es5).2.minified.js @@ -3,8 +3,8 @@ import _define_property from "@swc/helpers/src/_define_property.mjs"; var K = { a: "a", b: "b" -}, ref = function() { +}, _ref = function() { var _obj; return _define_property(_obj = {}, K.a, 1), _define_property(_obj, K.b, 1), _obj; }(); -console.log(ref[K.a], ref[K.b]); +console.log(_ref[K.a], _ref[K.b]); diff --git a/crates/swc/tests/tsc-references/destructuringParameterDeclaration3ES5iterable.1.normal.js b/crates/swc/tests/tsc-references/destructuringParameterDeclaration3ES5iterable.1.normal.js index 47c847b321ff..073b204f8c57 100644 --- a/crates/swc/tests/tsc-references/destructuringParameterDeclaration3ES5iterable.1.normal.js +++ b/crates/swc/tests/tsc-references/destructuringParameterDeclaration3ES5iterable.1.normal.js @@ -32,10 +32,10 @@ function a5() { } } function a9(param) { - var _param = _sliced_to_array(param, 3), a = _param[0], b = _param[1], ref = _sliced_to_array(_param[2], 1), ref1 = _sliced_to_array(ref[0], 1), c = ref1[0]; + var _param = _sliced_to_array(param, 3), a = _param[0], b = _param[1], _param_ = _sliced_to_array(_param[2], 1), _param__ = _sliced_to_array(_param_[0], 1), c = _param__[0]; } function a10(param) { - var _param = _to_array(param), a = _param[0], b = _param[1], ref = _sliced_to_array(_param[2], 1), ref1 = _sliced_to_array(ref[0], 1), c = ref1[0], x = _param.slice(3); + var _param = _to_array(param), a = _param[0], b = _param[1], _param_ = _sliced_to_array(_param[2], 1), _param__ = _sliced_to_array(_param_[0], 1), c = _param__[0], x = _param.slice(3); } function a11(param) { var _param = _to_array(param), a = _param[0], b = _param[1], c = _param[2], x = _param.slice(3); diff --git a/crates/swc/tests/tsc-references/destructuringParameterDeclaration3ES5iterable.2.minified.js b/crates/swc/tests/tsc-references/destructuringParameterDeclaration3ES5iterable.2.minified.js index ae3f380a2e1e..59f13d5f4714 100644 --- a/crates/swc/tests/tsc-references/destructuringParameterDeclaration3ES5iterable.2.minified.js +++ b/crates/swc/tests/tsc-references/destructuringParameterDeclaration3ES5iterable.2.minified.js @@ -3,8 +3,8 @@ import _sliced_to_array from "@swc/helpers/src/_sliced_to_array.mjs"; import _to_array from "@swc/helpers/src/_to_array.mjs"; import _to_consumable_array from "@swc/helpers/src/_to_consumable_array.mjs"; function a10(param) { - var _param = _to_array(param), ref = (_param[0], _param[1], _sliced_to_array(_param[2], 1)); - _sliced_to_array(ref[0], 1)[0], _param.slice(3); + 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 E, E1, array = [ 1, @@ -22,8 +22,8 @@ function foo1() { }(_to_consumable_array(array)), (function() { for(var _len = arguments.length, x = Array(_len), _key = 0; _key < _len; _key++)x[_key] = arguments[_key]; }).apply(void 0, _to_consumable_array(array)), function(param) { - var _param = _sliced_to_array(param, 3), ref = (_param[0], _param[1], _sliced_to_array(_param[2], 1)); - _sliced_to_array(ref[0], 1)[0]; + var _param = _sliced_to_array(param, 3), _param_ = (_param[0], _param[1], _sliced_to_array(_param[2], 1)); + _sliced_to_array(_param_[0], 1)[0]; }([ 1, 2, diff --git a/crates/swc/tests/tsc-references/destructuringParameterDeclaration8.1.normal.js b/crates/swc/tests/tsc-references/destructuringParameterDeclaration8.1.normal.js index 8765993bc4b8..ebf6124faf5a 100644 --- a/crates/swc/tests/tsc-references/destructuringParameterDeclaration8.1.normal.js +++ b/crates/swc/tests/tsc-references/destructuringParameterDeclaration8.1.normal.js @@ -2,7 +2,7 @@ // explicit type annotation should cause `method` to have type 'x' | 'y' // both inside and outside `test`. function test(param) { - var _method = param.method, method = _method === void 0 ? "z" : _method, _nested = param.nested, _p = _nested.p, p = _p === void 0 ? "c" : _p; + var _param_method = param.method, method = _param_method === void 0 ? "z" : _param_method, _param_nested = param.nested, _param_nested_p = _param_nested.p, p = _param_nested_p === void 0 ? "c" : _param_nested_p; method; p; } diff --git a/crates/swc/tests/tsc-references/destructuringSpread.1.normal.js b/crates/swc/tests/tsc-references/destructuringSpread.1.normal.js index 7797787f1c68..217974f3ddca 100644 --- a/crates/swc/tests/tsc-references/destructuringSpread.1.normal.js +++ b/crates/swc/tests/tsc-references/destructuringSpread.1.normal.js @@ -7,13 +7,13 @@ var x = _object_spread_props(_object_spread({}, {}), { var y = _object_spread({ y: 0 }, {}).y; -var ref = _object_spread({ +var _$_object_spread = _object_spread({ z: 0 }, { a: 0, b: 0 -}), z = ref.z, a = ref.a, b = ref.b; -var ref1 = _object_spread_props(_object_spread({}, _object_spread_props(_object_spread({}, _object_spread_props(_object_spread({}, { +}), z = _$_object_spread.z, a = _$_object_spread.a, b = _$_object_spread.b; +var _$_object_spread_props = _object_spread_props(_object_spread({}, _object_spread_props(_object_spread({}, _object_spread_props(_object_spread({}, { c: 0 }), { d: 0 @@ -21,4 +21,4 @@ var ref1 = _object_spread_props(_object_spread({}, _object_spread_props(_object_ e: 0 })), { f: 0 -}), c = ref1.c, d = ref1.d, e = ref1.e, f = ref1.f, g = ref1.g; +}), c = _$_object_spread_props.c, d = _$_object_spread_props.d, e = _$_object_spread_props.e, f = _$_object_spread_props.f, g = _$_object_spread_props.g; diff --git a/crates/swc/tests/tsc-references/destructuringSpread.2.minified.js b/crates/swc/tests/tsc-references/destructuringSpread.2.minified.js index 2c6fbb29cf57..b0dc40098acd 100644 --- a/crates/swc/tests/tsc-references/destructuringSpread.2.minified.js +++ b/crates/swc/tests/tsc-references/destructuringSpread.2.minified.js @@ -6,14 +6,14 @@ _object_spread_props(_object_spread({}, {}), { }).x, _object_spread({ y: 0 }, {}).y; -var ref = _object_spread({ +var _$_object_spread = _object_spread({ z: 0 }, { a: 0, b: 0 }); -ref.z, ref.a, ref.b; -var ref1 = _object_spread_props(_object_spread({}, _object_spread_props(_object_spread({}, _object_spread_props(_object_spread({}, { +_$_object_spread.z, _$_object_spread.a, _$_object_spread.b; +var _$_object_spread_props = _object_spread_props(_object_spread({}, _object_spread_props(_object_spread({}, _object_spread_props(_object_spread({}, { c: 0 }), { d: 0 @@ -22,4 +22,4 @@ var ref1 = _object_spread_props(_object_spread({}, _object_spread_props(_object_ })), { f: 0 }); -ref1.c, ref1.d, ref1.e, ref1.f, ref1.g; +_$_object_spread_props.c, _$_object_spread_props.d, _$_object_spread_props.e, _$_object_spread_props.f, _$_object_spread_props.g; diff --git a/crates/swc/tests/tsc-references/destructuringVariableDeclaration1ES5.1.normal.js b/crates/swc/tests/tsc-references/destructuringVariableDeclaration1ES5.1.normal.js index 3d63e435c9e7..0e84e1fb41c5 100644 --- a/crates/swc/tests/tsc-references/destructuringVariableDeclaration1ES5.1.normal.js +++ b/crates/swc/tests/tsc-references/destructuringVariableDeclaration1ES5.1.normal.js @@ -3,18 +3,18 @@ // If the declaration includes a type annotation, T is that type. import _sliced_to_array from "@swc/helpers/src/_sliced_to_array.mjs"; import _to_consumable_array from "@swc/helpers/src/_to_consumable_array.mjs"; -var ref = { +var _ref = { a1: 10, a2: "world" -}, a1 = ref.a1, a2 = ref.a2; +}, a1 = _ref.a1, a2 = _ref.a2; var a3 = 1, a4 = "hello", a5 = true; // The type T associated with a destructuring variable declaration is determined as follows: // Otherwise, if the declaration includes an initializer expression, T is the type of that initializer expression. -var ref1 = { +var _ref1 = { b1: { b11: "world" } -}, tmp = ref1.b1, b11 = (tmp === void 0 ? { +}, tmp = _ref1.b1, b11 = (tmp === void 0 ? { b11: "string" } : tmp).b11; var temp = { @@ -25,11 +25,11 @@ var tmp1 = 3, b2 = tmp1 === void 0 ? 3 : tmp1, tmp2 = false, b3 = tmp2 === void t1: false, t2: "hello" }, b4 = tmp3 === void 0 ? temp : tmp3; -var ref2 = [ +var _ref2 = [ undefined, undefined, undefined -], tmp4 = ref2[0], b5 = tmp4 === void 0 ? 3 : tmp4, tmp5 = ref2[1], b6 = tmp5 === void 0 ? true : tmp5, tmp6 = ref2[2], b7 = tmp6 === void 0 ? temp : tmp6; +], tmp4 = _ref2[0], b5 = tmp4 === void 0 ? 3 : tmp4, tmp5 = _ref2[1], b6 = tmp5 === void 0 ? true : tmp5, tmp6 = _ref2[2], b7 = tmp6 === void 0 ? temp : tmp6; // The type T associated with a binding element is determined as follows: // If the binding element is a rest element, T is an array type with // an element type E, where E is the type of the numeric index signature of S. @@ -57,12 +57,12 @@ var temp1 = [ false, true ]; -var ref3 = _sliced_to_array([ +var _concat = _sliced_to_array([ 1, "string" -].concat(_to_consumable_array(temp1)), 2), d3 = ref3[0], d4 = ref3[1]; +].concat(_to_consumable_array(temp1)), 2), d3 = _concat[0], d4 = _concat[1]; // Combining both forms of destructuring, -var ref4 = { +var _ref3 = { e: [ 1, 2, @@ -71,11 +71,11 @@ var ref4 = { b4: 0 } ] -}, _e = _sliced_to_array(ref4.e, 3), e1 = _e[0], e2 = _e[1], tmp7 = _e[2], e3 = tmp7 === void 0 ? { +}, _ref_e = _sliced_to_array(_ref3.e, 3), e1 = _ref_e[0], e2 = _ref_e[1], tmp7 = _ref_e[2], e3 = tmp7 === void 0 ? { b1: 1000, b4: 200 } : tmp7; -var ref5 = { +var _ref4 = { f: [ 1, 2, @@ -84,29 +84,29 @@ var ref5 = { f5: 0 } ] -}, _f = _sliced_to_array(ref5.f, 3), f1 = _f[0], f2 = _f[1], ref6 = _f[2], f4 = ref6.f3, f5 = ref6.f5; +}, _ref_f = _sliced_to_array(_ref4.f, 3), f1 = _ref_f[0], f2 = _ref_f[1], _ref_f_ = _ref_f[2], f4 = _ref_f_.f3, f5 = _ref_f_.f5; // When a destructuring variable declaration, binding property, or binding element specifies // an initializer expression, the type of the initializer expression is required to be assignable // to the widened form of the type associated with the destructuring variable declaration, binding property, or binding element. -var ref7 = { +var _ref5 = { g: { g1: [ 1, 2 ] } -}, _g = ref7.g, _g1 = _g.g1, g1 = _g1 === void 0 ? [ +}, _ref_g = _ref5.g, _ref_g_g1 = _ref_g.g1, g1 = _ref_g_g1 === void 0 ? [ undefined, null -] : _g1; -var ref8 = { +] : _ref_g_g1; +var _ref6 = { h: { h1: [ 1, 2 ] } -}, _h = ref8.h, _h1 = _h.h1, h1 = _h1 === void 0 ? [ +}, _ref_h = _ref6.h, _ref_h_h1 = _ref_h.h1, h1 = _ref_h_h1 === void 0 ? [ undefined, null -] : _h1; +] : _ref_h_h1; diff --git a/crates/swc/tests/tsc-references/destructuringVariableDeclaration1ES5.2.minified.js b/crates/swc/tests/tsc-references/destructuringVariableDeclaration1ES5.2.minified.js index 7d23e0dba716..f7f5997e3c73 100644 --- a/crates/swc/tests/tsc-references/destructuringVariableDeclaration1ES5.2.minified.js +++ b/crates/swc/tests/tsc-references/destructuringVariableDeclaration1ES5.2.minified.js @@ -1,24 +1,24 @@ //// [destructuringVariableDeclaration1ES5.ts] import _sliced_to_array from "@swc/helpers/src/_sliced_to_array.mjs"; import _to_consumable_array from "@swc/helpers/src/_to_consumable_array.mjs"; -var ref = { +var _ref = { a1: 10, a2: "world" }; -ref.a1, ref.a2; +_ref.a1, _ref.a2; var tmp = { b11: "world" }; (void 0 === tmp ? { b11: "string" } : tmp).b11; -var ref1 = [ +var _ref1 = [ void 0, void 0, void 0 ]; -ref1[0], ref1[1], ref1[2]; -var ref2 = _sliced_to_array([ +_ref1[0], _ref1[1], _ref1[2]; +var _concat = _sliced_to_array([ 1, "string" ].concat(_to_consumable_array([ @@ -26,8 +26,8 @@ var ref2 = _sliced_to_array([ !1, !0 ])), 2); -ref2[0], ref2[1]; -var _e = _sliced_to_array([ +_concat[0], _concat[1]; +var _ref_e = _sliced_to_array([ 1, 2, { @@ -35,13 +35,13 @@ var _e = _sliced_to_array([ b4: 0 } ], 3); -_e[0], _e[1], _e[2]; -var _f = _sliced_to_array([ +_ref_e[0], _ref_e[1], _ref_e[2]; +var _ref_f = _sliced_to_array([ 1, 2, { f3: 4, f5: 0 } -], 3), ref3 = (_f[0], _f[1], _f[2]); -ref3.f3, ref3.f5; +], 3), _ref_f_ = (_ref_f[0], _ref_f[1], _ref_f[2]); +_ref_f_.f3, _ref_f_.f5; diff --git a/crates/swc/tests/tsc-references/destructuringVariableDeclaration1ES5iterable.1.normal.js b/crates/swc/tests/tsc-references/destructuringVariableDeclaration1ES5iterable.1.normal.js index 0533adde9e65..97e010df43fe 100644 --- a/crates/swc/tests/tsc-references/destructuringVariableDeclaration1ES5iterable.1.normal.js +++ b/crates/swc/tests/tsc-references/destructuringVariableDeclaration1ES5iterable.1.normal.js @@ -3,18 +3,18 @@ // If the declaration includes a type annotation, T is that type. import _sliced_to_array from "@swc/helpers/src/_sliced_to_array.mjs"; import _to_consumable_array from "@swc/helpers/src/_to_consumable_array.mjs"; -var ref = { +var _ref = { a1: 10, a2: "world" -}, a1 = ref.a1, a2 = ref.a2; +}, a1 = _ref.a1, a2 = _ref.a2; var a3 = 1, a4 = "hello", a5 = true; // The type T associated with a destructuring variable declaration is determined as follows: // Otherwise, if the declaration includes an initializer expression, T is the type of that initializer expression. -var ref1 = { +var _ref1 = { b1: { b11: "world" } -}, tmp = ref1.b1, b11 = (tmp === void 0 ? { +}, tmp = _ref1.b1, b11 = (tmp === void 0 ? { b11: "string" } : tmp).b11; var temp = { @@ -25,11 +25,11 @@ var tmp1 = 3, b2 = tmp1 === void 0 ? 3 : tmp1, tmp2 = false, b3 = tmp2 === void t1: false, t2: "hello" }, b4 = tmp3 === void 0 ? temp : tmp3; -var ref2 = [ +var _ref2 = [ undefined, undefined, undefined -], tmp4 = ref2[0], b5 = tmp4 === void 0 ? 3 : tmp4, tmp5 = ref2[1], b6 = tmp5 === void 0 ? true : tmp5, tmp6 = ref2[2], b7 = tmp6 === void 0 ? temp : tmp6; +], tmp4 = _ref2[0], b5 = tmp4 === void 0 ? 3 : tmp4, tmp5 = _ref2[1], b6 = tmp5 === void 0 ? true : tmp5, tmp6 = _ref2[2], b7 = tmp6 === void 0 ? temp : tmp6; // The type T associated with a binding element is determined as follows: // If the binding element is a rest element, T is an array type with // an element type E, where E is the type of the numeric index signature of S. @@ -57,12 +57,12 @@ var temp1 = [ false, true ]; -var ref3 = _sliced_to_array([ +var _concat = _sliced_to_array([ 1, "string" -].concat(_to_consumable_array(temp1)), 2), d3 = ref3[0], d4 = ref3[1]; +].concat(_to_consumable_array(temp1)), 2), d3 = _concat[0], d4 = _concat[1]; // Combining both forms of destructuring, -var ref4 = { +var _ref3 = { e: [ 1, 2, @@ -71,11 +71,11 @@ var ref4 = { b4: 0 } ] -}, _e = _sliced_to_array(ref4.e, 3), e1 = _e[0], e2 = _e[1], tmp7 = _e[2], e3 = tmp7 === void 0 ? { +}, _ref_e = _sliced_to_array(_ref3.e, 3), e1 = _ref_e[0], e2 = _ref_e[1], tmp7 = _ref_e[2], e3 = tmp7 === void 0 ? { b1: 1000, b4: 200 } : tmp7; -var ref5 = { +var _ref4 = { f: [ 1, 2, @@ -84,29 +84,29 @@ var ref5 = { f5: 0 } ] -}, _f = _sliced_to_array(ref5.f, 3), f1 = _f[0], f2 = _f[1], ref6 = _f[2], f4 = ref6.f3, f5 = ref6.f5; +}, _ref_f = _sliced_to_array(_ref4.f, 3), f1 = _ref_f[0], f2 = _ref_f[1], _ref_f_ = _ref_f[2], f4 = _ref_f_.f3, f5 = _ref_f_.f5; // When a destructuring variable declaration, binding property, or binding element specifies // an initializer expression, the type of the initializer expression is required to be assignable // to the widened form of the type associated with the destructuring variable declaration, binding property, or binding element. -var ref7 = { +var _ref5 = { g: { g1: [ 1, 2 ] } -}, _g = ref7.g, _g1 = _g.g1, g1 = _g1 === void 0 ? [ +}, _ref_g = _ref5.g, _ref_g_g1 = _ref_g.g1, g1 = _ref_g_g1 === void 0 ? [ undefined, null -] : _g1; -var ref8 = { +] : _ref_g_g1; +var _ref6 = { h: { h1: [ 1, 2 ] } -}, _h = ref8.h, _h1 = _h.h1, h1 = _h1 === void 0 ? [ +}, _ref_h = _ref6.h, _ref_h_h1 = _ref_h.h1, h1 = _ref_h_h1 === void 0 ? [ undefined, null -] : _h1; +] : _ref_h_h1; diff --git a/crates/swc/tests/tsc-references/destructuringVariableDeclaration1ES5iterable.2.minified.js b/crates/swc/tests/tsc-references/destructuringVariableDeclaration1ES5iterable.2.minified.js index c9918d372c6f..f992333bef1e 100644 --- a/crates/swc/tests/tsc-references/destructuringVariableDeclaration1ES5iterable.2.minified.js +++ b/crates/swc/tests/tsc-references/destructuringVariableDeclaration1ES5iterable.2.minified.js @@ -1,24 +1,24 @@ //// [destructuringVariableDeclaration1ES5iterable.ts] import _sliced_to_array from "@swc/helpers/src/_sliced_to_array.mjs"; import _to_consumable_array from "@swc/helpers/src/_to_consumable_array.mjs"; -var ref = { +var _ref = { a1: 10, a2: "world" }; -ref.a1, ref.a2; +_ref.a1, _ref.a2; var tmp = { b11: "world" }; (void 0 === tmp ? { b11: "string" } : tmp).b11; -var ref1 = [ +var _ref1 = [ void 0, void 0, void 0 ]; -ref1[0], ref1[1], ref1[2]; -var ref2 = _sliced_to_array([ +_ref1[0], _ref1[1], _ref1[2]; +var _concat = _sliced_to_array([ 1, "string" ].concat(_to_consumable_array([ @@ -26,8 +26,8 @@ var ref2 = _sliced_to_array([ !1, !0 ])), 2); -ref2[0], ref2[1]; -var _e = _sliced_to_array([ +_concat[0], _concat[1]; +var _ref_e = _sliced_to_array([ 1, 2, { @@ -35,13 +35,13 @@ var _e = _sliced_to_array([ b4: 0 } ], 3); -_e[0], _e[1], _e[2]; -var _f = _sliced_to_array([ +_ref_e[0], _ref_e[1], _ref_e[2]; +var _ref_f = _sliced_to_array([ 1, 2, { f3: 4, f5: 0 } -], 3), ref3 = (_f[0], _f[1], _f[2]); -ref3.f3, ref3.f5; +], 3), _ref_f_ = (_ref_f[0], _ref_f[1], _ref_f[2]); +_ref_f_.f3, _ref_f_.f5; diff --git a/crates/swc/tests/tsc-references/destructuringVariableDeclaration2.1.normal.js b/crates/swc/tests/tsc-references/destructuringVariableDeclaration2.1.normal.js index 5e8e321c8557..54c286863e65 100644 --- a/crates/swc/tests/tsc-references/destructuringVariableDeclaration2.1.normal.js +++ b/crates/swc/tests/tsc-references/destructuringVariableDeclaration2.1.normal.js @@ -1,11 +1,11 @@ //// [destructuringVariableDeclaration2.ts] // The type T associated with a destructuring variable declaration is determined as follows: // If the declaration includes a type annotation, T is that type. -var ref // Error +var _ref // Error = { a1: true, a2: 1 -}, a1 = ref.a1, a2 = ref.a2; +}, a1 = _ref.a1, a2 = _ref.a2; var a3 = 1, a4 = false, a5 = true; // Error // The type T associated with a destructuring variable declaration is determined as follows: // Otherwise, if the declaration includes an initializer expression, T is the type of that initializer expression. @@ -20,25 +20,25 @@ var tmp = 3, b0 = tmp === void 0 ? 3 : tmp, tmp1 = false, b1 = tmp1 === void 0 ? // The type T associated with a binding element is determined as follows: // If the binding element is a rest element, T is an array type with // an element type E, where E is the type of the numeric index signature of S. -var ref1 = [ +var _ref1 = [ 1, 2, { c3: 4, c5: 0 } -], c1 = ref1[0], c2 = ref1[1], ref2 = ref1[2], c4 = ref2.c3, c5 = ref2.c5, c6 = ref1.slice(4); // Error +], c1 = _ref1[0], c2 = _ref1[1], _ref_ = _ref1[2], c4 = _ref_.c3, c5 = _ref_.c5, c6 = _ref1.slice(4); // Error // When a destructuring variable declaration, binding property, or binding element specifies // an initializer expression, the type of the initializer expression is required to be assignable // to the widened form of the type associated with the destructuring variable declaration, binding property, or binding element. -var ref3 = { +var _ref2 = { d: { d1: [ 1, 2 ] } -}, _d = ref3.d, _d1 = _d.d1, d1 = _d1 === void 0 ? [ +}, _ref_d = _ref2.d, _ref_d_d1 = _ref_d.d1, d1 = _ref_d_d1 === void 0 ? [ "string", null -] : _d1; // Error +] : _ref_d_d1; // Error diff --git a/crates/swc/tests/tsc-references/destructuringVariableDeclaration2.2.minified.js b/crates/swc/tests/tsc-references/destructuringVariableDeclaration2.2.minified.js index 318e86d16711..a329a0e651df 100644 --- a/crates/swc/tests/tsc-references/destructuringVariableDeclaration2.2.minified.js +++ b/crates/swc/tests/tsc-references/destructuringVariableDeclaration2.2.minified.js @@ -1,15 +1,15 @@ //// [destructuringVariableDeclaration2.ts] -var ref = { +var _ref = { a1: !0, a2: 1 }; -ref.a1, ref.a2; -var ref1 = [ +_ref.a1, _ref.a2; +var _ref1 = [ 1, 2, { c3: 4, c5: 0 } -], ref2 = (ref1[0], ref1[1], ref1[2]); -ref2.c3, ref2.c5, ref1.slice(4); +], _ref_ = (_ref1[0], _ref1[1], _ref1[2]); +_ref_.c3, _ref_.c5, _ref1.slice(4); diff --git a/crates/swc/tests/tsc-references/destructuringWithLiteralInitializers.1.normal.js b/crates/swc/tests/tsc-references/destructuringWithLiteralInitializers.1.normal.js index 70ba52e25e1f..ba1bba92456f 100644 --- a/crates/swc/tests/tsc-references/destructuringWithLiteralInitializers.1.normal.js +++ b/crates/swc/tests/tsc-references/destructuringWithLiteralInitializers.1.normal.js @@ -10,7 +10,7 @@ f1({ }); // (arg: { x: any, y?: number }) => void function f2(param) { - var x = param.x, _y = param.y, y = _y === void 0 ? 0 : _y; + var x = param.x, _param_y = param.y, y = _param_y === void 0 ? 0 : _param_y; } f2({ x: 1 @@ -21,7 +21,7 @@ f2({ }); // (arg: { x?: number, y?: number }) => void function f3(param) { - var _x = param.x, x = _x === void 0 ? 0 : _x, _y = param.y, y = _y === void 0 ? 0 : _y; + var _param_x = param.x, x = _param_x === void 0 ? 0 : _param_x, _param_y = param.y, y = _param_y === void 0 ? 0 : _param_y; } f3({}); f3({ @@ -36,10 +36,10 @@ f3({ }); // (arg?: { x: number, y: number }) => void function f4() { - var ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : { + var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : { x: 0, y: 0 - }, x = ref.x, y = ref.y; + }, x = _ref.x, y = _ref.y; } f4(); f4({ @@ -48,9 +48,9 @@ f4({ }); // (arg?: { x: number, y?: number }) => void function f5() { - var ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : { + var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : { x: 0 - }, x = ref.x, _y = ref.y, y = _y === void 0 ? 0 : _y; + }, x = _ref.x, _ref_y = _ref.y, y = _ref_y === void 0 ? 0 : _ref_y; } f5(); f5({ @@ -62,7 +62,7 @@ f5({ }); // (arg?: { x?: number, y?: number }) => void function f6() { - var ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, _x = ref.x, x = _x === void 0 ? 0 : _x, _y = ref.y, y = _y === void 0 ? 0 : _y; + var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, _ref_x = _ref.x, x = _ref_x === void 0 ? 0 : _ref_x, _ref_y = _ref.y, y = _ref_y === void 0 ? 0 : _ref_y; } f6(); f6({}); @@ -78,9 +78,9 @@ f6({ }); // (arg?: { a: { x?: number, y?: number } }) => void function f7() { - var ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : { + var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : { a: {} - }, _a = ref.a, _x = _a.x, x = _x === void 0 ? 0 : _x, _y = _a.y, y = _y === void 0 ? 0 : _y; + }, _ref_a = _ref.a, _ref_a_x = _ref_a.x, x = _ref_a_x === void 0 ? 0 : _ref_a_x, _ref_a_y = _ref_a.y, y = _ref_a_y === void 0 ? 0 : _ref_a_y; } f7(); f7({ @@ -120,10 +120,10 @@ g2([ ]); // (arg?: [number, number]) => void function g3() { - var ref = _sliced_to_array(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [ + var _ref = _sliced_to_array(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [ 0, 0 - ], 2), x = ref[0], y = ref[1]; + ], 2), x = _ref[0], y = _ref[1]; } g3(); g3([ @@ -132,9 +132,9 @@ g3([ ]); // (arg?: [number, number]) => void function g4() { - var ref = _sliced_to_array(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [ + var _ref = _sliced_to_array(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [ 0 - ], 2), x = ref[0], tmp = ref[1], y = tmp === void 0 ? 0 : tmp; + ], 2), x = _ref[0], tmp = _ref[1], y = tmp === void 0 ? 0 : tmp; } g4(); g4([ @@ -143,7 +143,7 @@ g4([ ]); // (arg?: [number, number]) => void function g5() { - var ref = _sliced_to_array(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], 2), tmp = ref[0], x = tmp === void 0 ? 0 : tmp, tmp1 = ref[1], y = tmp1 === void 0 ? 0 : tmp1; + var _ref = _sliced_to_array(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], 2), tmp = _ref[0], x = tmp === void 0 ? 0 : tmp, tmp1 = _ref[1], y = tmp1 === void 0 ? 0 : tmp1; } g5(); g5([ diff --git a/crates/swc/tests/tsc-references/destructuringWithLiteralInitializers.2.minified.js b/crates/swc/tests/tsc-references/destructuringWithLiteralInitializers.2.minified.js index 65e69476392c..13182c26934b 100644 --- a/crates/swc/tests/tsc-references/destructuringWithLiteralInitializers.2.minified.js +++ b/crates/swc/tests/tsc-references/destructuringWithLiteralInitializers.2.minified.js @@ -1,44 +1,44 @@ //// [destructuringWithLiteralInitializers.ts] import _sliced_to_array from "@swc/helpers/src/_sliced_to_array.mjs"; function f4() { - var ref = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : { + var _ref = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : { x: 0, y: 0 }; - ref.x, ref.y; + _ref.x, _ref.y; } function f5() { - var ref = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : { + var _ref = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : { x: 0 }; - ref.x, ref.y; + _ref.x, _ref.y; } function f6() { - var ref = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; - ref.x, ref.y; + var _ref = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; + _ref.x, _ref.y; } function f7() { - var ref = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : { + var _ref = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : { a: {} - }, _a = ref.a; - _a.x, _a.y; + }, _ref_a = _ref.a; + _ref_a.x, _ref_a.y; } function g3() { - var ref = _sliced_to_array(arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [ + var _ref = _sliced_to_array(arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [ 0, 0 ], 2); - ref[0], ref[1]; + _ref[0], _ref[1]; } function g4() { - var ref = _sliced_to_array(arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [ + var _ref = _sliced_to_array(arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [ 0 ], 2); - ref[0], ref[1]; + _ref[0], _ref[1]; } function g5() { - var ref = _sliced_to_array(arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [], 2); - ref[0], ref[1]; + var _ref = _sliced_to_array(arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [], 2); + _ref[0], _ref[1]; } !function(param) { param.x, param.y; diff --git a/crates/swc/tests/tsc-references/destructuringWithLiteralInitializers2.1.normal.js b/crates/swc/tests/tsc-references/destructuringWithLiteralInitializers2.1.normal.js index b41f6492d516..a8fa2da3a2c4 100644 --- a/crates/swc/tests/tsc-references/destructuringWithLiteralInitializers2.1.normal.js +++ b/crates/swc/tests/tsc-references/destructuringWithLiteralInitializers2.1.normal.js @@ -4,84 +4,84 @@ function f00(param) { var _param = _sliced_to_array(param, 2), x = _param[0], y = _param[1]; } function f01() { - var ref = _sliced_to_array(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], 2), x = ref[0], y = ref[1]; + var _ref = _sliced_to_array(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], 2), x = _ref[0], y = _ref[1]; } function f02() { - var ref = _sliced_to_array(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [ + var _ref = _sliced_to_array(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [ 1 - ], 2), x = ref[0], y = ref[1]; + ], 2), x = _ref[0], y = _ref[1]; } function f03() { - var ref = _sliced_to_array(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [ + var _ref = _sliced_to_array(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [ 1, "foo" - ], 2), x = ref[0], y = ref[1]; + ], 2), x = _ref[0], y = _ref[1]; } function f10(param) { var _param = _sliced_to_array(param, 2), tmp = _param[0], x = tmp === void 0 ? 0 : tmp, y = _param[1]; } function f11() { - var ref = _sliced_to_array(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], 2), tmp = ref[0], x = tmp === void 0 ? 0 : tmp, y = ref[1]; + var _ref = _sliced_to_array(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], 2), tmp = _ref[0], x = tmp === void 0 ? 0 : tmp, y = _ref[1]; } function f12() { - var ref = _sliced_to_array(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [ + var _ref = _sliced_to_array(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [ 1 - ], 2), tmp = ref[0], x = tmp === void 0 ? 0 : tmp, y = ref[1]; + ], 2), tmp = _ref[0], x = tmp === void 0 ? 0 : tmp, y = _ref[1]; } function f13() { - var ref = _sliced_to_array(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [ + var _ref = _sliced_to_array(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [ 1, "foo" - ], 2), tmp = ref[0], x = tmp === void 0 ? 0 : tmp, y = ref[1]; + ], 2), tmp = _ref[0], x = tmp === void 0 ? 0 : tmp, y = _ref[1]; } function f20(param) { var _param = _sliced_to_array(param, 2), tmp = _param[0], x = tmp === void 0 ? 0 : tmp, tmp1 = _param[1], y = tmp1 === void 0 ? "bar" : tmp1; } function f21() { - var ref = _sliced_to_array(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], 2), tmp = ref[0], x = tmp === void 0 ? 0 : tmp, tmp1 = ref[1], y = tmp1 === void 0 ? "bar" : tmp1; + var _ref = _sliced_to_array(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], 2), tmp = _ref[0], x = tmp === void 0 ? 0 : tmp, tmp1 = _ref[1], y = tmp1 === void 0 ? "bar" : tmp1; } function f22() { - var ref = _sliced_to_array(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [ + var _ref = _sliced_to_array(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [ 1 - ], 2), tmp = ref[0], x = tmp === void 0 ? 0 : tmp, tmp1 = ref[1], y = tmp1 === void 0 ? "bar" : tmp1; + ], 2), tmp = _ref[0], x = tmp === void 0 ? 0 : tmp, tmp1 = _ref[1], y = tmp1 === void 0 ? "bar" : tmp1; } function f23() { - var ref = _sliced_to_array(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [ + var _ref = _sliced_to_array(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [ 1, "foo" - ], 2), tmp = ref[0], x = tmp === void 0 ? 0 : tmp, tmp1 = ref[1], y = tmp1 === void 0 ? "bar" : tmp1; + ], 2), tmp = _ref[0], x = tmp === void 0 ? 0 : tmp, tmp1 = _ref[1], y = tmp1 === void 0 ? "bar" : tmp1; } function f30(param) { var _param = _sliced_to_array(param, 2), tmp = _param[0], x = tmp === void 0 ? 0 : tmp, tmp1 = _param[1], y = tmp1 === void 0 ? "bar" : tmp1; } function f31() { - var ref = _sliced_to_array(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], 2), tmp = ref[0], x = tmp === void 0 ? 0 : tmp, tmp1 = ref[1], y = tmp1 === void 0 ? "bar" : tmp1; + var _ref = _sliced_to_array(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], 2), tmp = _ref[0], x = tmp === void 0 ? 0 : tmp, tmp1 = _ref[1], y = tmp1 === void 0 ? "bar" : tmp1; } function f32() { - var ref = _sliced_to_array(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [ + var _ref = _sliced_to_array(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [ nx - ], 2), tmp = ref[0], x = tmp === void 0 ? 0 : tmp, tmp1 = ref[1], y = tmp1 === void 0 ? "bar" : tmp1; + ], 2), tmp = _ref[0], x = tmp === void 0 ? 0 : tmp, tmp1 = _ref[1], y = tmp1 === void 0 ? "bar" : tmp1; } function f33() { - var ref = _sliced_to_array(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [ + var _ref = _sliced_to_array(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [ nx, sx - ], 2), tmp = ref[0], x = tmp === void 0 ? 0 : tmp, tmp1 = ref[1], y = tmp1 === void 0 ? "bar" : tmp1; + ], 2), tmp = _ref[0], x = tmp === void 0 ? 0 : tmp, tmp1 = _ref[1], y = tmp1 === void 0 ? "bar" : tmp1; } function f40(param) { var _param = _sliced_to_array(param, 2), tmp = _param[0], x = tmp === void 0 ? 0 : tmp, tmp1 = _param[1], y = tmp1 === void 0 ? "bar" : tmp1; } function f41() { - var ref = _sliced_to_array(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], 2), tmp = ref[0], x = tmp === void 0 ? 0 : tmp, tmp1 = ref[1], y = tmp1 === void 0 ? "bar" : tmp1; + var _ref = _sliced_to_array(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], 2), tmp = _ref[0], x = tmp === void 0 ? 0 : tmp, tmp1 = _ref[1], y = tmp1 === void 0 ? "bar" : tmp1; } function f42() { - var ref = _sliced_to_array(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [ + var _ref = _sliced_to_array(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [ sx - ], 2), tmp = ref[0], x = tmp === void 0 ? 0 : tmp, tmp1 = ref[1], y = tmp1 === void 0 ? "bar" : tmp1; + ], 2), tmp = _ref[0], x = tmp === void 0 ? 0 : tmp, tmp1 = _ref[1], y = tmp1 === void 0 ? "bar" : tmp1; } function f43() { - var ref = _sliced_to_array(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [ + var _ref = _sliced_to_array(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [ sx, nx - ], 2), tmp = ref[0], x = tmp === void 0 ? 0 : tmp, tmp1 = ref[1], y = tmp1 === void 0 ? "bar" : tmp1; + ], 2), tmp = _ref[0], x = tmp === void 0 ? 0 : tmp, tmp1 = _ref[1], y = tmp1 === void 0 ? "bar" : tmp1; } diff --git a/crates/swc/tests/tsc-references/elementAccessChain.1.normal.js b/crates/swc/tests/tsc-references/elementAccessChain.1.normal.js index 59e35e81d41b..d352d3befea3 100644 --- a/crates/swc/tests/tsc-references/elementAccessChain.1.normal.js +++ b/crates/swc/tests/tsc-references/elementAccessChain.1.normal.js @@ -1,17 +1,17 @@ //// [elementAccessChain.ts] -var ref, ref1, ref2, ref3, ref4, ref5, ref6, ref7, ref8, ref9, ref10, ref11, ref12, ref13, ref14; +var _o3_b, _o3_b1, _o4_b, _ref, _o4_b1, _ref1, _o5_b, _ref2, _o5_b1, _ref3, _o5_b2, _ref4, _o5_b3, _ref5, _o6; o1 === null || o1 === void 0 ? void 0 : o1["b"]; o2 === null || o2 === void 0 ? void 0 : o2["b"].c; o2 === null || o2 === void 0 ? void 0 : o2.b["c"]; -(ref = o3["b"]) === null || ref === void 0 ? void 0 : ref.c; -(ref1 = o3.b) === null || ref1 === void 0 ? void 0 : ref1["c"]; -(ref3 = (ref2 = o4.b) === null || ref2 === void 0 ? void 0 : ref2["c"].d) === null || ref3 === void 0 ? void 0 : ref3.e; -(ref5 = (ref4 = o4.b) === null || ref4 === void 0 ? void 0 : ref4["c"].d) === null || ref5 === void 0 ? void 0 : ref5["e"]; -(ref7 = (ref6 = o5.b) === null || ref6 === void 0 ? void 0 : ref6.call(o5)["c"].d) === null || ref7 === void 0 ? void 0 : ref7.e; -(ref9 = (ref8 = o5.b) === null || ref8 === void 0 ? void 0 : ref8.call(o5)["c"].d) === null || ref9 === void 0 ? void 0 : ref9["e"]; -(ref11 = (ref10 = o5["b"]) === null || ref10 === void 0 ? void 0 : ref10.call(o5)["c"].d) === null || ref11 === void 0 ? void 0 : ref11.e; -(ref13 = (ref12 = o5["b"]) === null || ref12 === void 0 ? void 0 : ref12.call(o5)["c"].d) === null || ref13 === void 0 ? void 0 : ref13["e"]; -(ref14 = o6()) === null || ref14 === void 0 ? void 0 : ref14["x"]; +(_o3_b = o3["b"]) === null || _o3_b === void 0 ? void 0 : _o3_b.c; +(_o3_b1 = o3.b) === null || _o3_b1 === void 0 ? void 0 : _o3_b1["c"]; +(_ref = (_o4_b = o4.b) === null || _o4_b === void 0 ? void 0 : _o4_b["c"].d) === null || _ref === void 0 ? void 0 : _ref.e; +(_ref1 = (_o4_b1 = o4.b) === null || _o4_b1 === void 0 ? void 0 : _o4_b1["c"].d) === null || _ref1 === void 0 ? void 0 : _ref1["e"]; +(_ref2 = (_o5_b = o5.b) === null || _o5_b === void 0 ? void 0 : _o5_b.call(o5)["c"].d) === null || _ref2 === void 0 ? void 0 : _ref2.e; +(_ref3 = (_o5_b1 = o5.b) === null || _o5_b1 === void 0 ? void 0 : _o5_b1.call(o5)["c"].d) === null || _ref3 === void 0 ? void 0 : _ref3["e"]; +(_ref4 = (_o5_b2 = o5["b"]) === null || _o5_b2 === void 0 ? void 0 : _o5_b2.call(o5)["c"].d) === null || _ref4 === void 0 ? void 0 : _ref4.e; +(_ref5 = (_o5_b3 = o5["b"]) === null || _o5_b3 === void 0 ? void 0 : _o5_b3.call(o5)["c"].d) === null || _ref5 === void 0 ? void 0 : _ref5["e"]; +(_o6 = o6()) === null || _o6 === void 0 ? void 0 : _o6["x"]; // GH#36031 o2 === null || o2 === void 0 ? void 0 : o2["b"].c; o2 === null || o2 === void 0 ? void 0 : o2["b"]["c"]; diff --git a/crates/swc/tests/tsc-references/elementAccessChain.2.1.normal.js b/crates/swc/tests/tsc-references/elementAccessChain.2.1.normal.js index d16a83da68a2..3492073aa987 100644 --- a/crates/swc/tests/tsc-references/elementAccessChain.2.1.normal.js +++ b/crates/swc/tests/tsc-references/elementAccessChain.2.1.normal.js @@ -1,7 +1,7 @@ //// [elementAccessChain.2.ts] -var ref, ref1; +var _o3_b, _o3_b1; o1 === null || o1 === void 0 ? void 0 : o1["b"]; o2 === null || o2 === void 0 ? void 0 : o2["b"].c; o2 === null || o2 === void 0 ? void 0 : o2.b["c"]; -(ref = o3["b"]) === null || ref === void 0 ? void 0 : ref.c; -(ref1 = o3.b) === null || ref1 === void 0 ? void 0 : ref1["c"]; +(_o3_b = o3["b"]) === null || _o3_b === void 0 ? void 0 : _o3_b.c; +(_o3_b1 = o3.b) === null || _o3_b1 === void 0 ? void 0 : _o3_b1["c"]; diff --git a/crates/swc/tests/tsc-references/elementAccessChain.2.2.minified.js b/crates/swc/tests/tsc-references/elementAccessChain.2.2.minified.js index b1b99f8fd709..b2e17050ccd2 100644 --- a/crates/swc/tests/tsc-references/elementAccessChain.2.2.minified.js +++ b/crates/swc/tests/tsc-references/elementAccessChain.2.2.minified.js @@ -1,3 +1,3 @@ //// [elementAccessChain.2.ts] -var ref, ref1; -null == o1 || o1.b, null == o2 || o2.b.c, null == o2 || o2.b.c, null === (ref = o3.b) || void 0 === ref || ref.c, null === (ref1 = o3.b) || void 0 === ref1 || ref1.c; +var _o3_b, _o3_b1; +null == o1 || o1.b, null == o2 || o2.b.c, null == o2 || o2.b.c, null === (_o3_b = o3.b) || void 0 === _o3_b || _o3_b.c, null === (_o3_b1 = o3.b) || void 0 === _o3_b1 || _o3_b1.c; diff --git a/crates/swc/tests/tsc-references/elementAccessChain.2.minified.js b/crates/swc/tests/tsc-references/elementAccessChain.2.minified.js index 08a3d3369cf9..e2feac34ba7f 100644 --- a/crates/swc/tests/tsc-references/elementAccessChain.2.minified.js +++ b/crates/swc/tests/tsc-references/elementAccessChain.2.minified.js @@ -1,3 +1,3 @@ //// [elementAccessChain.ts] -var ref, ref1, ref2, ref3, ref4, ref5, ref6, ref7, ref8, ref9, ref10, ref11, ref12, ref13, ref14; -null == o1 || o1.b, null == o2 || o2.b.c, null == o2 || o2.b.c, null === (ref = o3.b) || void 0 === ref || ref.c, null === (ref1 = o3.b) || void 0 === ref1 || ref1.c, null === (ref3 = null === (ref2 = o4.b) || void 0 === ref2 ? void 0 : ref2.c.d) || void 0 === ref3 || ref3.e, null === (ref5 = null === (ref4 = o4.b) || void 0 === ref4 ? void 0 : ref4.c.d) || void 0 === ref5 || ref5.e, null === (ref7 = null === (ref6 = o5.b) || void 0 === ref6 ? void 0 : ref6.call(o5).c.d) || void 0 === ref7 || ref7.e, null === (ref9 = null === (ref8 = o5.b) || void 0 === ref8 ? void 0 : ref8.call(o5).c.d) || void 0 === ref9 || ref9.e, null === (ref11 = null === (ref10 = o5.b) || void 0 === ref10 ? void 0 : ref10.call(o5).c.d) || void 0 === ref11 || ref11.e, null === (ref13 = null === (ref12 = o5.b) || void 0 === ref12 ? void 0 : ref12.call(o5).c.d) || void 0 === ref13 || ref13.e, null === (ref14 = o6()) || void 0 === ref14 || ref14.x, null == o2 || o2.b.c, null == o2 || o2.b.c, null == o2 || o2.b.c, null == o2 || o2.b.c; +var _o3_b, _o3_b1, _o4_b, _ref, _o4_b1, _ref1, _o5_b, _ref2, _o5_b1, _ref3, _o5_b2, _ref4, _o5_b3, _ref5, _o6; +null == o1 || o1.b, null == o2 || o2.b.c, null == o2 || o2.b.c, null === (_o3_b = o3.b) || void 0 === _o3_b || _o3_b.c, null === (_o3_b1 = o3.b) || void 0 === _o3_b1 || _o3_b1.c, null === (_ref = null === (_o4_b = o4.b) || void 0 === _o4_b ? void 0 : _o4_b.c.d) || void 0 === _ref || _ref.e, null === (_ref1 = null === (_o4_b1 = o4.b) || void 0 === _o4_b1 ? void 0 : _o4_b1.c.d) || void 0 === _ref1 || _ref1.e, null === (_ref2 = null === (_o5_b = o5.b) || void 0 === _o5_b ? void 0 : _o5_b.call(o5).c.d) || void 0 === _ref2 || _ref2.e, null === (_ref3 = null === (_o5_b1 = o5.b) || void 0 === _o5_b1 ? void 0 : _o5_b1.call(o5).c.d) || void 0 === _ref3 || _ref3.e, null === (_ref4 = null === (_o5_b2 = o5.b) || void 0 === _o5_b2 ? void 0 : _o5_b2.call(o5).c.d) || void 0 === _ref4 || _ref4.e, null === (_ref5 = null === (_o5_b3 = o5.b) || void 0 === _o5_b3 ? void 0 : _o5_b3.call(o5).c.d) || void 0 === _ref5 || _ref5.e, null === (_o6 = o6()) || void 0 === _o6 || _o6.x, null == o2 || o2.b.c, null == o2 || o2.b.c, null == o2 || o2.b.c, null == o2 || o2.b.c; diff --git a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments18.1.normal.js b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments18.1.normal.js index c8164384b36f..23c5f4c8dcf5 100644 --- a/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments18.1.normal.js +++ b/crates/swc/tests/tsc-references/emitArrowFunctionWhenUsingArguments18.1.normal.js @@ -1,9 +1,9 @@ //// [emitArrowFunctionWhenUsingArguments18.ts] function f() { var _arguments = arguments; - var ref = { + var _ref = { arguments: arguments - }, args = ref.arguments; + }, args = _ref.arguments; if (Math.random()) { return function() { return _arguments; diff --git a/crates/swc/tests/tsc-references/emitClassDeclarationWithPropertyAccessInHeritageClause1.1.normal.js b/crates/swc/tests/tsc-references/emitClassDeclarationWithPropertyAccessInHeritageClause1.1.normal.js index e98487e2fb80..275cc6eb1198 100644 --- a/crates/swc/tests/tsc-references/emitClassDeclarationWithPropertyAccessInHeritageClause1.1.normal.js +++ b/crates/swc/tests/tsc-references/emitClassDeclarationWithPropertyAccessInHeritageClause1.1.normal.js @@ -11,9 +11,9 @@ function foo() { B: B }; } -var C = /*#__PURE__*/ function(_B) { +var C = /*#__PURE__*/ function(_foo_B) { "use strict"; - _inherits(C, _B); + _inherits(C, _foo_B); var _super = _create_super(C); function C() { _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/emptyArrayBindingPatternParameter04.1.normal.js b/crates/swc/tests/tsc-references/emptyArrayBindingPatternParameter04.1.normal.js index f03a2818718b..b21224681221 100644 --- a/crates/swc/tests/tsc-references/emptyArrayBindingPatternParameter04.1.normal.js +++ b/crates/swc/tests/tsc-references/emptyArrayBindingPatternParameter04.1.normal.js @@ -1,7 +1,7 @@ //// [emptyArrayBindingPatternParameter04.ts] import _sliced_to_array from "@swc/helpers/src/_sliced_to_array.mjs"; function f() { - var ref = _sliced_to_array(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [ + var _ref = _sliced_to_array(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [ 1, 2, 3, diff --git a/crates/swc/tests/tsc-references/emptyAssignmentPatterns01_ES5.1.normal.js b/crates/swc/tests/tsc-references/emptyAssignmentPatterns01_ES5.1.normal.js index d1782124d410..bce336e68a14 100644 --- a/crates/swc/tests/tsc-references/emptyAssignmentPatterns01_ES5.1.normal.js +++ b/crates/swc/tests/tsc-references/emptyAssignmentPatterns01_ES5.1.normal.js @@ -5,7 +5,7 @@ var ref; ref = a, ref; var ref1; ref1 = _sliced_to_array(a, 0), ref1; -var ref2 = [ +var _ref = [ 1, 2 ]; diff --git a/crates/swc/tests/tsc-references/emptyObjectBindingPatternParameter04.1.normal.js b/crates/swc/tests/tsc-references/emptyObjectBindingPatternParameter04.1.normal.js index 32818dbb88c4..ed790dcb577f 100644 --- a/crates/swc/tests/tsc-references/emptyObjectBindingPatternParameter04.1.normal.js +++ b/crates/swc/tests/tsc-references/emptyObjectBindingPatternParameter04.1.normal.js @@ -1,10 +1,10 @@ //// [emptyObjectBindingPatternParameter04.ts] import _throw from "@swc/helpers/src/_throw.mjs"; function f() { - var ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : { + var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : { a: 1, b: "2", c: true - }, ref = ref !== null ? ref : _throw(new TypeError("Cannot destructure undefined")); + }, _ref = _ref !== null ? _ref : _throw(new TypeError("Cannot destructure undefined")); var x, y, z; } diff --git a/crates/swc/tests/tsc-references/emptyVariableDeclarationBindingPatterns01_ES5.1.normal.js b/crates/swc/tests/tsc-references/emptyVariableDeclarationBindingPatterns01_ES5.1.normal.js index 99246b554f9e..2a788b145ba1 100644 --- a/crates/swc/tests/tsc-references/emptyVariableDeclarationBindingPatterns01_ES5.1.normal.js +++ b/crates/swc/tests/tsc-references/emptyVariableDeclarationBindingPatterns01_ES5.1.normal.js @@ -3,9 +3,9 @@ import _sliced_to_array from "@swc/helpers/src/_sliced_to_array.mjs"; import _throw from "@swc/helpers/src/_throw.mjs"; (function() { var f = function f() { - var ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : a, ref = ref !== null ? ref : _throw(new TypeError("Cannot destructure undefined")), ref1 = _sliced_to_array(arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : a, 0), ref2 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : a, tmp = ref2.p, ref3 = tmp === void 0 ? a : tmp, ref3 = ref3 !== null ? ref3 : _throw(new TypeError("Cannot destructure undefined")); + var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : a, _ref = _ref !== null ? _ref : _throw(new TypeError("Cannot destructure undefined")), _ref1 = _sliced_to_array(arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : a, 0), _ref2 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : a, tmp = _ref2.p, _ref3 = tmp === void 0 ? a : tmp, _ref3 = _ref3 !== null ? _ref3 : _throw(new TypeError("Cannot destructure undefined")); return function() { - var ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : a, ref = ref !== null ? ref : _throw(new TypeError("Cannot destructure undefined")), ref1 = _sliced_to_array(arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : a, 0), ref2 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : a, tmp = ref2.p, ref3 = tmp === void 0 ? a : tmp, ref3 = ref3 !== null ? ref3 : _throw(new TypeError("Cannot destructure undefined")); + var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : a, _ref = _ref !== null ? _ref : _throw(new TypeError("Cannot destructure undefined")), _ref1 = _sliced_to_array(arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : a, 0), _ref2 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : a, tmp = _ref2.p, _ref3 = tmp === void 0 ? a : tmp, _ref3 = _ref3 !== null ? _ref3 : _throw(new TypeError("Cannot destructure undefined")); return a; }; }; @@ -19,17 +19,17 @@ import _throw from "@swc/helpers/src/_throw.mjs"; var a = a !== null ? a : _throw(new TypeError("Cannot destructure undefined")), _a3 = _sliced_to_array(a, 0); var a = a !== null ? a : _throw(new TypeError("Cannot destructure undefined")), _a4 = _sliced_to_array(a, 0); var a = a !== null ? a : _throw(new TypeError("Cannot destructure undefined")), _a5 = _sliced_to_array(a, 0); - var _p1 = a.p1, _p1 = _p1 !== null ? _p1 : _throw(new TypeError("Cannot destructure undefined")), _p2 = _sliced_to_array(a.p2, 0); - var _p11 = a.p1, _p11 = _p11 !== null ? _p11 : _throw(new TypeError("Cannot destructure undefined")), _p21 = _sliced_to_array(a.p2, 0); - var _p12 = a.p1, _p12 = _p12 !== null ? _p12 : _throw(new TypeError("Cannot destructure undefined")), _p22 = _sliced_to_array(a.p2, 0); - for(var ref = {}, ref = ref !== null ? ref : _throw(new TypeError("Cannot destructure undefined")), ref1 = {}, ref1 = ref1 !== null ? ref1 : _throw(new TypeError("Cannot destructure undefined")); false; void 0){} + var _a_p1 = a.p1, _a_p1 = _a_p1 !== null ? _a_p1 : _throw(new TypeError("Cannot destructure undefined")), _a_p2 = _sliced_to_array(a.p2, 0); + var _a_p11 = a.p1, _a_p11 = _a_p11 !== null ? _a_p11 : _throw(new TypeError("Cannot destructure undefined")), _a_p21 = _sliced_to_array(a.p2, 0); + var _a_p12 = a.p1, _a_p12 = _a_p12 !== null ? _a_p12 : _throw(new TypeError("Cannot destructure undefined")), _a_p22 = _sliced_to_array(a.p2, 0); + for(var _ref = {}, _ref = _ref !== null ? _ref : _throw(new TypeError("Cannot destructure undefined")), _ref1 = {}, _ref1 = _ref1 !== null ? _ref1 : _throw(new TypeError("Cannot destructure undefined")); false; void 0){} })(); (function() { var ns = []; var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined; try { for(var _iterator = ns[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){ - var _value = _step.value, _value = _value !== null ? _value : _throw(new TypeError("Cannot destructure undefined")); + var _step_value = _step.value, _step_value = _step_value !== null ? _step_value : _throw(new TypeError("Cannot destructure undefined")); } } catch (err) { _didIteratorError = true; @@ -48,7 +48,7 @@ import _throw from "@swc/helpers/src/_throw.mjs"; var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined; try { for(var _iterator1 = ns[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){ - var _value1 = _step1.value, _value1 = _value1 !== null ? _value1 : _throw(new TypeError("Cannot destructure undefined")); + var _step_value1 = _step1.value, _step_value1 = _step_value1 !== null ? _step_value1 : _throw(new TypeError("Cannot destructure undefined")); } } catch (err) { _didIteratorError1 = true; @@ -67,7 +67,7 @@ import _throw from "@swc/helpers/src/_throw.mjs"; var _iteratorNormalCompletion2 = true, _didIteratorError2 = false, _iteratorError2 = undefined; try { for(var _iterator2 = ns[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true){ - var _value2 = _step2.value, _value2 = _value2 !== null ? _value2 : _throw(new TypeError("Cannot destructure undefined")); + var _step_value2 = _step2.value, _step_value2 = _step_value2 !== null ? _step_value2 : _throw(new TypeError("Cannot destructure undefined")); } } catch (err) { _didIteratorError2 = true; @@ -86,7 +86,7 @@ import _throw from "@swc/helpers/src/_throw.mjs"; var _iteratorNormalCompletion3 = true, _didIteratorError3 = false, _iteratorError3 = undefined; try { for(var _iterator3 = ns[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true){ - var _value3 = _sliced_to_array(_step3.value, 0); + var _step_value3 = _sliced_to_array(_step3.value, 0); } } catch (err) { _didIteratorError3 = true; @@ -105,7 +105,7 @@ import _throw from "@swc/helpers/src/_throw.mjs"; var _iteratorNormalCompletion4 = true, _didIteratorError4 = false, _iteratorError4 = undefined; try { for(var _iterator4 = ns[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true){ - var _value4 = _sliced_to_array(_step4.value, 0); + var _step_value4 = _sliced_to_array(_step4.value, 0); } } catch (err) { _didIteratorError4 = true; @@ -124,7 +124,7 @@ import _throw from "@swc/helpers/src/_throw.mjs"; var _iteratorNormalCompletion5 = true, _didIteratorError5 = false, _iteratorError5 = undefined; try { for(var _iterator5 = ns[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true){ - var _value5 = _sliced_to_array(_step5.value, 0); + var _step_value5 = _sliced_to_array(_step5.value, 0); } } catch (err) { _didIteratorError5 = true; diff --git a/crates/swc/tests/tsc-references/emptyVariableDeclarationBindingPatterns01_ES5.2.minified.js b/crates/swc/tests/tsc-references/emptyVariableDeclarationBindingPatterns01_ES5.2.minified.js index 11f70661b625..d93d48f581f7 100644 --- a/crates/swc/tests/tsc-references/emptyVariableDeclarationBindingPatterns01_ES5.2.minified.js +++ b/crates/swc/tests/tsc-references/emptyVariableDeclarationBindingPatterns01_ES5.2.minified.js @@ -10,17 +10,17 @@ import _throw from "@swc/helpers/src/_throw.mjs"; _sliced_to_array(a, 0); var a = null !== a ? a : _throw(new TypeError("Cannot destructure undefined")); _sliced_to_array(a, 0); - var _p1 = a.p1, _p1 = null !== _p1 ? _p1 : _throw(new TypeError("Cannot destructure undefined")); + var _a_p1 = a.p1, _a_p1 = null !== _a_p1 ? _a_p1 : _throw(new TypeError("Cannot destructure undefined")); _sliced_to_array(a.p2, 0); - var _p11 = a.p1, _p11 = null !== _p11 ? _p11 : _throw(new TypeError("Cannot destructure undefined")); + var _a_p11 = a.p1, _a_p11 = null !== _a_p11 ? _a_p11 : _throw(new TypeError("Cannot destructure undefined")); _sliced_to_array(a.p2, 0); - var _p12 = a.p1, _p12 = null !== _p12 ? _p12 : _throw(new TypeError("Cannot destructure undefined")); + var _a_p12 = a.p1, _a_p12 = null !== _a_p12 ? _a_p12 : _throw(new TypeError("Cannot destructure undefined")); _sliced_to_array(a.p2, 0); - var ref = {}, ref = null !== ref ? ref : _throw(new TypeError("Cannot destructure undefined")), ref1 = {}, ref1 = null !== ref1 ? ref1 : _throw(new TypeError("Cannot destructure undefined")); + var _ref = {}, _ref = null !== _ref ? _ref : _throw(new TypeError("Cannot destructure undefined")), _ref1 = {}, _ref1 = null !== _ref1 ? _ref1 : _throw(new TypeError("Cannot destructure undefined")); }(), function() { var ns = [], _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0; try { - for(var _step, _iterator = ns[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0)var _value = _step.value, _value = null !== _value ? _value : _throw(new TypeError("Cannot destructure undefined")); + for(var _step, _iterator = ns[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0)var _step_value = _step.value, _step_value = null !== _step_value ? _step_value : _throw(new TypeError("Cannot destructure undefined")); } catch (err) { _didIteratorError = !0, _iteratorError = err; } finally{ @@ -32,7 +32,7 @@ import _throw from "@swc/helpers/src/_throw.mjs"; } var _iteratorNormalCompletion1 = !0, _didIteratorError1 = !1, _iteratorError1 = void 0; try { - for(var _step1, _iterator1 = ns[Symbol.iterator](); !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = !0)var _value1 = _step1.value, _value1 = null !== _value1 ? _value1 : _throw(new TypeError("Cannot destructure undefined")); + for(var _step1, _iterator1 = ns[Symbol.iterator](); !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = !0)var _step_value1 = _step1.value, _step_value1 = null !== _step_value1 ? _step_value1 : _throw(new TypeError("Cannot destructure undefined")); } catch (err) { _didIteratorError1 = !0, _iteratorError1 = err; } finally{ @@ -44,7 +44,7 @@ import _throw from "@swc/helpers/src/_throw.mjs"; } var _iteratorNormalCompletion2 = !0, _didIteratorError2 = !1, _iteratorError2 = void 0; try { - for(var _step2, _iterator2 = ns[Symbol.iterator](); !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = !0)var _value2 = _step2.value, _value2 = null !== _value2 ? _value2 : _throw(new TypeError("Cannot destructure undefined")); + for(var _step2, _iterator2 = ns[Symbol.iterator](); !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = !0)var _step_value2 = _step2.value, _step_value2 = null !== _step_value2 ? _step_value2 : _throw(new TypeError("Cannot destructure undefined")); } catch (err) { _didIteratorError2 = !0, _iteratorError2 = err; } finally{ diff --git a/crates/swc/tests/tsc-references/emptyVariableDeclarationBindingPatterns01_ES5iterable.1.normal.js b/crates/swc/tests/tsc-references/emptyVariableDeclarationBindingPatterns01_ES5iterable.1.normal.js index 9c3e82330374..44d3b55ea482 100644 --- a/crates/swc/tests/tsc-references/emptyVariableDeclarationBindingPatterns01_ES5iterable.1.normal.js +++ b/crates/swc/tests/tsc-references/emptyVariableDeclarationBindingPatterns01_ES5iterable.1.normal.js @@ -3,9 +3,9 @@ import _sliced_to_array from "@swc/helpers/src/_sliced_to_array.mjs"; import _throw from "@swc/helpers/src/_throw.mjs"; (function() { var f = function f() { - var ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : a, ref = ref !== null ? ref : _throw(new TypeError("Cannot destructure undefined")), ref1 = _sliced_to_array(arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : a, 0), ref2 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : a, tmp = ref2.p, ref3 = tmp === void 0 ? a : tmp, ref3 = ref3 !== null ? ref3 : _throw(new TypeError("Cannot destructure undefined")); + var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : a, _ref = _ref !== null ? _ref : _throw(new TypeError("Cannot destructure undefined")), _ref1 = _sliced_to_array(arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : a, 0), _ref2 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : a, tmp = _ref2.p, _ref3 = tmp === void 0 ? a : tmp, _ref3 = _ref3 !== null ? _ref3 : _throw(new TypeError("Cannot destructure undefined")); return function() { - var ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : a, ref = ref !== null ? ref : _throw(new TypeError("Cannot destructure undefined")), ref1 = _sliced_to_array(arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : a, 0), ref2 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : a, tmp = ref2.p, ref3 = tmp === void 0 ? a : tmp, ref3 = ref3 !== null ? ref3 : _throw(new TypeError("Cannot destructure undefined")); + var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : a, _ref = _ref !== null ? _ref : _throw(new TypeError("Cannot destructure undefined")), _ref1 = _sliced_to_array(arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : a, 0), _ref2 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : a, tmp = _ref2.p, _ref3 = tmp === void 0 ? a : tmp, _ref3 = _ref3 !== null ? _ref3 : _throw(new TypeError("Cannot destructure undefined")); return a; }; }; @@ -19,17 +19,17 @@ import _throw from "@swc/helpers/src/_throw.mjs"; var a = a !== null ? a : _throw(new TypeError("Cannot destructure undefined")), _a3 = _sliced_to_array(a, 0); var a = a !== null ? a : _throw(new TypeError("Cannot destructure undefined")), _a4 = _sliced_to_array(a, 0); var a = a !== null ? a : _throw(new TypeError("Cannot destructure undefined")), _a5 = _sliced_to_array(a, 0); - var _p1 = a.p1, _p1 = _p1 !== null ? _p1 : _throw(new TypeError("Cannot destructure undefined")), _p2 = _sliced_to_array(a.p2, 0); - var _p11 = a.p1, _p11 = _p11 !== null ? _p11 : _throw(new TypeError("Cannot destructure undefined")), _p21 = _sliced_to_array(a.p2, 0); - var _p12 = a.p1, _p12 = _p12 !== null ? _p12 : _throw(new TypeError("Cannot destructure undefined")), _p22 = _sliced_to_array(a.p2, 0); - for(var ref = {}, ref = ref !== null ? ref : _throw(new TypeError("Cannot destructure undefined")), ref1 = {}, ref1 = ref1 !== null ? ref1 : _throw(new TypeError("Cannot destructure undefined")); false; void 0){} + var _a_p1 = a.p1, _a_p1 = _a_p1 !== null ? _a_p1 : _throw(new TypeError("Cannot destructure undefined")), _a_p2 = _sliced_to_array(a.p2, 0); + var _a_p11 = a.p1, _a_p11 = _a_p11 !== null ? _a_p11 : _throw(new TypeError("Cannot destructure undefined")), _a_p21 = _sliced_to_array(a.p2, 0); + var _a_p12 = a.p1, _a_p12 = _a_p12 !== null ? _a_p12 : _throw(new TypeError("Cannot destructure undefined")), _a_p22 = _sliced_to_array(a.p2, 0); + for(var _ref = {}, _ref = _ref !== null ? _ref : _throw(new TypeError("Cannot destructure undefined")), _ref1 = {}, _ref1 = _ref1 !== null ? _ref1 : _throw(new TypeError("Cannot destructure undefined")); false; void 0){} })(); (function() { var ns = []; var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined; try { for(var _iterator = ns[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){ - var _value = _step.value, _value = _value !== null ? _value : _throw(new TypeError("Cannot destructure undefined")); + var _step_value = _step.value, _step_value = _step_value !== null ? _step_value : _throw(new TypeError("Cannot destructure undefined")); } } catch (err) { _didIteratorError = true; @@ -48,7 +48,7 @@ import _throw from "@swc/helpers/src/_throw.mjs"; var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined; try { for(var _iterator1 = ns[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){ - var _value1 = _step1.value, _value1 = _value1 !== null ? _value1 : _throw(new TypeError("Cannot destructure undefined")); + var _step_value1 = _step1.value, _step_value1 = _step_value1 !== null ? _step_value1 : _throw(new TypeError("Cannot destructure undefined")); } } catch (err) { _didIteratorError1 = true; @@ -67,7 +67,7 @@ import _throw from "@swc/helpers/src/_throw.mjs"; var _iteratorNormalCompletion2 = true, _didIteratorError2 = false, _iteratorError2 = undefined; try { for(var _iterator2 = ns[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true){ - var _value2 = _step2.value, _value2 = _value2 !== null ? _value2 : _throw(new TypeError("Cannot destructure undefined")); + var _step_value2 = _step2.value, _step_value2 = _step_value2 !== null ? _step_value2 : _throw(new TypeError("Cannot destructure undefined")); } } catch (err) { _didIteratorError2 = true; @@ -86,7 +86,7 @@ import _throw from "@swc/helpers/src/_throw.mjs"; var _iteratorNormalCompletion3 = true, _didIteratorError3 = false, _iteratorError3 = undefined; try { for(var _iterator3 = ns[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true){ - var _value3 = _sliced_to_array(_step3.value, 0); + var _step_value3 = _sliced_to_array(_step3.value, 0); } } catch (err) { _didIteratorError3 = true; @@ -105,7 +105,7 @@ import _throw from "@swc/helpers/src/_throw.mjs"; var _iteratorNormalCompletion4 = true, _didIteratorError4 = false, _iteratorError4 = undefined; try { for(var _iterator4 = ns[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true){ - var _value4 = _sliced_to_array(_step4.value, 0); + var _step_value4 = _sliced_to_array(_step4.value, 0); } } catch (err) { _didIteratorError4 = true; @@ -124,7 +124,7 @@ import _throw from "@swc/helpers/src/_throw.mjs"; var _iteratorNormalCompletion5 = true, _didIteratorError5 = false, _iteratorError5 = undefined; try { for(var _iterator5 = ns[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true){ - var _value5 = _sliced_to_array(_step5.value, 0); + var _step_value5 = _sliced_to_array(_step5.value, 0); } } catch (err) { _didIteratorError5 = true; diff --git a/crates/swc/tests/tsc-references/emptyVariableDeclarationBindingPatterns01_ES5iterable.2.minified.js b/crates/swc/tests/tsc-references/emptyVariableDeclarationBindingPatterns01_ES5iterable.2.minified.js index a55730729d90..6d9e3dcb8d1d 100644 --- a/crates/swc/tests/tsc-references/emptyVariableDeclarationBindingPatterns01_ES5iterable.2.minified.js +++ b/crates/swc/tests/tsc-references/emptyVariableDeclarationBindingPatterns01_ES5iterable.2.minified.js @@ -10,17 +10,17 @@ import _throw from "@swc/helpers/src/_throw.mjs"; _sliced_to_array(a, 0); var a = null !== a ? a : _throw(new TypeError("Cannot destructure undefined")); _sliced_to_array(a, 0); - var _p1 = a.p1, _p1 = null !== _p1 ? _p1 : _throw(new TypeError("Cannot destructure undefined")); + var _a_p1 = a.p1, _a_p1 = null !== _a_p1 ? _a_p1 : _throw(new TypeError("Cannot destructure undefined")); _sliced_to_array(a.p2, 0); - var _p11 = a.p1, _p11 = null !== _p11 ? _p11 : _throw(new TypeError("Cannot destructure undefined")); + var _a_p11 = a.p1, _a_p11 = null !== _a_p11 ? _a_p11 : _throw(new TypeError("Cannot destructure undefined")); _sliced_to_array(a.p2, 0); - var _p12 = a.p1, _p12 = null !== _p12 ? _p12 : _throw(new TypeError("Cannot destructure undefined")); + var _a_p12 = a.p1, _a_p12 = null !== _a_p12 ? _a_p12 : _throw(new TypeError("Cannot destructure undefined")); _sliced_to_array(a.p2, 0); - var ref = {}, ref = null !== ref ? ref : _throw(new TypeError("Cannot destructure undefined")), ref1 = {}, ref1 = null !== ref1 ? ref1 : _throw(new TypeError("Cannot destructure undefined")); + var _ref = {}, _ref = null !== _ref ? _ref : _throw(new TypeError("Cannot destructure undefined")), _ref1 = {}, _ref1 = null !== _ref1 ? _ref1 : _throw(new TypeError("Cannot destructure undefined")); }(), function() { var ns = [], _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0; try { - for(var _step, _iterator = ns[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0)var _value = _step.value, _value = null !== _value ? _value : _throw(new TypeError("Cannot destructure undefined")); + for(var _step, _iterator = ns[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0)var _step_value = _step.value, _step_value = null !== _step_value ? _step_value : _throw(new TypeError("Cannot destructure undefined")); } catch (err) { _didIteratorError = !0, _iteratorError = err; } finally{ @@ -32,7 +32,7 @@ import _throw from "@swc/helpers/src/_throw.mjs"; } var _iteratorNormalCompletion1 = !0, _didIteratorError1 = !1, _iteratorError1 = void 0; try { - for(var _step1, _iterator1 = ns[Symbol.iterator](); !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = !0)var _value1 = _step1.value, _value1 = null !== _value1 ? _value1 : _throw(new TypeError("Cannot destructure undefined")); + for(var _step1, _iterator1 = ns[Symbol.iterator](); !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = !0)var _step_value1 = _step1.value, _step_value1 = null !== _step_value1 ? _step_value1 : _throw(new TypeError("Cannot destructure undefined")); } catch (err) { _didIteratorError1 = !0, _iteratorError1 = err; } finally{ @@ -44,7 +44,7 @@ import _throw from "@swc/helpers/src/_throw.mjs"; } var _iteratorNormalCompletion2 = !0, _didIteratorError2 = !1, _iteratorError2 = void 0; try { - for(var _step2, _iterator2 = ns[Symbol.iterator](); !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = !0)var _value2 = _step2.value, _value2 = null !== _value2 ? _value2 : _throw(new TypeError("Cannot destructure undefined")); + for(var _step2, _iterator2 = ns[Symbol.iterator](); !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = !0)var _step_value2 = _step2.value, _step_value2 = null !== _step_value2 ? _step_value2 : _throw(new TypeError("Cannot destructure undefined")); } catch (err) { _didIteratorError2 = !0, _iteratorError2 = err; } finally{ diff --git a/crates/swc/tests/tsc-references/exhaustiveSwitchStatements1.1.normal.js b/crates/swc/tests/tsc-references/exhaustiveSwitchStatements1.1.normal.js index d1bd3773f55a..0411c3422b03 100644 --- a/crates/swc/tests/tsc-references/exhaustiveSwitchStatements1.1.normal.js +++ b/crates/swc/tests/tsc-references/exhaustiveSwitchStatements1.1.normal.js @@ -199,8 +199,8 @@ Animal; Animal[Animal["CAT"] = 1] = "CAT"; })(Animal || (Animal = {})); function expression() { - var ref; - switch((ref = zoo === null || zoo === void 0 ? void 0 : zoo.animal) !== null && ref !== void 0 ? ref : Animal.DOG){ + var _ref; + switch((_ref = zoo === null || zoo === void 0 ? void 0 : zoo.animal) !== null && _ref !== void 0 ? _ref : Animal.DOG){ case Animal.DOG: return Animal.DOG; case Animal.CAT: diff --git a/crates/swc/tests/tsc-references/for-of30.1.normal.js b/crates/swc/tests/tsc-references/for-of30.1.normal.js index 598295d23364..42cdc54a48dc 100644 --- a/crates/swc/tests/tsc-references/for-of30.1.normal.js +++ b/crates/swc/tests/tsc-references/for-of30.1.normal.js @@ -1,5 +1,5 @@ //// [for-of30.ts] -let _iterator = Symbol.iterator; +let _Symbol_iterator = Symbol.iterator; class StringIterator { next() { return { @@ -7,7 +7,7 @@ class StringIterator { value: "" }; } - [_iterator]() { + [_Symbol_iterator]() { return this; } constructor(){ diff --git a/crates/swc/tests/tsc-references/for-of30.2.minified.js b/crates/swc/tests/tsc-references/for-of30.2.minified.js index 32f42a66bbcd..05e5ad5c8801 100644 --- a/crates/swc/tests/tsc-references/for-of30.2.minified.js +++ b/crates/swc/tests/tsc-references/for-of30.2.minified.js @@ -1,5 +1,5 @@ //// [for-of30.ts] -let _iterator = Symbol.iterator; +let _Symbol_iterator = Symbol.iterator; for (var v of new class { next() { return { @@ -7,7 +7,7 @@ for (var v of new class { value: "" }; } - [_iterator]() { + [_Symbol_iterator]() { return this; } constructor(){ diff --git a/crates/swc/tests/tsc-references/genericClassExpressionInFunction.1.normal.js b/crates/swc/tests/tsc-references/genericClassExpressionInFunction.1.normal.js index 5b749ab96e26..99854746a7c6 100644 --- a/crates/swc/tests/tsc-references/genericClassExpressionInFunction.1.normal.js +++ b/crates/swc/tests/tsc-references/genericClassExpressionInFunction.1.normal.js @@ -45,9 +45,9 @@ function B3() { }(A); } // extends can call B -var K = /*#__PURE__*/ function(_superClass) { +var K = /*#__PURE__*/ function(_B1) { "use strict"; - _inherits(K, _superClass); + _inherits(K, _B1); var _super = _create_super(K); function K() { _class_call_check(this, K); diff --git a/crates/swc/tests/tsc-references/genericClassExpressionInFunction.2.minified.js b/crates/swc/tests/tsc-references/genericClassExpressionInFunction.2.minified.js index 888d246505a8..29e873e29978 100644 --- a/crates/swc/tests/tsc-references/genericClassExpressionInFunction.2.minified.js +++ b/crates/swc/tests/tsc-references/genericClassExpressionInFunction.2.minified.js @@ -5,9 +5,9 @@ import _create_super from "@swc/helpers/src/_create_super.mjs"; var A = function A() { "use strict"; _class_call_check(this, A); -}, K = function(_superClass) { +}, K = function(_B1) { "use strict"; - _inherits(K, _superClass); + _inherits(K, _B1); var _super = _create_super(K); function K() { return _class_call_check(this, K), _super.apply(this, arguments); diff --git a/crates/swc/tests/tsc-references/inferFromBindingPattern.1.normal.js b/crates/swc/tests/tsc-references/inferFromBindingPattern.1.normal.js index a255523b8807..816c7300dfcc 100644 --- a/crates/swc/tests/tsc-references/inferFromBindingPattern.1.normal.js +++ b/crates/swc/tests/tsc-references/inferFromBindingPattern.1.normal.js @@ -1,18 +1,18 @@ //// [inferFromBindingPattern.ts] import _sliced_to_array from "@swc/helpers/src/_sliced_to_array.mjs"; var x1 = f1(); // string -var ref = _sliced_to_array(f2(), 1), x2 = ref[0]; // string -var ref1 = f3(), x3 = ref1.x; // string +var _f2 = _sliced_to_array(f2(), 1), x2 = _f2[0]; // string +var _f3 = f3(), x3 = _f3.x; // string // Repro from #30379 function foo() { return [ 42 ]; } -var ref2 = _sliced_to_array(foo(), 1), x = ref2[0]; // [number] -var ref3 = _sliced_to_array(selectJohn(), 1), person = ref3[0]; -var ref4 = _sliced_to_array(selectJohn(), 2), any = ref4[0], whatever = ref4[1]; +var _foo = _sliced_to_array(foo(), 1), x = _foo[0]; // [number] +var _selectJohn = _sliced_to_array(selectJohn(), 1), person = _selectJohn[0]; +var _selectJohn1 = _sliced_to_array(selectJohn(), 2), any = _selectJohn1[0], whatever = _selectJohn1[1]; var john = selectJohn(); var _john = _sliced_to_array(john, 2), personAgain = _john[0], nufinspecial = _john[1]; var isStringTuple = makeTuple(stringy()); // [string] -var ref5 = _sliced_to_array(makeTuple(stringy()), 1), isAny = ref5[0]; // [string] +var _makeTuple = _sliced_to_array(makeTuple(stringy()), 1), isAny = _makeTuple[0]; // [string] diff --git a/crates/swc/tests/tsc-references/inferFromBindingPattern.2.minified.js b/crates/swc/tests/tsc-references/inferFromBindingPattern.2.minified.js index df074a212511..d4c16e1733d6 100644 --- a/crates/swc/tests/tsc-references/inferFromBindingPattern.2.minified.js +++ b/crates/swc/tests/tsc-references/inferFromBindingPattern.2.minified.js @@ -3,7 +3,7 @@ import _sliced_to_array from "@swc/helpers/src/_sliced_to_array.mjs"; f1(), _sliced_to_array(f2(), 1)[0], f3().x, _sliced_to_array([ 42 ], 1)[0], _sliced_to_array(selectJohn(), 1)[0]; -var ref = _sliced_to_array(selectJohn(), 2); -ref[0], ref[1]; +var _selectJohn = _sliced_to_array(selectJohn(), 2); +_selectJohn[0], _selectJohn[1]; var _john = _sliced_to_array(selectJohn(), 2); _john[0], _john[1], makeTuple(stringy()), _sliced_to_array(makeTuple(stringy()), 1)[0]; diff --git a/crates/swc/tests/tsc-references/instanceMemberWithComputedPropertyName.1.normal.js b/crates/swc/tests/tsc-references/instanceMemberWithComputedPropertyName.1.normal.js index 2a5873531711..52005ae6fba5 100644 --- a/crates/swc/tests/tsc-references/instanceMemberWithComputedPropertyName.1.normal.js +++ b/crates/swc/tests/tsc-references/instanceMemberWithComputedPropertyName.1.normal.js @@ -7,8 +7,8 @@ var _x = x; var C = function C() { _class_call_check(this, C); this[_x] = true; - var ref = { + var _ref = { a: 1, b: 2 - }, a = ref.a, b = ref.b; + }, a = _ref.a, b = _ref.b; }; diff --git a/crates/swc/tests/tsc-references/interfaceExtendsObjectIntersection.1.normal.js b/crates/swc/tests/tsc-references/interfaceExtendsObjectIntersection.1.normal.js index 8e604068ae54..0685a0838ba5 100644 --- a/crates/swc/tests/tsc-references/interfaceExtendsObjectIntersection.1.normal.js +++ b/crates/swc/tests/tsc-references/interfaceExtendsObjectIntersection.1.normal.js @@ -2,9 +2,9 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; import _inherits from "@swc/helpers/src/_inherits.mjs"; import _create_super from "@swc/helpers/src/_create_super.mjs"; -var C1 = /*#__PURE__*/ function(_superClass) { +var C1 = /*#__PURE__*/ function(_Constructor) { "use strict"; - _inherits(C1, _superClass); + _inherits(C1, _Constructor); var _super = _create_super(C1); function C1() { _class_call_check(this, C1); @@ -12,9 +12,9 @@ var C1 = /*#__PURE__*/ function(_superClass) { } return C1; }(Constructor()); -var C2 = /*#__PURE__*/ function(_superClass) { +var C2 = /*#__PURE__*/ function(_Constructor) { "use strict"; - _inherits(C2, _superClass); + _inherits(C2, _Constructor); var _super = _create_super(C2); function C2() { _class_call_check(this, C2); @@ -22,9 +22,9 @@ var C2 = /*#__PURE__*/ function(_superClass) { } return C2; }(Constructor()); -var C3 = /*#__PURE__*/ function(_superClass) { +var C3 = /*#__PURE__*/ function(_Constructor) { "use strict"; - _inherits(C3, _superClass); + _inherits(C3, _Constructor); var _super = _create_super(C3); function C3() { _class_call_check(this, C3); @@ -32,9 +32,9 @@ var C3 = /*#__PURE__*/ function(_superClass) { } return C3; }(Constructor()); -var C4 = /*#__PURE__*/ function(_superClass) { +var C4 = /*#__PURE__*/ function(_Constructor) { "use strict"; - _inherits(C4, _superClass); + _inherits(C4, _Constructor); var _super = _create_super(C4); function C4() { _class_call_check(this, C4); @@ -42,9 +42,9 @@ var C4 = /*#__PURE__*/ function(_superClass) { } return C4; }(Constructor()); -var C5 = /*#__PURE__*/ function(_superClass) { +var C5 = /*#__PURE__*/ function(_Constructor) { "use strict"; - _inherits(C5, _superClass); + _inherits(C5, _Constructor); var _super = _create_super(C5); function C5() { _class_call_check(this, C5); @@ -52,9 +52,9 @@ var C5 = /*#__PURE__*/ function(_superClass) { } return C5; }(Constructor()); -var C6 = /*#__PURE__*/ function(_superClass) { +var C6 = /*#__PURE__*/ function(_Constructor) { "use strict"; - _inherits(C6, _superClass); + _inherits(C6, _Constructor); var _super = _create_super(C6); function C6() { _class_call_check(this, C6); @@ -62,9 +62,9 @@ var C6 = /*#__PURE__*/ function(_superClass) { } return C6; }(Constructor()); -var C7 = /*#__PURE__*/ function(_superClass) { +var C7 = /*#__PURE__*/ function(_Constructor) { "use strict"; - _inherits(C7, _superClass); + _inherits(C7, _Constructor); var _super = _create_super(C7); function C7() { _class_call_check(this, C7); @@ -78,9 +78,9 @@ var EX; EX[EX["B"] = 1] = "B"; EX[EX["C"] = 2] = "C"; })(EX || (EX = {})); -var C20 = /*#__PURE__*/ function(_superClass) { +var C20 = /*#__PURE__*/ function(_Constructor) { "use strict"; - _inherits(C20, _superClass); + _inherits(C20, _Constructor); var _super = _create_super(C20); function C20() { _class_call_check(this, C20); @@ -88,9 +88,9 @@ var C20 = /*#__PURE__*/ function(_superClass) { } return C20; }(Constructor()); -var C21 = /*#__PURE__*/ function(_superClass) { +var C21 = /*#__PURE__*/ function(_Constructor) { "use strict"; - _inherits(C21, _superClass); + _inherits(C21, _Constructor); var _super = _create_super(C21); function C21() { _class_call_check(this, C21); @@ -98,9 +98,9 @@ var C21 = /*#__PURE__*/ function(_superClass) { } return C21; }(Constructor()); -var C22 = /*#__PURE__*/ function(_superClass) { +var C22 = /*#__PURE__*/ function(_Constructor) { "use strict"; - _inherits(C22, _superClass); + _inherits(C22, _Constructor); var _super = _create_super(C22); function C22() { _class_call_check(this, C22); @@ -108,9 +108,9 @@ var C22 = /*#__PURE__*/ function(_superClass) { } return C22; }(Constructor()); -var C23 = /*#__PURE__*/ function(_superClass) { +var C23 = /*#__PURE__*/ function(_Constructor) { "use strict"; - _inherits(C23, _superClass); + _inherits(C23, _Constructor); var _super = _create_super(C23); function C23() { _class_call_check(this, C23); diff --git a/crates/swc/tests/tsc-references/interfaceExtendsObjectIntersectionErrors.1.normal.js b/crates/swc/tests/tsc-references/interfaceExtendsObjectIntersectionErrors.1.normal.js index 4dcb86e3c084..7faf84967e8b 100644 --- a/crates/swc/tests/tsc-references/interfaceExtendsObjectIntersectionErrors.1.normal.js +++ b/crates/swc/tests/tsc-references/interfaceExtendsObjectIntersectionErrors.1.normal.js @@ -2,9 +2,9 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; import _inherits from "@swc/helpers/src/_inherits.mjs"; import _create_super from "@swc/helpers/src/_create_super.mjs"; -var C1 = /*#__PURE__*/ function(_superClass) { +var C1 = /*#__PURE__*/ function(_Constructor) { "use strict"; - _inherits(C1, _superClass); + _inherits(C1, _Constructor); var _super = _create_super(C1); function C1() { _class_call_check(this, C1); @@ -12,9 +12,9 @@ var C1 = /*#__PURE__*/ function(_superClass) { } return C1; }(Constructor()); -var C2 = /*#__PURE__*/ function(_superClass) { +var C2 = /*#__PURE__*/ function(_Constructor) { "use strict"; - _inherits(C2, _superClass); + _inherits(C2, _Constructor); var _super = _create_super(C2); function C2() { _class_call_check(this, C2); @@ -22,9 +22,9 @@ var C2 = /*#__PURE__*/ function(_superClass) { } return C2; }(Constructor()); -var C3 = /*#__PURE__*/ function(_superClass) { +var C3 = /*#__PURE__*/ function(_Constructor) { "use strict"; - _inherits(C3, _superClass); + _inherits(C3, _Constructor); var _super = _create_super(C3); function C3() { _class_call_check(this, C3); @@ -32,9 +32,9 @@ var C3 = /*#__PURE__*/ function(_superClass) { } return C3; }(Constructor()); -var C4 = /*#__PURE__*/ function(_superClass) { +var C4 = /*#__PURE__*/ function(_Constructor) { "use strict"; - _inherits(C4, _superClass); + _inherits(C4, _Constructor); var _super = _create_super(C4); function C4() { _class_call_check(this, C4); @@ -42,9 +42,9 @@ var C4 = /*#__PURE__*/ function(_superClass) { } return C4; }(Constructor()); -var C5 = /*#__PURE__*/ function(_superClass) { +var C5 = /*#__PURE__*/ function(_Constructor) { "use strict"; - _inherits(C5, _superClass); + _inherits(C5, _Constructor); var _super = _create_super(C5); function C5() { _class_call_check(this, C5); diff --git a/crates/swc/tests/tsc-references/jsDeclarationsReexportedCjsAlias.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsReexportedCjsAlias.1.normal.js index 0bcfbb70de8d..802ff795d7e1 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsReexportedCjsAlias.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsReexportedCjsAlias.1.normal.js @@ -21,7 +21,7 @@ module.exports = { SomeClass: SomeClass }; //// [main.js] -var ref = require("./lib"), SomeClass = ref.SomeClass, Another = ref.SomeClass; +var _require = require("./lib"), SomeClass = _require.SomeClass, Another = _require.SomeClass; module.exports = { SomeClass: SomeClass, Another: Another diff --git a/crates/swc/tests/tsc-references/jsDeclarationsReexportedCjsAlias.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsReexportedCjsAlias.2.minified.js index 0c44caa76333..c71ded15b181 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsReexportedCjsAlias.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsReexportedCjsAlias.2.minified.js @@ -16,7 +16,7 @@ module.exports = { SomeClass: SomeClass }; //// [main.js] -var ref = require("./lib"), SomeClass = ref.SomeClass, Another = ref.SomeClass; +var _require = require("./lib"), SomeClass = _require.SomeClass, Another = _require.SomeClass; module.exports = { SomeClass: SomeClass, Another: Another diff --git a/crates/swc/tests/tsc-references/jsDeclarationsTypeReferences2.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsTypeReferences2.1.normal.js index 89b5c65a3130..b33bf6fc0de5 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsTypeReferences2.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsTypeReferences2.1.normal.js @@ -4,7 +4,7 @@ export var o = { m: 1 }; //// [index.js] -var _o = require("./something").o, a = _o.a, m = _o.m; +var _require_o = require("./something").o, a = _require_o.a, m = _require_o.m; var thing = a + m; module.exports = { thing: thing diff --git a/crates/swc/tests/tsc-references/jsDeclarationsTypeReferences2.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsTypeReferences2.2.minified.js index 50759263cc0d..7874015f2e40 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsTypeReferences2.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsTypeReferences2.2.minified.js @@ -4,7 +4,7 @@ export var o = { m: 1 }; //// [index.js] -var _o = require("./something").o, a = _o.a, m = _o.m; +var _require_o = require("./something").o, a = _require_o.a, m = _require_o.m; module.exports = { thing: a + m }; diff --git a/crates/swc/tests/tsc-references/jsDeclarationsTypedefPropertyAndExportAssignment.1.normal.js b/crates/swc/tests/tsc-references/jsDeclarationsTypedefPropertyAndExportAssignment.1.normal.js index 60aabcbc075a..9ead284d60d9 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsTypedefPropertyAndExportAssignment.1.normal.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsTypedefPropertyAndExportAssignment.1.normal.js @@ -23,7 +23,7 @@ module.exports = { }; //// [index.js] import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -var ref = require("./module.js"), taskGroups = ref.taskGroups, taskNameToGroup = ref.taskNameToGroup; +var _require = require("./module.js"), taskGroups = _require.taskGroups, taskNameToGroup = _require.taskNameToGroup; /** @typedef {import('./module.js').TaskGroup} TaskGroup */ /** * @typedef TaskNode * @prop {TaskNode[]} children diff --git a/crates/swc/tests/tsc-references/jsDeclarationsTypedefPropertyAndExportAssignment.2.minified.js b/crates/swc/tests/tsc-references/jsDeclarationsTypedefPropertyAndExportAssignment.2.minified.js index 4a3718820dc0..118ce6d5bdb7 100644 --- a/crates/swc/tests/tsc-references/jsDeclarationsTypedefPropertyAndExportAssignment.2.minified.js +++ b/crates/swc/tests/tsc-references/jsDeclarationsTypedefPropertyAndExportAssignment.2.minified.js @@ -14,8 +14,8 @@ module.exports = { }; //// [index.js] import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -var ref = require("./module.js"); -ref.taskGroups, ref.taskNameToGroup, module.exports = function MainThreadTasks(x, y) { +var _require = require("./module.js"); +_require.taskGroups, _require.taskNameToGroup, module.exports = function MainThreadTasks(x, y) { "use strict"; _class_call_check(this, MainThreadTasks); }; diff --git a/crates/swc/tests/tsc-references/literalTypes2.1.normal.js b/crates/swc/tests/tsc-references/literalTypes2.1.normal.js index a0e6ac513feb..caa4f83b65be 100644 --- a/crates/swc/tests/tsc-references/literalTypes2.1.normal.js +++ b/crates/swc/tests/tsc-references/literalTypes2.1.normal.js @@ -135,16 +135,16 @@ function f5() { ]; } function f6() { - var ref = { + var _ref = { c1: false, c2: 1, c3: "bar" - }, _c1 = ref.c1, c1 = _c1 === void 0 ? true : _c1, _c2 = ref.c2, c2 = _c2 === void 0 ? 0 : _c2, _c3 = ref.c3, c3 = _c3 === void 0 ? "foo" : _c3; - var ref1 = { + }, _ref_c1 = _ref.c1, c1 = _ref_c1 === void 0 ? true : _ref_c1, _ref_c2 = _ref.c2, c2 = _ref_c2 === void 0 ? 0 : _ref_c2, _ref_c3 = _ref.c3, c3 = _ref_c3 === void 0 ? "foo" : _ref_c3; + var _ref1 = { x1: false, x2: 1, x3: "bar" - }, _x1 = ref1.x1, x1 = _x1 === void 0 ? true : _x1, _x2 = ref1.x2, x2 = _x2 === void 0 ? 0 : _x2, _x3 = ref1.x3, x3 = _x3 === void 0 ? "foo" : _x3; + }, _ref_x1 = _ref1.x1, x1 = _ref_x1 === void 0 ? true : _ref_x1, _ref_x2 = _ref1.x2, x2 = _ref_x2 === void 0 ? 0 : _ref_x2, _ref_x3 = _ref1.x3, x3 = _ref_x3 === void 0 ? "foo" : _ref_x3; } function f10() { return "hello"; diff --git a/crates/swc/tests/tsc-references/literalTypesAndDestructuring.1.normal.js b/crates/swc/tests/tsc-references/literalTypesAndDestructuring.1.normal.js index 96de6e72f561..7556c849ecf0 100644 --- a/crates/swc/tests/tsc-references/literalTypesAndDestructuring.1.normal.js +++ b/crates/swc/tests/tsc-references/literalTypesAndDestructuring.1.normal.js @@ -4,11 +4,11 @@ var tmp = x.a, a2 = tmp === void 0 ? 0 : tmp; var tmp1 = x.a, a3 = tmp1 === void 0 ? 2 : tmp1; var tmp2 = x.a, a4 = tmp2 === void 0 ? 2 : tmp2; var b1 = x.a; -var _a; -var b2 = (_a = x.a) !== null && _a !== void 0 ? _a : 0; -var _a1; -var b3 = (_a1 = x.a) !== null && _a1 !== void 0 ? _a1 : 2; -var _a2; -var b4 = (_a2 = x.a) !== null && _a2 !== void 0 ? _a2 : 2; -var ref = {}, _bar = ref.bar, bar = _bar === void 0 ? "yo" : _bar; +var _x_a; +var b2 = (_x_a = x.a) !== null && _x_a !== void 0 ? _x_a : 0; +var _x_a1; +var b3 = (_x_a1 = x.a) !== null && _x_a1 !== void 0 ? _x_a1 : 2; +var _x_a2; +var b4 = (_x_a2 = x.a) !== null && _x_a2 !== void 0 ? _x_a2 : 2; +var _ref = {}, _ref_bar = _ref.bar, bar = _ref_bar === void 0 ? "yo" : _ref_bar; bar; // "yo" | "ha" diff --git a/crates/swc/tests/tsc-references/literalTypesAndTypeAssertions.1.normal.js b/crates/swc/tests/tsc-references/literalTypesAndTypeAssertions.1.normal.js index b0a6ad04d53d..da1a1749666c 100644 --- a/crates/swc/tests/tsc-references/literalTypesAndTypeAssertions.1.normal.js +++ b/crates/swc/tests/tsc-references/literalTypesAndTypeAssertions.1.normal.js @@ -6,15 +6,15 @@ var obj = { }; var x1 = 1; var x2 = 1; -var ref = { +var _ref = { a: "foo" -}, _a = ref.a, a = _a === void 0 ? "foo" : _a; -var ref1 = { +}, _ref_a = _ref.a, a = _ref_a === void 0 ? "foo" : _ref_a; +var _ref1 = { b: "bar" -}, _b = ref1.b, b = _b === void 0 ? "foo" : _b; -var ref2 = { +}, _ref_b = _ref1.b, b = _ref_b === void 0 ? "foo" : _ref_b; +var _ref2 = { c: "bar" -}, _c = ref2.c, c = _c === void 0 ? "foo" : _c; -var ref3 = { +}, _ref_c = _ref2.c, c = _ref_c === void 0 ? "foo" : _ref_c; +var _ref3 = { d: "bar" -}, _d = ref3.d, d = _d === void 0 ? "foo" : _d; +}, _ref_d = _ref3.d, d = _ref_d === void 0 ? "foo" : _ref_d; diff --git a/crates/swc/tests/tsc-references/logicalAssignment10(target=es2015).1.normal.js b/crates/swc/tests/tsc-references/logicalAssignment10(target=es2015).1.normal.js index 1182f7e3338f..2e870563637f 100644 --- a/crates/swc/tests/tsc-references/logicalAssignment10(target=es2015).1.normal.js +++ b/crates/swc/tests/tsc-references/logicalAssignment10(target=es2015).1.normal.js @@ -1,5 +1,5 @@ //// [logicalAssignment10.ts] -var _obj, _ref, _ref1, _ref2; +var _obj, _incr, _oobj_obj, _incr1; var count = 0; var obj = {}; function incr() { @@ -8,7 +8,7 @@ function incr() { const oobj = { obj }; -var ref; -(ref = (_obj = obj)[_ref = incr()]) !== null && ref !== void 0 ? ref : _obj[_ref] = incr(); -var ref1; -(ref1 = (_ref1 = oobj["obj"])[_ref2 = incr()]) !== null && ref1 !== void 0 ? ref1 : _ref1[_ref2] = incr(); +var _; +(_ = (_obj = obj)[_incr = incr()]) !== null && _ !== void 0 ? _ : _obj[_incr] = incr(); +var _1; +(_1 = (_oobj_obj = oobj["obj"])[_incr1 = incr()]) !== null && _1 !== void 0 ? _1 : _oobj_obj[_incr1] = incr(); diff --git a/crates/swc/tests/tsc-references/logicalAssignment10(target=es2015).2.minified.js b/crates/swc/tests/tsc-references/logicalAssignment10(target=es2015).2.minified.js index cdd066f9148d..9f767357eb20 100644 --- a/crates/swc/tests/tsc-references/logicalAssignment10(target=es2015).2.minified.js +++ b/crates/swc/tests/tsc-references/logicalAssignment10(target=es2015).2.minified.js @@ -1,5 +1,5 @@ //// [logicalAssignment10.ts] -var _obj, _ref, _ref1, _ref2, ref, ref1, count = 0, obj = {}; -null !== (ref = (_obj = obj)[_ref = ++count]) && void 0 !== ref || (_obj[_ref] = ++count), null !== (ref1 = (_ref1 = ({ +var _obj, _incr, _oobj_obj, _incr1, _, _1, count = 0, obj = {}; +null !== (_ = (_obj = obj)[_incr = ++count]) && void 0 !== _ || (_obj[_incr] = ++count), null !== (_1 = (_oobj_obj = ({ obj -}).obj)[_ref2 = ++count]) && void 0 !== ref1 || (_ref1[_ref2] = ++count); +}).obj)[_incr1 = ++count]) && void 0 !== _1 || (_oobj_obj[_incr1] = ++count); diff --git a/crates/swc/tests/tsc-references/logicalAssignment10(target=es2020).1.normal.js b/crates/swc/tests/tsc-references/logicalAssignment10(target=es2020).1.normal.js index d44cbb376cff..375469b42502 100644 --- a/crates/swc/tests/tsc-references/logicalAssignment10(target=es2020).1.normal.js +++ b/crates/swc/tests/tsc-references/logicalAssignment10(target=es2020).1.normal.js @@ -1,5 +1,5 @@ //// [logicalAssignment10.ts] -var _obj, _ref, _ref1, _ref2; +var _obj, _incr, _oobj_obj, _incr1; var count = 0; var obj = {}; function incr() { @@ -8,5 +8,5 @@ function incr() { const oobj = { obj }; -(_obj = obj)[_ref = incr()] ?? (_obj[_ref] = incr()); -(_ref1 = oobj["obj"])[_ref2 = incr()] ?? (_ref1[_ref2] = incr()); +(_obj = obj)[_incr = incr()] ?? (_obj[_incr] = incr()); +(_oobj_obj = oobj["obj"])[_incr1 = incr()] ?? (_oobj_obj[_incr1] = incr()); diff --git a/crates/swc/tests/tsc-references/logicalAssignment10(target=es2020).2.minified.js b/crates/swc/tests/tsc-references/logicalAssignment10(target=es2020).2.minified.js index b6e88407df32..1a0684542b94 100644 --- a/crates/swc/tests/tsc-references/logicalAssignment10(target=es2020).2.minified.js +++ b/crates/swc/tests/tsc-references/logicalAssignment10(target=es2020).2.minified.js @@ -1,5 +1,5 @@ //// [logicalAssignment10.ts] -var _obj, _ref, _ref1, _ref2, count = 0, obj = {}; -(_obj = obj)[_ref = ++count] ?? (_obj[_ref] = ++count), (_ref1 = ({ +var _obj, _incr, _oobj_obj, _incr1, count = 0, obj = {}; +(_obj = obj)[_incr = ++count] ?? (_obj[_incr] = ++count), (_oobj_obj = ({ obj -}).obj)[_ref2 = ++count] ?? (_ref1[_ref2] = ++count); +}).obj)[_incr1 = ++count] ?? (_oobj_obj[_incr1] = ++count); diff --git a/crates/swc/tests/tsc-references/logicalAssignment2(target=es2015).1.normal.js b/crates/swc/tests/tsc-references/logicalAssignment2(target=es2015).1.normal.js index 658daf660030..8ad17e7b84bb 100644 --- a/crates/swc/tests/tsc-references/logicalAssignment2(target=es2015).1.normal.js +++ b/crates/swc/tests/tsc-references/logicalAssignment2(target=es2015).1.normal.js @@ -1,14 +1,14 @@ //// [logicalAssignment2.ts] -var _a, _b, _c, _foo, _ref, _foo1, _ref1, _foo2, _ref2, _ref3, _ref4, _ref5; +var _a, _b, _c, _a_foo, _baz, _b_foo, _baz1, _c_foo, _baz2, _a_foo_bar, _b_foo_bar, _c_foo_bar; (_a = a).baz && (_a.baz = result.baz); (_b = b).baz || (_b.baz = result.baz); -var _baz; -(_baz = (_c = c).baz) !== null && _baz !== void 0 ? _baz : _c.baz = result.baz; -(_foo = a.foo)[_ref = "baz"] && (_foo[_ref] = result.foo.baz); -(_foo1 = b.foo)[_ref1 = "baz"] || (_foo1[_ref1] = result.foo.baz); -var ref; -(ref = (_foo2 = c.foo)[_ref2 = "baz"]) !== null && ref !== void 0 ? ref : _foo2[_ref2] = result.foo.baz; -(_ref3 = a.foo.bar()).baz && (_ref3.baz = result.foo.bar().baz); -(_ref4 = b.foo.bar()).baz || (_ref4.baz = result.foo.bar().baz); -var _baz1; -(_baz1 = (_ref5 = c.foo.bar()).baz) !== null && _baz1 !== void 0 ? _baz1 : _ref5.baz = result.foo.bar().baz; +var _baz3; +(_baz3 = (_c = c).baz) !== null && _baz3 !== void 0 ? _baz3 : _c.baz = result.baz; +(_a_foo = a.foo)[_baz = "baz"] && (_a_foo[_baz] = result.foo.baz); +(_b_foo = b.foo)[_baz1 = "baz"] || (_b_foo[_baz1] = result.foo.baz); +var _; +(_ = (_c_foo = c.foo)[_baz2 = "baz"]) !== null && _ !== void 0 ? _ : _c_foo[_baz2] = result.foo.baz; +(_a_foo_bar = a.foo.bar()).baz && (_a_foo_bar.baz = result.foo.bar().baz); +(_b_foo_bar = b.foo.bar()).baz || (_b_foo_bar.baz = result.foo.bar().baz); +var _baz4; +(_baz4 = (_c_foo_bar = c.foo.bar()).baz) !== null && _baz4 !== void 0 ? _baz4 : _c_foo_bar.baz = result.foo.bar().baz; diff --git a/crates/swc/tests/tsc-references/logicalAssignment2(target=es2015).2.minified.js b/crates/swc/tests/tsc-references/logicalAssignment2(target=es2015).2.minified.js index ce85e9db844c..abbfb1ad92f1 100644 --- a/crates/swc/tests/tsc-references/logicalAssignment2(target=es2015).2.minified.js +++ b/crates/swc/tests/tsc-references/logicalAssignment2(target=es2015).2.minified.js @@ -1,3 +1,3 @@ //// [logicalAssignment2.ts] -var _a, _b, _c, _foo, _foo1, _foo2, _ref, _ref1, _ref2, _baz, ref, _baz1; -(_a = a).baz && (_a.baz = result.baz), (_b = b).baz || (_b.baz = result.baz), null !== (_baz = (_c = c).baz) && void 0 !== _baz || (_c.baz = result.baz), (_foo = a.foo).baz && (_foo.baz = result.foo.baz), (_foo1 = b.foo).baz || (_foo1.baz = result.foo.baz), null !== (ref = (_foo2 = c.foo).baz) && void 0 !== ref || (_foo2.baz = result.foo.baz), (_ref = a.foo.bar()).baz && (_ref.baz = result.foo.bar().baz), (_ref1 = b.foo.bar()).baz || (_ref1.baz = result.foo.bar().baz), null !== (_baz1 = (_ref2 = c.foo.bar()).baz) && void 0 !== _baz1 || (_ref2.baz = result.foo.bar().baz); +var _a, _b, _c, _a_foo, _b_foo, _c_foo, _a_foo_bar, _b_foo_bar, _c_foo_bar, _baz, _, _baz1; +(_a = a).baz && (_a.baz = result.baz), (_b = b).baz || (_b.baz = result.baz), null !== (_baz = (_c = c).baz) && void 0 !== _baz || (_c.baz = result.baz), (_a_foo = a.foo).baz && (_a_foo.baz = result.foo.baz), (_b_foo = b.foo).baz || (_b_foo.baz = result.foo.baz), null !== (_ = (_c_foo = c.foo).baz) && void 0 !== _ || (_c_foo.baz = result.foo.baz), (_a_foo_bar = a.foo.bar()).baz && (_a_foo_bar.baz = result.foo.bar().baz), (_b_foo_bar = b.foo.bar()).baz || (_b_foo_bar.baz = result.foo.bar().baz), null !== (_baz1 = (_c_foo_bar = c.foo.bar()).baz) && void 0 !== _baz1 || (_c_foo_bar.baz = result.foo.bar().baz); diff --git a/crates/swc/tests/tsc-references/logicalAssignment2(target=es2020).1.normal.js b/crates/swc/tests/tsc-references/logicalAssignment2(target=es2020).1.normal.js index 3b35f8ce4ad8..c210f6e2eb7a 100644 --- a/crates/swc/tests/tsc-references/logicalAssignment2(target=es2020).1.normal.js +++ b/crates/swc/tests/tsc-references/logicalAssignment2(target=es2020).1.normal.js @@ -1,11 +1,11 @@ //// [logicalAssignment2.ts] -var _a, _b, _c, _foo, _ref, _foo1, _ref1, _foo2, _ref2, _ref3, _ref4, _ref5; +var _a, _b, _c, _a_foo, _baz, _b_foo, _baz1, _c_foo, _baz2, _a_foo_bar, _b_foo_bar, _c_foo_bar; (_a = a).baz && (_a.baz = result.baz); (_b = b).baz || (_b.baz = result.baz); (_c = c).baz ?? (_c.baz = result.baz); -(_foo = a.foo)[_ref = "baz"] && (_foo[_ref] = result.foo.baz); -(_foo1 = b.foo)[_ref1 = "baz"] || (_foo1[_ref1] = result.foo.baz); -(_foo2 = c.foo)[_ref2 = "baz"] ?? (_foo2[_ref2] = result.foo.baz); -(_ref3 = a.foo.bar()).baz && (_ref3.baz = result.foo.bar().baz); -(_ref4 = b.foo.bar()).baz || (_ref4.baz = result.foo.bar().baz); -(_ref5 = c.foo.bar()).baz ?? (_ref5.baz = result.foo.bar().baz); +(_a_foo = a.foo)[_baz = "baz"] && (_a_foo[_baz] = result.foo.baz); +(_b_foo = b.foo)[_baz1 = "baz"] || (_b_foo[_baz1] = result.foo.baz); +(_c_foo = c.foo)[_baz2 = "baz"] ?? (_c_foo[_baz2] = result.foo.baz); +(_a_foo_bar = a.foo.bar()).baz && (_a_foo_bar.baz = result.foo.bar().baz); +(_b_foo_bar = b.foo.bar()).baz || (_b_foo_bar.baz = result.foo.bar().baz); +(_c_foo_bar = c.foo.bar()).baz ?? (_c_foo_bar.baz = result.foo.bar().baz); diff --git a/crates/swc/tests/tsc-references/logicalAssignment2(target=es2020).2.minified.js b/crates/swc/tests/tsc-references/logicalAssignment2(target=es2020).2.minified.js index fd196d61420c..dce4d83ffe54 100644 --- a/crates/swc/tests/tsc-references/logicalAssignment2(target=es2020).2.minified.js +++ b/crates/swc/tests/tsc-references/logicalAssignment2(target=es2020).2.minified.js @@ -1,3 +1,3 @@ //// [logicalAssignment2.ts] -var _a, _b, _c, _foo, _foo1, _foo2, _ref, _ref1, _ref2; -(_a = a).baz && (_a.baz = result.baz), (_b = b).baz || (_b.baz = result.baz), (_c = c).baz ?? (_c.baz = result.baz), (_foo = a.foo).baz && (_foo.baz = result.foo.baz), (_foo1 = b.foo).baz || (_foo1.baz = result.foo.baz), (_foo2 = c.foo).baz ?? (_foo2.baz = result.foo.baz), (_ref = a.foo.bar()).baz && (_ref.baz = result.foo.bar().baz), (_ref1 = b.foo.bar()).baz || (_ref1.baz = result.foo.bar().baz), (_ref2 = c.foo.bar()).baz ?? (_ref2.baz = result.foo.bar().baz); +var _a, _b, _c, _a_foo, _b_foo, _c_foo, _a_foo_bar, _b_foo_bar, _c_foo_bar; +(_a = a).baz && (_a.baz = result.baz), (_b = b).baz || (_b.baz = result.baz), (_c = c).baz ?? (_c.baz = result.baz), (_a_foo = a.foo).baz && (_a_foo.baz = result.foo.baz), (_b_foo = b.foo).baz || (_b_foo.baz = result.foo.baz), (_c_foo = c.foo).baz ?? (_c_foo.baz = result.foo.baz), (_a_foo_bar = a.foo.bar()).baz && (_a_foo_bar.baz = result.foo.bar().baz), (_b_foo_bar = b.foo.bar()).baz || (_b_foo_bar.baz = result.foo.bar().baz), (_c_foo_bar = c.foo.bar()).baz ?? (_c_foo_bar.baz = result.foo.bar().baz); diff --git a/crates/swc/tests/tsc-references/logicalAssignment8(target=es2015).1.normal.js b/crates/swc/tests/tsc-references/logicalAssignment8(target=es2015).1.normal.js index 4e1807ef07d6..0a96c8fcb4f2 100644 --- a/crates/swc/tests/tsc-references/logicalAssignment8(target=es2015).1.normal.js +++ b/crates/swc/tests/tsc-references/logicalAssignment8(target=es2015).1.normal.js @@ -1,13 +1,13 @@ //// [logicalAssignment8.ts] function foo1(results) { - var ref; - (results || (results = (ref = bar === null || bar === void 0 ? void 0 : bar.value) !== null && ref !== void 0 ? ref : [])).push(100); + var _ref; + (results || (results = (_ref = bar === null || bar === void 0 ? void 0 : bar.value) !== null && _ref !== void 0 ? _ref : [])).push(100); } function foo2(results) { - var ref; - (results !== null && results !== void 0 ? results : results = (ref = bar === null || bar === void 0 ? void 0 : bar.value) !== null && ref !== void 0 ? ref : []).push(100); + var _ref; + (results !== null && results !== void 0 ? results : results = (_ref = bar === null || bar === void 0 ? void 0 : bar.value) !== null && _ref !== void 0 ? _ref : []).push(100); } function foo3(results) { - var ref; - (results && (results = (ref = bar === null || bar === void 0 ? void 0 : bar.value) !== null && ref !== void 0 ? ref : [])).push(100); + var _ref; + (results && (results = (_ref = bar === null || bar === void 0 ? void 0 : bar.value) !== null && _ref !== void 0 ? _ref : [])).push(100); } diff --git a/crates/swc/tests/tsc-references/missingAndExcessProperties.1.normal.js b/crates/swc/tests/tsc-references/missingAndExcessProperties.1.normal.js index 8ce71bbbabb0..dd8a1df37a6b 100644 --- a/crates/swc/tests/tsc-references/missingAndExcessProperties.1.normal.js +++ b/crates/swc/tests/tsc-references/missingAndExcessProperties.1.normal.js @@ -2,10 +2,10 @@ // Missing properties import _throw from "@swc/helpers/src/_throw.mjs"; function f1() { - var ref = {}, x = ref.x, y = ref.y; - var ref1 = {}, _x = ref1.x, x = _x === void 0 ? 1 : _x, y = ref1.y; - var ref2 = {}, x = ref2.x, _y = ref2.y, y = _y === void 0 ? 1 : _y; - var ref3 = {}, _x1 = ref3.x, x = _x1 === void 0 ? 1 : _x1, _y1 = ref3.y, y = _y1 === void 0 ? 1 : _y1; + var _ref = {}, x = _ref.x, y = _ref.y; + var _ref1 = {}, _ref_x = _ref1.x, x = _ref_x === void 0 ? 1 : _ref_x, y = _ref1.y; + var _ref2 = {}, x = _ref2.x, _ref_y = _ref2.y, y = _ref_y === void 0 ? 1 : _ref_y; + var _ref3 = {}, _ref_x1 = _ref3.x, x = _ref_x1 === void 0 ? 1 : _ref_x1, _ref_y1 = _ref3.y, y = _ref_y1 === void 0 ? 1 : _ref_y1; } // Missing properties function f2() { @@ -21,10 +21,10 @@ function f2() { } // Excess properties function f3() { - var ref = { + var _ref = { x: 0, y: 0 - }, ref = ref !== null ? ref : _throw(new TypeError("Cannot destructure undefined")); + }, _ref = _ref !== null ? _ref : _throw(new TypeError("Cannot destructure undefined")); var x = { x: 0, y: 0 @@ -33,10 +33,10 @@ function f3() { x: 0, y: 0 }.y; - var ref1 = { + var _ref1 = { x: 0, y: 0 - }, x = ref1.x, y = ref1.y; + }, x = _ref1.x, y = _ref1.y; } // Excess properties function f4() { diff --git a/crates/swc/tests/tsc-references/mixinAccessModifiers.1.normal.js b/crates/swc/tests/tsc-references/mixinAccessModifiers.1.normal.js index 035b30f8fb53..287e335062d0 100644 --- a/crates/swc/tests/tsc-references/mixinAccessModifiers.1.normal.js +++ b/crates/swc/tests/tsc-references/mixinAccessModifiers.1.normal.js @@ -63,9 +63,9 @@ function f6(x) { x.p; // Ok, public if any constituent is public } // Can't derive from type with inaccessible properties -var C1 = /*#__PURE__*/ function(_superClass) { +var C1 = /*#__PURE__*/ function(_Mix) { "use strict"; - _inherits(C1, _superClass); + _inherits(C1, _Mix); var _super = _create_super(C1); function C1() { _class_call_check(this, C1); @@ -73,9 +73,9 @@ var C1 = /*#__PURE__*/ function(_superClass) { } return C1; }(Mix(Private, Private2)); -var C2 = /*#__PURE__*/ function(_superClass) { +var C2 = /*#__PURE__*/ function(_Mix) { "use strict"; - _inherits(C2, _superClass); + _inherits(C2, _Mix); var _super = _create_super(C2); function C2() { _class_call_check(this, C2); @@ -83,9 +83,9 @@ var C2 = /*#__PURE__*/ function(_superClass) { } return C2; }(Mix(Private, Protected)); -var C3 = /*#__PURE__*/ function(_superClass) { +var C3 = /*#__PURE__*/ function(_Mix) { "use strict"; - _inherits(C3, _superClass); + _inherits(C3, _Mix); var _super = _create_super(C3); function C3() { _class_call_check(this, C3); @@ -93,9 +93,9 @@ var C3 = /*#__PURE__*/ function(_superClass) { } return C3; }(Mix(Private, Public)); -var C4 = /*#__PURE__*/ function(_superClass) { +var C4 = /*#__PURE__*/ function(_Mix) { "use strict"; - _inherits(C4, _superClass); + _inherits(C4, _Mix); var _super = _create_super(C4); function C4() { _class_call_check(this, C4); @@ -114,9 +114,9 @@ var C4 = /*#__PURE__*/ function(_superClass) { }; return C4; }(Mix(Protected, Protected2)); -var C5 = /*#__PURE__*/ function(_superClass) { +var C5 = /*#__PURE__*/ function(_Mix) { "use strict"; - _inherits(C5, _superClass); + _inherits(C5, _Mix); var _super = _create_super(C5); function C5() { _class_call_check(this, C5); @@ -135,9 +135,9 @@ var C5 = /*#__PURE__*/ function(_superClass) { }; return C5; }(Mix(Protected, Public)); -var C6 = /*#__PURE__*/ function(_superClass) { +var C6 = /*#__PURE__*/ function(_Mix) { "use strict"; - _inherits(C6, _superClass); + _inherits(C6, _Mix); var _super = _create_super(C6); function C6() { _class_call_check(this, C6); diff --git a/crates/swc/tests/tsc-references/mixinAccessModifiers.2.minified.js b/crates/swc/tests/tsc-references/mixinAccessModifiers.2.minified.js index 3023a301d12d..b6e1cb7dccf1 100644 --- a/crates/swc/tests/tsc-references/mixinAccessModifiers.2.minified.js +++ b/crates/swc/tests/tsc-references/mixinAccessModifiers.2.minified.js @@ -20,9 +20,9 @@ Mix(Private, function Private2() { for(var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; _class_call_check(this, Private2); }), Mix(Private, Protected), Mix(Private, Public); -var C4 = function(_superClass) { +var C4 = function(_Mix) { "use strict"; - _inherits(C4, _superClass); + _inherits(C4, _Mix); var _super = _create_super(C4); function C4() { return _class_call_check(this, C4), _super.apply(this, arguments); @@ -36,9 +36,9 @@ var C4 = function(_superClass) { "use strict"; for(var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; _class_call_check(this, Protected2); -})), C5 = function(_superClass) { +})), C5 = function(_Mix) { "use strict"; - _inherits(C5, _superClass); + _inherits(C5, _Mix); var _super = _create_super(C5); function C5() { return _class_call_check(this, C5), _super.apply(this, arguments); @@ -48,9 +48,9 @@ var C4 = function(_superClass) { }, C5.g = function() { C4.s, C5.s, C6.s; }, C5; -}(Mix(Protected, Public)), C6 = function(_superClass) { +}(Mix(Protected, Public)), C6 = function(_Mix) { "use strict"; - _inherits(C6, _superClass); + _inherits(C6, _Mix); var _super = _create_super(C6); function C6() { return _class_call_check(this, C6), _super.apply(this, arguments); diff --git a/crates/swc/tests/tsc-references/nestedDestructuringOfRequire.1.normal.js b/crates/swc/tests/tsc-references/nestedDestructuringOfRequire.1.normal.js index e3fbe0ae3991..405808a076dc 100644 --- a/crates/swc/tests/tsc-references/nestedDestructuringOfRequire.1.normal.js +++ b/crates/swc/tests/tsc-references/nestedDestructuringOfRequire.1.normal.js @@ -5,6 +5,6 @@ var chalk = { }; module.exports.chalk = chalk; //// [main.js] -var ref = require("./mod1"), grey = ref.chalk.grey; +var _require = require("./mod1"), grey = _require.chalk.grey; grey; chalk; diff --git a/crates/swc/tests/tsc-references/nullishCoalescingOperator1.1.normal.js b/crates/swc/tests/tsc-references/nullishCoalescingOperator1.1.normal.js index 82bb24ada14a..3a0ff9b46de6 100644 --- a/crates/swc/tests/tsc-references/nullishCoalescingOperator1.1.normal.js +++ b/crates/swc/tests/tsc-references/nullishCoalescingOperator1.1.normal.js @@ -32,8 +32,8 @@ if (maybeBool !== null && maybeBool !== void 0 ? maybeBool : true) { } else { foo(); } -var ref; -if ((ref = false) !== null && ref !== void 0 ? ref : true) { +var _ref; +if ((_ref = false) !== null && _ref !== void 0 ? _ref : true) { foo(); } else { foo(); diff --git a/crates/swc/tests/tsc-references/nullishCoalescingOperator10.1.normal.js b/crates/swc/tests/tsc-references/nullishCoalescingOperator10.1.normal.js index af40a7a88e46..86c4be2bec9b 100644 --- a/crates/swc/tests/tsc-references/nullishCoalescingOperator10.1.normal.js +++ b/crates/swc/tests/tsc-references/nullishCoalescingOperator10.1.normal.js @@ -1,3 +1,3 @@ //// [nullishCoalescingOperator10.ts] -var ref; -var gg = (ref = f()) !== null && ref !== void 0 ? ref : "foo"; +var _f; +var gg = (_f = f()) !== null && _f !== void 0 ? _f : "foo"; diff --git a/crates/swc/tests/tsc-references/nullishCoalescingOperator12.1.normal.js b/crates/swc/tests/tsc-references/nullishCoalescingOperator12.1.normal.js index 4cfe79d1a268..2480b707e6cb 100644 --- a/crates/swc/tests/tsc-references/nullishCoalescingOperator12.1.normal.js +++ b/crates/swc/tests/tsc-references/nullishCoalescingOperator12.1.normal.js @@ -2,5 +2,5 @@ const obj = { arr: [] }; -var ref; -for (const i of (ref = obj === null || obj === void 0 ? void 0 : obj.arr) !== null && ref !== void 0 ? ref : []){} +var _ref; +for (const i of (_ref = obj === null || obj === void 0 ? void 0 : obj.arr) !== null && _ref !== void 0 ? _ref : []){} diff --git a/crates/swc/tests/tsc-references/nullishCoalescingOperator12.2.minified.js b/crates/swc/tests/tsc-references/nullishCoalescingOperator12.2.minified.js index 68a65aa78f01..6bfece459e0e 100644 --- a/crates/swc/tests/tsc-references/nullishCoalescingOperator12.2.minified.js +++ b/crates/swc/tests/tsc-references/nullishCoalescingOperator12.2.minified.js @@ -1,6 +1,6 @@ //// [nullishCoalescingOperator12.ts] -var ref; +var _ref; const obj = { arr: [] }; -for (const i of null !== (ref = null == obj ? void 0 : obj.arr) && void 0 !== ref ? ref : []); +for (const i of null !== (_ref = null == obj ? void 0 : obj.arr) && void 0 !== _ref ? _ref : []); diff --git a/crates/swc/tests/tsc-references/nullishCoalescingOperator3.1.normal.js b/crates/swc/tests/tsc-references/nullishCoalescingOperator3.1.normal.js index dfa24d06f6d3..edc5aa11e4bd 100644 --- a/crates/swc/tests/tsc-references/nullishCoalescingOperator3.1.normal.js +++ b/crates/swc/tests/tsc-references/nullishCoalescingOperator3.1.normal.js @@ -1,3 +1,3 @@ //// [nullishCoalescingOperator3.ts] -var ref, ref1, ref2, ref3, ref4; -var aa1 = (ref4 = (ref3 = (ref2 = (ref1 = (ref = a1 !== null && a1 !== void 0 ? a1 : a2) !== null && ref !== void 0 ? ref : a3) !== null && ref1 !== void 0 ? ref1 : a4) !== null && ref2 !== void 0 ? ref2 : a5) !== null && ref3 !== void 0 ? ref3 : a6) !== null && ref4 !== void 0 ? ref4 : "whatever"; +var _ref, _ref1, _ref2, _ref3, _ref4; +var aa1 = (_ref4 = (_ref3 = (_ref2 = (_ref1 = (_ref = a1 !== null && a1 !== void 0 ? a1 : a2) !== null && _ref !== void 0 ? _ref : a3) !== null && _ref1 !== void 0 ? _ref1 : a4) !== null && _ref2 !== void 0 ? _ref2 : a5) !== null && _ref3 !== void 0 ? _ref3 : a6) !== null && _ref4 !== void 0 ? _ref4 : "whatever"; diff --git a/crates/swc/tests/tsc-references/nullishCoalescingOperator8.1.normal.js b/crates/swc/tests/tsc-references/nullishCoalescingOperator8.1.normal.js index e2e2e446d281..b2aedf59fb60 100644 --- a/crates/swc/tests/tsc-references/nullishCoalescingOperator8.1.normal.js +++ b/crates/swc/tests/tsc-references/nullishCoalescingOperator8.1.normal.js @@ -1,7 +1,7 @@ //// [nullishCoalescingOperator8.ts] -var _p; -var n1 = (_p = a.p) !== null && _p !== void 0 ? _p : "default"; -var ref; -var n2 = (ref = a.m()) !== null && ref !== void 0 ? ref : "default"; -var ref1, ref2, ref3; -var n3 = (ref3 = (ref2 = (ref1 = a.m()) !== null && ref1 !== void 0 ? ref1 : b.p) !== null && ref2 !== void 0 ? ref2 : b.m()) !== null && ref3 !== void 0 ? ref3 : "default"; +var _a_p; +var n1 = (_a_p = a.p) !== null && _a_p !== void 0 ? _a_p : "default"; +var _a_m; +var n2 = (_a_m = a.m()) !== null && _a_m !== void 0 ? _a_m : "default"; +var _a_m1, _ref, _ref1; +var n3 = (_ref1 = (_ref = (_a_m1 = a.m()) !== null && _a_m1 !== void 0 ? _a_m1 : b.p) !== null && _ref !== void 0 ? _ref : b.m()) !== null && _ref1 !== void 0 ? _ref1 : "default"; diff --git a/crates/swc/tests/tsc-references/nullishCoalescingOperator8.2.minified.js b/crates/swc/tests/tsc-references/nullishCoalescingOperator8.2.minified.js index 90d968cb4f43..be38fd560c23 100644 --- a/crates/swc/tests/tsc-references/nullishCoalescingOperator8.2.minified.js +++ b/crates/swc/tests/tsc-references/nullishCoalescingOperator8.2.minified.js @@ -1,3 +1,3 @@ //// [nullishCoalescingOperator8.ts] -var ref, ref1; -a.p, a.m(), null !== (ref1 = null !== (ref = a.m()) && void 0 !== ref ? ref : b.p) && void 0 !== ref1 || b.m(); +var _a_m, _ref; +a.p, a.m(), null !== (_ref = null !== (_a_m = a.m()) && void 0 !== _a_m ? _a_m : b.p) && void 0 !== _ref || b.m(); diff --git a/crates/swc/tests/tsc-references/nullishCoalescingOperatorInAsyncGenerator(target=es2015).1.normal.js b/crates/swc/tests/tsc-references/nullishCoalescingOperatorInAsyncGenerator(target=es2015).1.normal.js index b4c3c23ad515..55e55ab7de88 100644 --- a/crates/swc/tests/tsc-references/nullishCoalescingOperatorInAsyncGenerator(target=es2015).1.normal.js +++ b/crates/swc/tests/tsc-references/nullishCoalescingOperatorInAsyncGenerator(target=es2015).1.normal.js @@ -6,8 +6,8 @@ function f(a) { } function _f() { _f = _wrap_async_generator(function*(a) { - var _b; - let c = (_b = a.b) !== null && _b !== void 0 ? _b : 10; + var _a_b; + let c = (_a_b = a.b) !== null && _a_b !== void 0 ? _a_b : 10; while(c){ yield c--; } diff --git a/crates/swc/tests/tsc-references/nullishCoalescingOperatorInAsyncGenerator(target=es5).1.normal.js b/crates/swc/tests/tsc-references/nullishCoalescingOperatorInAsyncGenerator(target=es5).1.normal.js index a1a76ef77165..1691a2f49c53 100644 --- a/crates/swc/tests/tsc-references/nullishCoalescingOperatorInAsyncGenerator(target=es5).1.normal.js +++ b/crates/swc/tests/tsc-references/nullishCoalescingOperatorInAsyncGenerator(target=es5).1.normal.js @@ -7,11 +7,11 @@ function f(a) { } function _f() { _f = _wrap_async_generator(function(a) { - var _b, c; + var _a_b, c; return _ts_generator(this, function(_state) { switch(_state.label){ case 0: - c = (_b = a.b) !== null && _b !== void 0 ? _b : 10; + c = (_a_b = a.b) !== null && _a_b !== void 0 ? _a_b : 10; _state.label = 1; case 1: if (!c) return [ diff --git a/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterBindingPattern(target=es2015).1.normal.js b/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterBindingPattern(target=es2015).1.normal.js index 0448136f1c1d..c98892467db8 100644 --- a/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterBindingPattern(target=es2015).1.normal.js +++ b/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterBindingPattern(target=es2015).1.normal.js @@ -1,5 +1,5 @@ //// [nullishCoalescingOperatorInParameterBindingPattern.ts] // https://github.com/microsoft/TypeScript/issues/36295 const a = ()=>undefined; -var ref; -(({ [(ref = a()) !== null && ref !== void 0 ? ref : "d"]: c = "" })=>{})(); +var _a; +(({ [(_a = a()) !== null && _a !== void 0 ? _a : "d"]: c = "" })=>{})(); diff --git a/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterBindingPattern(target=es5).1.normal.js b/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterBindingPattern(target=es5).1.normal.js index ea1f0a376d47..145f63a7f5eb 100644 --- a/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterBindingPattern(target=es5).1.normal.js +++ b/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterBindingPattern(target=es5).1.normal.js @@ -3,7 +3,7 @@ var a = function() { return undefined; }; -var ref; +var _a; (function(param) { - var tmp = param[(ref = a()) !== null && ref !== void 0 ? ref : "d"], c = tmp === void 0 ? "" : tmp; + var tmp = param[(_a = a()) !== null && _a !== void 0 ? _a : "d"], c = tmp === void 0 ? "" : tmp; })(); diff --git a/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterBindingPattern.2(target=es2015).1.normal.js b/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterBindingPattern.2(target=es2015).1.normal.js index 12abce5f796d..cc50f204e8bc 100644 --- a/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterBindingPattern.2(target=es2015).1.normal.js +++ b/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterBindingPattern.2(target=es2015).1.normal.js @@ -1,12 +1,12 @@ //// [nullishCoalescingOperatorInParameterBindingPattern.2.ts] // https://github.com/microsoft/TypeScript/issues/36295 const a = ()=>undefined; -var ref; -(({ [(ref = a()) !== null && ref !== void 0 ? ref : "d"]: c = "" })=>{ +var _a; +(({ [(_a = a()) !== null && _a !== void 0 ? _a : "d"]: c = "" })=>{ var a1; })(); const x = ""; -var ref1; -(({ [(ref1 = a()) !== null && ref1 !== void 0 ? ref1 : "d"]: c = "" , d =x })=>{ +var _a1; +(({ [(_a1 = a()) !== null && _a1 !== void 0 ? _a1 : "d"]: c = "" , d =x })=>{ var x1; })(); diff --git a/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterBindingPattern.2(target=es5).1.normal.js b/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterBindingPattern.2(target=es5).1.normal.js index 309e7e7104e5..dfdf81a97277 100644 --- a/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterBindingPattern.2(target=es5).1.normal.js +++ b/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterBindingPattern.2(target=es5).1.normal.js @@ -3,14 +3,14 @@ var a = function() { return undefined; }; -var ref; +var _a; (function(param) { - var tmp = param[(ref = a()) !== null && ref !== void 0 ? ref : "d"], c = tmp === void 0 ? "" : tmp; + var tmp = param[(_a = a()) !== null && _a !== void 0 ? _a : "d"], c = tmp === void 0 ? "" : tmp; var a1; })(); var x = ""; -var ref1; +var _a1; (function(param) { - var tmp = param[(ref1 = a()) !== null && ref1 !== void 0 ? ref1 : "d"], c = tmp === void 0 ? "" : tmp, _d = param.d, d = _d === void 0 ? x : _d; + var tmp = param[(_a1 = a()) !== null && _a1 !== void 0 ? _a1 : "d"], c = tmp === void 0 ? "" : tmp, _param_d = param.d, d = _param_d === void 0 ? x : _param_d; var x1; })(); diff --git a/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterBindingPattern.2(target=es5).2.minified.js b/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterBindingPattern.2(target=es5).2.minified.js index 5a50e0567af9..f9b4d7b14200 100644 --- a/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterBindingPattern.2(target=es5).2.minified.js +++ b/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterBindingPattern.2(target=es5).2.minified.js @@ -1,5 +1,5 @@ //// [nullishCoalescingOperatorInParameterBindingPattern.2.ts] -var ref, ref1, a = function() {}; -(void 0)[null !== (ref = a()) && void 0 !== ref ? ref : "d"], function(param) { - param[null !== (ref1 = a()) && void 0 !== ref1 ? ref1 : "d"], param.d; +var _a, _a1, a = function() {}; +(void 0)[null !== (_a = a()) && void 0 !== _a ? _a : "d"], function(param) { + param[null !== (_a1 = a()) && void 0 !== _a1 ? _a1 : "d"], param.d; }(); diff --git a/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterInitializer(target=es2015).1.normal.js b/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterInitializer(target=es2015).1.normal.js index 0a816eb39758..8381e4c99e72 100644 --- a/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterInitializer(target=es2015).1.normal.js +++ b/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterInitializer(target=es2015).1.normal.js @@ -1,5 +1,5 @@ //// [nullishCoalescingOperatorInParameterInitializer.ts] // https://github.com/microsoft/TypeScript/issues/36295 const a = ()=>undefined; -var ref; -((b = (ref = a()) !== null && ref !== void 0 ? ref : "d")=>{})(); +var _a; +((b = (_a = a()) !== null && _a !== void 0 ? _a : "d")=>{})(); diff --git a/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterInitializer(target=es5).1.normal.js b/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterInitializer(target=es5).1.normal.js index 9073ad085bb9..78cefb872e78 100644 --- a/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterInitializer(target=es5).1.normal.js +++ b/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterInitializer(target=es5).1.normal.js @@ -3,7 +3,7 @@ var a = function() { return undefined; }; -var ref; +var _a; (function() { - var b = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : (ref = a()) !== null && ref !== void 0 ? ref : "d"; + var b = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : (_a = a()) !== null && _a !== void 0 ? _a : "d"; })(); diff --git a/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterInitializer.2(target=es2015).1.normal.js b/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterInitializer.2(target=es2015).1.normal.js index b295359c55f3..bbfabef3c763 100644 --- a/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterInitializer.2(target=es2015).1.normal.js +++ b/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterInitializer.2(target=es2015).1.normal.js @@ -1,12 +1,12 @@ //// [nullishCoalescingOperatorInParameterInitializer.2.ts] // https://github.com/microsoft/TypeScript/issues/36295 const a = ()=>undefined; -var ref; -((b = (ref = a()) !== null && ref !== void 0 ? ref : "d")=>{ +var _a; +((b = (_a = a()) !== null && _a !== void 0 ? _a : "d")=>{ var a1; })(); const x = ""; -var ref1; -((b = (ref1 = a()) !== null && ref1 !== void 0 ? ref1 : "d", d = x)=>{ +var _a1; +((b = (_a1 = a()) !== null && _a1 !== void 0 ? _a1 : "d", d = x)=>{ var x1; })(); diff --git a/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterInitializer.2(target=es5).1.normal.js b/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterInitializer.2(target=es5).1.normal.js index 3bf68e7a6dfb..f8c3465b69cb 100644 --- a/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterInitializer.2(target=es5).1.normal.js +++ b/crates/swc/tests/tsc-references/nullishCoalescingOperatorInParameterInitializer.2(target=es5).1.normal.js @@ -3,14 +3,14 @@ var a = function() { return undefined; }; -var ref; +var _a; (function() { - var b = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : (ref = a()) !== null && ref !== void 0 ? ref : "d"; + var b = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : (_a = a()) !== null && _a !== void 0 ? _a : "d"; var a1; })(); var x = ""; -var ref1; +var _a1; (function() { - var b = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : (ref1 = a()) !== null && ref1 !== void 0 ? ref1 : "d", d = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : x; + var b = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : (_a1 = a()) !== null && _a1 !== void 0 ? _a1 : "d", d = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : x; var x1; })(); diff --git a/crates/swc/tests/tsc-references/objectBindingPatternKeywordIdentifiers06.1.normal.js b/crates/swc/tests/tsc-references/objectBindingPatternKeywordIdentifiers06.1.normal.js index a646330206ab..bad2d76cf9ce 100644 --- a/crates/swc/tests/tsc-references/objectBindingPatternKeywordIdentifiers06.1.normal.js +++ b/crates/swc/tests/tsc-references/objectBindingPatternKeywordIdentifiers06.1.normal.js @@ -1,4 +1,4 @@ //// [objectBindingPatternKeywordIdentifiers06.ts] -var ref = { +var _ref = { as: 1 -}, as = ref.as; +}, as = _ref.as; diff --git a/crates/swc/tests/tsc-references/objectRestForOf.1.normal.js b/crates/swc/tests/tsc-references/objectRestForOf.1.normal.js index e6f9f46265e7..273f20e85979 100644 --- a/crates/swc/tests/tsc-references/objectRestForOf.1.normal.js +++ b/crates/swc/tests/tsc-references/objectRestForOf.1.normal.js @@ -15,10 +15,10 @@ for (let _ref of array){ let xx; let rrestOff; for (var _ref1 of array){ - var __ref; - __ref = _ref1, rrestOff = _object_without_properties(__ref, [ + var _ref2; + _ref2 = _ref1, rrestOff = _object_without_properties(_ref2, [ "x" - ]), ({ x: xx } = __ref), __ref; + ]), ({ x: xx } = _ref2), _ref2; [ xx, rrestOff diff --git a/crates/swc/tests/tsc-references/objectRestForOf.2.minified.js b/crates/swc/tests/tsc-references/objectRestForOf.2.minified.js index 925a29373ec6..b39d6bfc393d 100644 --- a/crates/swc/tests/tsc-references/objectRestForOf.2.minified.js +++ b/crates/swc/tests/tsc-references/objectRestForOf.2.minified.js @@ -4,14 +4,14 @@ import _object_spread from "@swc/helpers/src/_object_spread.mjs"; import _object_spread_props from "@swc/helpers/src/_object_spread_props.mjs"; import _object_without_properties from "@swc/helpers/src/_object_without_properties.mjs"; for (let _ref of array){ - var __ref, { x } = _ref; + var _ref1, { x } = _ref; _object_without_properties(_ref, [ "x" ]); } -for (var _ref1 of array)_object_without_properties(__ref = _ref1, [ +for (var _ref2 of array)_object_without_properties(_ref1 = _ref2, [ "x" -]), { x: xx } = __ref; +]), { x: xx } = _ref1; for (let norest of array.map((a)=>_object_spread_props(_object_spread({}, a), { x: 'a string' })))norest.x, norest.y; diff --git a/crates/swc/tests/tsc-references/objectRestParameterES5.1.normal.js b/crates/swc/tests/tsc-references/objectRestParameterES5.1.normal.js index 6d46d27f0c89..59979f072284 100644 --- a/crates/swc/tests/tsc-references/objectRestParameterES5.1.normal.js +++ b/crates/swc/tests/tsc-references/objectRestParameterES5.1.normal.js @@ -21,7 +21,7 @@ suddenly(function() { }, y: "noo" }; - var _x = _param.x, _z = _x.z, z = _z === void 0 ? 12 : _z, nested = _object_without_properties(_param.x, [ + var _param_x = _param.x, _param_x_z = _param_x.z, z = _param_x_z === void 0 ? 12 : _param_x_z, nested = _object_without_properties(_param.x, [ "z" ]), rest = _object_without_properties(_param, [ "x" @@ -55,7 +55,7 @@ var C = /*#__PURE__*/ function() { }(); function foobar() { var _param = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; - var _bar = _param.bar, bar = _bar === void 0 ? {} : _bar, opts = _object_without_properties(_param, [ + var _param_bar = _param.bar, bar = _param_bar === void 0 ? {} : _param_bar, opts = _object_without_properties(_param, [ "bar" ]); } diff --git a/crates/swc/tests/tsc-references/optionalBindingParameters3.1.normal.js b/crates/swc/tests/tsc-references/optionalBindingParameters3.1.normal.js index 1908e61f5625..19d08002b747 100644 --- a/crates/swc/tests/tsc-references/optionalBindingParameters3.1.normal.js +++ b/crates/swc/tests/tsc-references/optionalBindingParameters3.1.normal.js @@ -5,5 +5,5 @@ */ /** * @param {Foo} [options] */ function f(param) { - var _a = param.a, a = _a === void 0 ? "a" : _a; + var _param_a = param.a, a = _param_a === void 0 ? "a" : _param_a; } diff --git a/crates/swc/tests/tsc-references/optionalChainingInLoop.1.normal.js b/crates/swc/tests/tsc-references/optionalChainingInLoop.1.normal.js index c01b3b3506fe..d0c0f4491a23 100644 --- a/crates/swc/tests/tsc-references/optionalChainingInLoop.1.normal.js +++ b/crates/swc/tests/tsc-references/optionalChainingInLoop.1.normal.js @@ -12,8 +12,8 @@ try { try { for(var _iterator = comp.c[Symbol.iterator](), _step1; !(_iteratorNormalCompletion = (_step1 = _iterator.next()).done); _iteratorNormalCompletion = true){ var item = _step1.value; - var ref; - item.v = !!((ref = item.t) === null || ref === void 0 ? void 0 : ref.length); + var _item_t; + item.v = !!((_item_t = item.t) === null || _item_t === void 0 ? void 0 : _item_t.length); } } catch (err) { _didIteratorError = true; diff --git a/crates/swc/tests/tsc-references/optionalChainingInLoop.2.minified.js b/crates/swc/tests/tsc-references/optionalChainingInLoop.2.minified.js index 00d84cce2293..dc6bd4e74a66 100644 --- a/crates/swc/tests/tsc-references/optionalChainingInLoop.2.minified.js +++ b/crates/swc/tests/tsc-references/optionalChainingInLoop.2.minified.js @@ -9,8 +9,8 @@ try { var _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0; try { for(var _step1, _iterator = comp.c[Symbol.iterator](); !(_iteratorNormalCompletion = (_step1 = _iterator.next()).done); _iteratorNormalCompletion = !0){ - var ref, item = _step1.value; - item.v = !!(null === (ref = item.t) || void 0 === ref ? void 0 : ref.length); + var _item_t, item = _step1.value; + item.v = !!(null === (_item_t = item.t) || void 0 === _item_t ? void 0 : _item_t.length); } } catch (err) { _didIteratorError = !0, _iteratorError = err; diff --git a/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern(target=es2015).1.normal.js b/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern(target=es2015).1.normal.js index 29ee90247cc0..ac57cef81d88 100644 --- a/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern(target=es2015).1.normal.js +++ b/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern(target=es2015).1.normal.js @@ -1,5 +1,5 @@ //// [optionalChainingInParameterBindingPattern.ts] // https://github.com/microsoft/TypeScript/issues/36295 -var ref; +var _a; const a = ()=>undefined; -(({ [(ref = a()) === null || ref === void 0 ? void 0 : ref.d]: c = "" })=>{})(); +(({ [(_a = a()) === null || _a === void 0 ? void 0 : _a.d]: c = "" })=>{})(); diff --git a/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern(target=es5).1.normal.js b/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern(target=es5).1.normal.js index 4d3afbd28ac7..9b8528b50e00 100644 --- a/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern(target=es5).1.normal.js +++ b/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern(target=es5).1.normal.js @@ -1,9 +1,9 @@ //// [optionalChainingInParameterBindingPattern.ts] // https://github.com/microsoft/TypeScript/issues/36295 -var ref; +var _a; var a = function() { return undefined; }; (function(param) { - var tmp = param[(ref = a()) === null || ref === void 0 ? void 0 : ref.d], c = tmp === void 0 ? "" : tmp; + var tmp = param[(_a = a()) === null || _a === void 0 ? void 0 : _a.d], c = tmp === void 0 ? "" : tmp; })(); diff --git a/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern.2(target=es2015).1.normal.js b/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern.2(target=es2015).1.normal.js index 6fc8eb1216cd..db74042c0608 100644 --- a/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern.2(target=es2015).1.normal.js +++ b/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern.2(target=es2015).1.normal.js @@ -1,11 +1,11 @@ //// [optionalChainingInParameterBindingPattern.2.ts] // https://github.com/microsoft/TypeScript/issues/36295 -var ref, ref1; +var _a, _a1; const a = ()=>undefined; -(({ [(ref = a()) === null || ref === void 0 ? void 0 : ref.d]: c = "" })=>{ +(({ [(_a = a()) === null || _a === void 0 ? void 0 : _a.d]: c = "" })=>{ var a1; })(); const x = ""; -(({ [(ref1 = a()) === null || ref1 === void 0 ? void 0 : ref1.d]: c }, d = x)=>{ +(({ [(_a1 = a()) === null || _a1 === void 0 ? void 0 : _a1.d]: c }, d = x)=>{ var x1; })(); diff --git a/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern.2(target=es5).1.normal.js b/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern.2(target=es5).1.normal.js index 59bc265acc4e..f1e790c9b056 100644 --- a/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern.2(target=es5).1.normal.js +++ b/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern.2(target=es5).1.normal.js @@ -1,15 +1,15 @@ //// [optionalChainingInParameterBindingPattern.2.ts] // https://github.com/microsoft/TypeScript/issues/36295 -var ref, ref1; +var _a, _a1; var a = function() { return undefined; }; (function(param) { - var tmp = param[(ref = a()) === null || ref === void 0 ? void 0 : ref.d], c = tmp === void 0 ? "" : tmp; + var tmp = param[(_a = a()) === null || _a === void 0 ? void 0 : _a.d], c = tmp === void 0 ? "" : tmp; var a1; })(); var x = ""; (function(param) { - var c = param[(ref1 = a()) === null || ref1 === void 0 ? void 0 : ref1.d], d = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : x; + var c = param[(_a1 = a()) === null || _a1 === void 0 ? void 0 : _a1.d], d = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : x; var x1; })(); diff --git a/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern.2(target=es5).2.minified.js b/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern.2(target=es5).2.minified.js index e866aa1c6331..36349b3b23e2 100644 --- a/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern.2(target=es5).2.minified.js +++ b/crates/swc/tests/tsc-references/optionalChainingInParameterBindingPattern.2(target=es5).2.minified.js @@ -1,5 +1,5 @@ //// [optionalChainingInParameterBindingPattern.2.ts] -var ref, ref1, a = function() {}; -(void 0)[null === (ref = a()) || void 0 === ref ? void 0 : ref.d], function() { - (void 0)[null === (ref1 = a()) || void 0 === ref1 ? void 0 : ref1.d], arguments.length > 1 && void 0 !== arguments[1] && arguments[1]; +var _a, _a1, a = function() {}; +(void 0)[null === (_a = a()) || void 0 === _a ? void 0 : _a.d], function() { + (void 0)[null === (_a1 = a()) || void 0 === _a1 ? void 0 : _a1.d], arguments.length > 1 && void 0 !== arguments[1] && arguments[1]; }(); diff --git a/crates/swc/tests/tsc-references/optionalChainingInParameterInitializer(target=es2015).1.normal.js b/crates/swc/tests/tsc-references/optionalChainingInParameterInitializer(target=es2015).1.normal.js index 4647bf717b12..949041a21650 100644 --- a/crates/swc/tests/tsc-references/optionalChainingInParameterInitializer(target=es2015).1.normal.js +++ b/crates/swc/tests/tsc-references/optionalChainingInParameterInitializer(target=es2015).1.normal.js @@ -1,5 +1,5 @@ //// [optionalChainingInParameterInitializer.ts] // https://github.com/microsoft/TypeScript/issues/36295 -var ref; +var _a; const a = ()=>undefined; -((b = (ref = a()) === null || ref === void 0 ? void 0 : ref.d)=>{})(); +((b = (_a = a()) === null || _a === void 0 ? void 0 : _a.d)=>{})(); diff --git a/crates/swc/tests/tsc-references/optionalChainingInParameterInitializer(target=es5).1.normal.js b/crates/swc/tests/tsc-references/optionalChainingInParameterInitializer(target=es5).1.normal.js index 66bb50866469..4e94e87f4197 100644 --- a/crates/swc/tests/tsc-references/optionalChainingInParameterInitializer(target=es5).1.normal.js +++ b/crates/swc/tests/tsc-references/optionalChainingInParameterInitializer(target=es5).1.normal.js @@ -1,9 +1,9 @@ //// [optionalChainingInParameterInitializer.ts] // https://github.com/microsoft/TypeScript/issues/36295 -var ref; +var _a; var a = function() { return undefined; }; (function() { - var b = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : (ref = a()) === null || ref === void 0 ? void 0 : ref.d; + var b = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : (_a = a()) === null || _a === void 0 ? void 0 : _a.d; })(); diff --git a/crates/swc/tests/tsc-references/optionalChainingInParameterInitializer(target=es5).2.minified.js b/crates/swc/tests/tsc-references/optionalChainingInParameterInitializer(target=es5).2.minified.js index aa26f0546031..03b2d3f52f91 100644 --- a/crates/swc/tests/tsc-references/optionalChainingInParameterInitializer(target=es5).2.minified.js +++ b/crates/swc/tests/tsc-references/optionalChainingInParameterInitializer(target=es5).2.minified.js @@ -1,5 +1,5 @@ //// [optionalChainingInParameterInitializer.ts] -var ref, a = function() {}; +var _a, a = function() {}; !function() { - arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null === (ref = a()) || void 0 === ref || ref.d; + arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null === (_a = a()) || void 0 === _a || _a.d; }(); diff --git a/crates/swc/tests/tsc-references/optionalChainingInParameterInitializer.2(target=es2015).1.normal.js b/crates/swc/tests/tsc-references/optionalChainingInParameterInitializer.2(target=es2015).1.normal.js index c15a40308d11..4db8054ef862 100644 --- a/crates/swc/tests/tsc-references/optionalChainingInParameterInitializer.2(target=es2015).1.normal.js +++ b/crates/swc/tests/tsc-references/optionalChainingInParameterInitializer.2(target=es2015).1.normal.js @@ -1,11 +1,11 @@ //// [optionalChainingInParameterInitializer.2.ts] // https://github.com/microsoft/TypeScript/issues/36295 -var ref, ref1; +var _a, _a1; const a = ()=>undefined; -((b = (ref = a()) === null || ref === void 0 ? void 0 : ref.d)=>{ +((b = (_a = a()) === null || _a === void 0 ? void 0 : _a.d)=>{ var a1; })(); const x = ""; -((b = (ref1 = a()) === null || ref1 === void 0 ? void 0 : ref1.d, d = x)=>{ +((b = (_a1 = a()) === null || _a1 === void 0 ? void 0 : _a1.d, d = x)=>{ var x1; })(); diff --git a/crates/swc/tests/tsc-references/optionalChainingInParameterInitializer.2(target=es5).1.normal.js b/crates/swc/tests/tsc-references/optionalChainingInParameterInitializer.2(target=es5).1.normal.js index 3faaf23d354d..b37bf3d45a69 100644 --- a/crates/swc/tests/tsc-references/optionalChainingInParameterInitializer.2(target=es5).1.normal.js +++ b/crates/swc/tests/tsc-references/optionalChainingInParameterInitializer.2(target=es5).1.normal.js @@ -1,15 +1,15 @@ //// [optionalChainingInParameterInitializer.2.ts] // https://github.com/microsoft/TypeScript/issues/36295 -var ref, ref1; +var _a, _a1; var a = function() { return undefined; }; (function() { - var b = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : (ref = a()) === null || ref === void 0 ? void 0 : ref.d; + var b = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : (_a = a()) === null || _a === void 0 ? void 0 : _a.d; var a1; })(); var x = ""; (function() { - var b = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : (ref1 = a()) === null || ref1 === void 0 ? void 0 : ref1.d, d = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : x; + var b = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : (_a1 = a()) === null || _a1 === void 0 ? void 0 : _a1.d, d = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : x; var x1; })(); diff --git a/crates/swc/tests/tsc-references/optionalChainingInParameterInitializer.2(target=es5).2.minified.js b/crates/swc/tests/tsc-references/optionalChainingInParameterInitializer.2(target=es5).2.minified.js index 503029171c58..a2a2789b52b1 100644 --- a/crates/swc/tests/tsc-references/optionalChainingInParameterInitializer.2(target=es5).2.minified.js +++ b/crates/swc/tests/tsc-references/optionalChainingInParameterInitializer.2(target=es5).2.minified.js @@ -1,7 +1,7 @@ //// [optionalChainingInParameterInitializer.2.ts] -var ref, ref1, a = function() {}; +var _a, _a1, a = function() {}; !function() { - arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null === (ref = a()) || void 0 === ref || ref.d; + arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null === (_a = a()) || void 0 === _a || _a.d; }(), function() { - arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null === (ref1 = a()) || void 0 === ref1 || ref1.d, arguments.length > 1 && void 0 !== arguments[1] && arguments[1]; + arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null === (_a1 = a()) || void 0 === _a1 || _a1.d, arguments.length > 1 && void 0 !== arguments[1] && arguments[1]; }(); diff --git a/crates/swc/tests/tsc-references/optionalChainingInTypeAssertions(target=es2015).1.normal.js b/crates/swc/tests/tsc-references/optionalChainingInTypeAssertions(target=es2015).1.normal.js index 7f496687f3a7..444a346e35a6 100644 --- a/crates/swc/tests/tsc-references/optionalChainingInTypeAssertions(target=es2015).1.normal.js +++ b/crates/swc/tests/tsc-references/optionalChainingInTypeAssertions(target=es2015).1.normal.js @@ -1,13 +1,13 @@ //// [optionalChainingInTypeAssertions.ts] -var ref, ref1, /*a1*/ /*a2*/ ref2, /*b1*/ ref3 /*b3*/ ; +var _foo_m, _foo_m1, /*a1*/ /*a2*/ _foo_m2, /*b1*/ _foo_m3 /*b3*/ ; class Foo { m() {} } const foo = new Foo(); -(ref = foo.m) === null || ref === void 0 ? void 0 : ref.call(foo); -(ref1 = foo.m) === null || ref1 === void 0 ? void 0 : ref1.call(foo); -(ref2 = foo.m) === null || ref2 === void 0 ? void 0 : ref2.call(foo); -(ref3 = foo.m) === null || ref3 === void 0 ? void 0 : ref3.call(foo); +(_foo_m = foo.m) === null || _foo_m === void 0 ? void 0 : _foo_m.call(foo); +(_foo_m1 = foo.m) === null || _foo_m1 === void 0 ? void 0 : _foo_m1.call(foo); +(_foo_m2 = foo.m) === null || _foo_m2 === void 0 ? void 0 : _foo_m2.call(foo); +(_foo_m3 = foo.m) === null || _foo_m3 === void 0 ? void 0 : _foo_m3.call(foo); // https://github.com/microsoft/TypeScript/issues/50148 (foo === null || foo === void 0 ? void 0 : foo.m).length; (foo === null || foo === void 0 ? void 0 : foo.m).length; diff --git a/crates/swc/tests/tsc-references/optionalChainingInTypeAssertions(target=es2015).2.minified.js b/crates/swc/tests/tsc-references/optionalChainingInTypeAssertions(target=es2015).2.minified.js index 376e00286978..2409a2c321d8 100644 --- a/crates/swc/tests/tsc-references/optionalChainingInTypeAssertions(target=es2015).2.minified.js +++ b/crates/swc/tests/tsc-references/optionalChainingInTypeAssertions(target=es2015).2.minified.js @@ -1,6 +1,6 @@ //// [optionalChainingInTypeAssertions.ts] -var ref, ref1, ref2, ref3; +var _foo_m, _foo_m1, _foo_m2, _foo_m3; const foo = new class { m() {} }(); -null === (ref = foo.m) || void 0 === ref || ref.call(foo), null === (ref1 = foo.m) || void 0 === ref1 || ref1.call(foo), null === (ref2 = foo.m) || void 0 === ref2 || ref2.call(foo), null === (ref3 = foo.m) || void 0 === ref3 || ref3.call(foo), (null == foo ? void 0 : foo.m).length, (null == foo ? void 0 : foo.m).length, (null == foo ? void 0 : foo.m).length, (null == foo ? void 0 : foo.m).length; +null === (_foo_m = foo.m) || void 0 === _foo_m || _foo_m.call(foo), null === (_foo_m1 = foo.m) || void 0 === _foo_m1 || _foo_m1.call(foo), null === (_foo_m2 = foo.m) || void 0 === _foo_m2 || _foo_m2.call(foo), null === (_foo_m3 = foo.m) || void 0 === _foo_m3 || _foo_m3.call(foo), (null == foo ? void 0 : foo.m).length, (null == foo ? void 0 : foo.m).length, (null == foo ? void 0 : foo.m).length, (null == foo ? void 0 : foo.m).length; diff --git a/crates/swc/tests/tsc-references/parameterInitializersBackwardReferencing(target=es5).1.normal.js b/crates/swc/tests/tsc-references/parameterInitializersBackwardReferencing(target=es5).1.normal.js index 3d744b243737..d0135564086c 100644 --- a/crates/swc/tests/tsc-references/parameterInitializersBackwardReferencing(target=es5).1.normal.js +++ b/crates/swc/tests/tsc-references/parameterInitializersBackwardReferencing(target=es5).1.normal.js @@ -1,14 +1,14 @@ //// [parameterInitializersBackwardReferencing.ts] // https://github.com/microsoft/TypeScript/issues/38243 function test0() { - var ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, _a = ref.a, a = _a === void 0 ? 0 : _a, _b = ref.b, b = _b === void 0 ? a : _b; + var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, _ref_a = _ref.a, a = _ref_a === void 0 ? 0 : _ref_a, _ref_b = _ref.b, b = _ref_b === void 0 ? a : _ref_b; return { a: a, b: b }; } function test1() { - var ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, tmp = ref.c, ref1 = tmp === void 0 ? {} : tmp, _a = ref1.a, a = _a === void 0 ? 0 : _a, _b = ref1.b, b = _b === void 0 ? a : _b; + var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, tmp = _ref.c, _ref1 = tmp === void 0 ? {} : tmp, _ref_a = _ref1.a, a = _ref_a === void 0 ? 0 : _ref_a, _ref_b = _ref1.b, b = _ref_b === void 0 ? a : _ref_b; return { a: a, b: b diff --git a/crates/swc/tests/tsc-references/parameterInitializersForwardReferencing.2(target=es5).1.normal.js b/crates/swc/tests/tsc-references/parameterInitializersForwardReferencing.2(target=es5).1.normal.js index 79d952fe2888..13cf5e5693e3 100644 --- a/crates/swc/tests/tsc-references/parameterInitializersForwardReferencing.2(target=es5).1.normal.js +++ b/crates/swc/tests/tsc-references/parameterInitializersForwardReferencing.2(target=es5).1.normal.js @@ -4,7 +4,7 @@ import _object_without_properties from "@swc/helpers/src/_object_without_propert function a() {} function b() { var _param = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : a(); - var _b = _param.b, b = _b === void 0 ? a() : _b, x = _object_without_properties(_param, [ + var _param_b = _param.b, b = _param_b === void 0 ? a() : _param_b, x = _object_without_properties(_param, [ "b" ]); var _$a; diff --git a/crates/swc/tests/tsc-references/parserES5ForOfStatement11.1.normal.js b/crates/swc/tests/tsc-references/parserES5ForOfStatement11.1.normal.js index c3e714d7a55d..737eb693f257 100644 --- a/crates/swc/tests/tsc-references/parserES5ForOfStatement11.1.normal.js +++ b/crates/swc/tests/tsc-references/parserES5ForOfStatement11.1.normal.js @@ -3,7 +3,7 @@ import _sliced_to_array from "@swc/helpers/src/_sliced_to_array.mjs"; var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined; try { for(var _iterator = X[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){ - var _value = _sliced_to_array(_step.value, 2), a = _value[0], b = _value[1]; + var _step_value = _sliced_to_array(_step.value, 2), a = _step_value[0], b = _step_value[1]; } } catch (err) { _didIteratorError = true; diff --git a/crates/swc/tests/tsc-references/parserES5ForOfStatement11.2.minified.js b/crates/swc/tests/tsc-references/parserES5ForOfStatement11.2.minified.js index 8121fd4609ca..c254373f5904 100644 --- a/crates/swc/tests/tsc-references/parserES5ForOfStatement11.2.minified.js +++ b/crates/swc/tests/tsc-references/parserES5ForOfStatement11.2.minified.js @@ -3,8 +3,8 @@ import _sliced_to_array from "@swc/helpers/src/_sliced_to_array.mjs"; var _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0; try { for(var _step, _iterator = X[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0){ - var _value = _sliced_to_array(_step.value, 2); - _value[0], _value[1]; + var _step_value = _sliced_to_array(_step.value, 2); + _step_value[0], _step_value[1]; } } catch (err) { _didIteratorError = !0, _iteratorError = err; diff --git a/crates/swc/tests/tsc-references/parserES5ForOfStatement12.1.normal.js b/crates/swc/tests/tsc-references/parserES5ForOfStatement12.1.normal.js index b1176852098c..1a1684f9d13a 100644 --- a/crates/swc/tests/tsc-references/parserES5ForOfStatement12.1.normal.js +++ b/crates/swc/tests/tsc-references/parserES5ForOfStatement12.1.normal.js @@ -2,7 +2,7 @@ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined; try { for(var _iterator = X[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){ - var _value = _step.value, a = _value.a, b = _value.b; + var _step_value = _step.value, a = _step_value.a, b = _step_value.b; } } catch (err) { _didIteratorError = true; diff --git a/crates/swc/tests/tsc-references/parserES5ForOfStatement12.2.minified.js b/crates/swc/tests/tsc-references/parserES5ForOfStatement12.2.minified.js index c4e4e8b3415d..79b599367d15 100644 --- a/crates/swc/tests/tsc-references/parserES5ForOfStatement12.2.minified.js +++ b/crates/swc/tests/tsc-references/parserES5ForOfStatement12.2.minified.js @@ -2,8 +2,8 @@ var _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0; try { for(var _step, _iterator = X[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0){ - var _value = _step.value; - _value.a, _value.b; + var _step_value = _step.value; + _step_value.a, _step_value.b; } } catch (err) { _didIteratorError = !0, _iteratorError = err; diff --git a/crates/swc/tests/tsc-references/parserES5ForOfStatement13.1.normal.js b/crates/swc/tests/tsc-references/parserES5ForOfStatement13.1.normal.js index f4c806240a18..011d1d93ae47 100644 --- a/crates/swc/tests/tsc-references/parserES5ForOfStatement13.1.normal.js +++ b/crates/swc/tests/tsc-references/parserES5ForOfStatement13.1.normal.js @@ -2,7 +2,7 @@ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined; try { for(var _iterator = X[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){ - var _value = _step.value, a = _value.a, b = _value.b; + var _step_value = _step.value, a = _step_value.a, b = _step_value.b; } } catch (err) { _didIteratorError = true; diff --git a/crates/swc/tests/tsc-references/parserES5ForOfStatement13.2.minified.js b/crates/swc/tests/tsc-references/parserES5ForOfStatement13.2.minified.js index 035f49bc0b53..b51aec88ea72 100644 --- a/crates/swc/tests/tsc-references/parserES5ForOfStatement13.2.minified.js +++ b/crates/swc/tests/tsc-references/parserES5ForOfStatement13.2.minified.js @@ -2,8 +2,8 @@ var _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0; try { for(var _step, _iterator = X[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0){ - var _value = _step.value; - _value.a, _value.b; + var _step_value = _step.value; + _step_value.a, _step_value.b; } } catch (err) { _didIteratorError = !0, _iteratorError = err; diff --git a/crates/swc/tests/tsc-references/parserES5ForOfStatement14.1.normal.js b/crates/swc/tests/tsc-references/parserES5ForOfStatement14.1.normal.js index 89188ffdd752..b72598c60494 100644 --- a/crates/swc/tests/tsc-references/parserES5ForOfStatement14.1.normal.js +++ b/crates/swc/tests/tsc-references/parserES5ForOfStatement14.1.normal.js @@ -3,7 +3,7 @@ import _sliced_to_array from "@swc/helpers/src/_sliced_to_array.mjs"; var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined; try { for(var _iterator = X[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){ - var _value = _sliced_to_array(_step.value, 2), a = _value[0], b = _value[1]; + var _step_value = _sliced_to_array(_step.value, 2), a = _step_value[0], b = _step_value[1]; } } catch (err) { _didIteratorError = true; diff --git a/crates/swc/tests/tsc-references/parserES5ForOfStatement14.2.minified.js b/crates/swc/tests/tsc-references/parserES5ForOfStatement14.2.minified.js index 0faa2c36b984..bc3d0e2424b3 100644 --- a/crates/swc/tests/tsc-references/parserES5ForOfStatement14.2.minified.js +++ b/crates/swc/tests/tsc-references/parserES5ForOfStatement14.2.minified.js @@ -3,8 +3,8 @@ import _sliced_to_array from "@swc/helpers/src/_sliced_to_array.mjs"; var _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0; try { for(var _step, _iterator = X[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0){ - var _value = _sliced_to_array(_step.value, 2); - _value[0], _value[1]; + var _step_value = _sliced_to_array(_step.value, 2); + _step_value[0], _step_value[1]; } } catch (err) { _didIteratorError = !0, _iteratorError = err; diff --git a/crates/swc/tests/tsc-references/parserES5ForOfStatement15.1.normal.js b/crates/swc/tests/tsc-references/parserES5ForOfStatement15.1.normal.js index 624bf3be9e7a..861ff9dbd4eb 100644 --- a/crates/swc/tests/tsc-references/parserES5ForOfStatement15.1.normal.js +++ b/crates/swc/tests/tsc-references/parserES5ForOfStatement15.1.normal.js @@ -3,7 +3,7 @@ import _sliced_to_array from "@swc/helpers/src/_sliced_to_array.mjs"; var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined; try { for(var _iterator = X[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){ - var _value = _sliced_to_array(_step.value, 2), a = _value[0], b = _value[1]; + var _step_value = _sliced_to_array(_step.value, 2), a = _step_value[0], b = _step_value[1]; } } catch (err) { _didIteratorError = true; diff --git a/crates/swc/tests/tsc-references/parserES5ForOfStatement15.2.minified.js b/crates/swc/tests/tsc-references/parserES5ForOfStatement15.2.minified.js index 6d39116a5000..7fdff0e79db7 100644 --- a/crates/swc/tests/tsc-references/parserES5ForOfStatement15.2.minified.js +++ b/crates/swc/tests/tsc-references/parserES5ForOfStatement15.2.minified.js @@ -3,8 +3,8 @@ import _sliced_to_array from "@swc/helpers/src/_sliced_to_array.mjs"; var _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0; try { for(var _step, _iterator = X[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0){ - var _value = _sliced_to_array(_step.value, 2); - _value[0], _value[1]; + var _step_value = _sliced_to_array(_step.value, 2); + _step_value[0], _step_value[1]; } } catch (err) { _didIteratorError = !0, _iteratorError = err; diff --git a/crates/swc/tests/tsc-references/parserES5ForOfStatement16.1.normal.js b/crates/swc/tests/tsc-references/parserES5ForOfStatement16.1.normal.js index decd540dafd6..6d138abc1bc3 100644 --- a/crates/swc/tests/tsc-references/parserES5ForOfStatement16.1.normal.js +++ b/crates/swc/tests/tsc-references/parserES5ForOfStatement16.1.normal.js @@ -2,7 +2,7 @@ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined; try { for(var _iterator = X[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){ - var _value = _step.value, a = _value.a, b = _value.b; + var _step_value = _step.value, a = _step_value.a, b = _step_value.b; } } catch (err) { _didIteratorError = true; diff --git a/crates/swc/tests/tsc-references/parserES5ForOfStatement16.2.minified.js b/crates/swc/tests/tsc-references/parserES5ForOfStatement16.2.minified.js index f5cd78f6c1a6..059eabdbc221 100644 --- a/crates/swc/tests/tsc-references/parserES5ForOfStatement16.2.minified.js +++ b/crates/swc/tests/tsc-references/parserES5ForOfStatement16.2.minified.js @@ -2,8 +2,8 @@ var _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0; try { for(var _step, _iterator = X[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0){ - var _value = _step.value; - _value.a, _value.b; + var _step_value = _step.value; + _step_value.a, _step_value.b; } } catch (err) { _didIteratorError = !0, _iteratorError = err; diff --git a/crates/swc/tests/tsc-references/parserES5SymbolProperty6.1.normal.js b/crates/swc/tests/tsc-references/parserES5SymbolProperty6.1.normal.js index 442582f3c373..9dcc04a9a412 100644 --- a/crates/swc/tests/tsc-references/parserES5SymbolProperty6.1.normal.js +++ b/crates/swc/tests/tsc-references/parserES5SymbolProperty6.1.normal.js @@ -1,8 +1,8 @@ //// [parserES5SymbolProperty6.ts] import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -var _toStringTag = Symbol.toStringTag; +var _Symbol_toStringTag = Symbol.toStringTag; var C = function C() { "use strict"; _class_call_check(this, C); - this[_toStringTag] = ""; + this[_Symbol_toStringTag] = ""; }; diff --git a/crates/swc/tests/tsc-references/parserSymbolProperty6.1.normal.js b/crates/swc/tests/tsc-references/parserSymbolProperty6.1.normal.js index 18e37fbb9f11..e8169135febf 100644 --- a/crates/swc/tests/tsc-references/parserSymbolProperty6.1.normal.js +++ b/crates/swc/tests/tsc-references/parserSymbolProperty6.1.normal.js @@ -1,7 +1,7 @@ //// [parserSymbolProperty6.ts] -let _toStringTag = Symbol.toStringTag; +let _Symbol_toStringTag = Symbol.toStringTag; class C { constructor(){ - this[_toStringTag] = ""; + this[_Symbol_toStringTag] = ""; } } diff --git a/crates/swc/tests/tsc-references/privateNameAccessorsCallExpression.1.normal.js b/crates/swc/tests/tsc-references/privateNameAccessorsCallExpression.1.normal.js index da4956435825..f719d0bd9ed4 100644 --- a/crates/swc/tests/tsc-references/privateNameAccessorsCallExpression.1.normal.js +++ b/crates/swc/tests/tsc-references/privateNameAccessorsCallExpression.1.normal.js @@ -4,7 +4,7 @@ import _class_private_field_init from "@swc/helpers/src/_class_private_field_ini var _fieldFunc = /*#__PURE__*/ new WeakMap(), _fieldFunc2 = /*#__PURE__*/ new WeakMap(); class A { test() { - var _ref; + var _this_getInstance; _class_private_field_get(this, _fieldFunc).call(this); const func = _class_private_field_get(this, _fieldFunc); func(); @@ -16,7 +16,7 @@ class A { _class_private_field_get(this, _fieldFunc2).call(this, 0, ...arr, 3); const b = new (_class_private_field_get(this, _fieldFunc2))(0, ...arr, 3); const str = _class_private_field_get(this, _fieldFunc2).bind(this)`head${1}middle${2}tail`; - _class_private_field_get(_ref = this.getInstance(), _fieldFunc2).bind(_ref)`test${1}and${2}`; + _class_private_field_get(_this_getInstance = this.getInstance(), _fieldFunc2).bind(_this_getInstance)`test${1}and${2}`; } getInstance() { return new A(); diff --git a/crates/swc/tests/tsc-references/privateNameComputedPropertyName2(target=es2015).1.normal.js b/crates/swc/tests/tsc-references/privateNameComputedPropertyName2(target=es2015).1.normal.js index 8ce313ca065a..5bf3774e47a1 100644 --- a/crates/swc/tests/tsc-references/privateNameComputedPropertyName2(target=es2015).1.normal.js +++ b/crates/swc/tests/tsc-references/privateNameComputedPropertyName2(target=es2015).1.normal.js @@ -3,9 +3,9 @@ import _class_private_field_get from "@swc/helpers/src/_class_private_field_get. import _class_private_field_init from "@swc/helpers/src/_class_private_field_init.mjs"; let getX; var _x = /*#__PURE__*/ new WeakMap(); -let tmp = (getX = (a)=>_class_private_field_get(a, _x), "_"); +let _tmp = (getX = (a)=>_class_private_field_get(a, _x), "_"); class A { - [tmp]() {} + [_tmp]() {} constructor(){ _class_private_field_init(this, _x, { writable: true, diff --git a/crates/swc/tests/tsc-references/privateNameComputedPropertyName3(target=es2015).1.normal.js b/crates/swc/tests/tsc-references/privateNameComputedPropertyName3(target=es2015).1.normal.js index ae513e8072c1..396fe9014483 100644 --- a/crates/swc/tests/tsc-references/privateNameComputedPropertyName3(target=es2015).1.normal.js +++ b/crates/swc/tests/tsc-references/privateNameComputedPropertyName3(target=es2015).1.normal.js @@ -7,9 +7,9 @@ class Foo { getValue(x) { const obj = this; var _y = /*#__PURE__*/ new WeakMap(); - let tmp = _class_private_field_get(obj, _name); + let _class_private_field_get1 = _class_private_field_get(obj, _name); class Bar { - [tmp]() { + [_class_private_field_get1]() { return x + _class_private_field_get(this, _y); } constructor(){ diff --git a/crates/swc/tests/tsc-references/privateNameComputedPropertyName3(target=es2015).2.minified.js b/crates/swc/tests/tsc-references/privateNameComputedPropertyName3(target=es2015).2.minified.js index cd84d5ccd87d..dc74b05659c1 100644 --- a/crates/swc/tests/tsc-references/privateNameComputedPropertyName3(target=es2015).2.minified.js +++ b/crates/swc/tests/tsc-references/privateNameComputedPropertyName3(target=es2015).2.minified.js @@ -6,9 +6,9 @@ var _name = new WeakMap(); console.log(new class { getValue(x) { var _y = new WeakMap(); - let tmp = _class_private_field_get(this, _name); + let _class_private_field_get1 = _class_private_field_get(this, _name); return new class { - [tmp]() { + [_class_private_field_get1]() { return x + _class_private_field_get(this, _y); } constructor(){ diff --git a/crates/swc/tests/tsc-references/privateNameFieldAssignment.1.normal.js b/crates/swc/tests/tsc-references/privateNameFieldAssignment.1.normal.js index f9e11bbc9dfe..c05568ccf02f 100644 --- a/crates/swc/tests/tsc-references/privateNameFieldAssignment.1.normal.js +++ b/crates/swc/tests/tsc-references/privateNameFieldAssignment.1.normal.js @@ -8,7 +8,7 @@ class A { return new A(); } constructor(){ - var _ref, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9, _ref10, _ref11; + var _A_getInstance, _A_getInstance1, _A_getInstance2, _A_getInstance3, _A_getInstance4, _A_getInstance5, _A_getInstance6, _A_getInstance7, _A_getInstance8, _A_getInstance9, _A_getInstance10, _A_getInstance11; _class_private_field_init(this, _field, { writable: true, value: 0 @@ -27,17 +27,17 @@ class A { _class_private_field_set(this, _field, _class_private_field_get(this, _field) | 12); _class_private_field_set(this, _field, _class_private_field_get(this, _field) ^ 13); _class_private_field_set(A.getInstance(), _field, 1); - _class_private_field_set(_ref = A.getInstance(), _field, _class_private_field_get(_ref, _field) + 2); - _class_private_field_set(_ref1 = A.getInstance(), _field, _class_private_field_get(_ref1, _field) - 3); - _class_private_field_set(_ref2 = A.getInstance(), _field, _class_private_field_get(_ref2, _field) / 4); - _class_private_field_set(_ref3 = A.getInstance(), _field, _class_private_field_get(_ref3, _field) * 5); - _class_private_field_set(_ref4 = A.getInstance(), _field, Math.pow(_class_private_field_get(_ref4, _field), 6)); - _class_private_field_set(_ref5 = A.getInstance(), _field, _class_private_field_get(_ref5, _field) % 7); - _class_private_field_set(_ref6 = A.getInstance(), _field, _class_private_field_get(_ref6, _field) << 8); - _class_private_field_set(_ref7 = A.getInstance(), _field, _class_private_field_get(_ref7, _field) >> 9); - _class_private_field_set(_ref8 = A.getInstance(), _field, _class_private_field_get(_ref8, _field) >>> 10); - _class_private_field_set(_ref9 = A.getInstance(), _field, _class_private_field_get(_ref9, _field) & 11); - _class_private_field_set(_ref10 = A.getInstance(), _field, _class_private_field_get(_ref10, _field) | 12); - _class_private_field_set(_ref11 = A.getInstance(), _field, _class_private_field_get(_ref11, _field) ^ 13); + _class_private_field_set(_A_getInstance = A.getInstance(), _field, _class_private_field_get(_A_getInstance, _field) + 2); + _class_private_field_set(_A_getInstance1 = A.getInstance(), _field, _class_private_field_get(_A_getInstance1, _field) - 3); + _class_private_field_set(_A_getInstance2 = A.getInstance(), _field, _class_private_field_get(_A_getInstance2, _field) / 4); + _class_private_field_set(_A_getInstance3 = A.getInstance(), _field, _class_private_field_get(_A_getInstance3, _field) * 5); + _class_private_field_set(_A_getInstance4 = A.getInstance(), _field, Math.pow(_class_private_field_get(_A_getInstance4, _field), 6)); + _class_private_field_set(_A_getInstance5 = A.getInstance(), _field, _class_private_field_get(_A_getInstance5, _field) % 7); + _class_private_field_set(_A_getInstance6 = A.getInstance(), _field, _class_private_field_get(_A_getInstance6, _field) << 8); + _class_private_field_set(_A_getInstance7 = A.getInstance(), _field, _class_private_field_get(_A_getInstance7, _field) >> 9); + _class_private_field_set(_A_getInstance8 = A.getInstance(), _field, _class_private_field_get(_A_getInstance8, _field) >>> 10); + _class_private_field_set(_A_getInstance9 = A.getInstance(), _field, _class_private_field_get(_A_getInstance9, _field) & 11); + _class_private_field_set(_A_getInstance10 = A.getInstance(), _field, _class_private_field_get(_A_getInstance10, _field) | 12); + _class_private_field_set(_A_getInstance11 = A.getInstance(), _field, _class_private_field_get(_A_getInstance11, _field) ^ 13); } } diff --git a/crates/swc/tests/tsc-references/privateNameFieldCallExpression.1.normal.js b/crates/swc/tests/tsc-references/privateNameFieldCallExpression.1.normal.js index 68c648590288..908da134d18c 100644 --- a/crates/swc/tests/tsc-references/privateNameFieldCallExpression.1.normal.js +++ b/crates/swc/tests/tsc-references/privateNameFieldCallExpression.1.normal.js @@ -4,10 +4,10 @@ import _class_private_field_init from "@swc/helpers/src/_class_private_field_ini var _fieldFunc = /*#__PURE__*/ new WeakMap(), _fieldFunc2 = /*#__PURE__*/ new WeakMap(); class A { test() { - var ref; - var _ref; + var _class_private_field_get1; + var _this_getInstance; _class_private_field_get(this, _fieldFunc).call(this); - (ref = _class_private_field_get(this, _fieldFunc)) === null || ref === void 0 ? void 0 : ref.call(this); + (_class_private_field_get1 = _class_private_field_get(this, _fieldFunc)) === null || _class_private_field_get1 === void 0 ? void 0 : _class_private_field_get1.call(this); const func = _class_private_field_get(this, _fieldFunc); func(); new (_class_private_field_get(this, _fieldFunc))(); @@ -18,7 +18,7 @@ class A { _class_private_field_get(this, _fieldFunc2).call(this, 0, ...arr, 3); const b = new (_class_private_field_get(this, _fieldFunc2))(0, ...arr, 3); const str = _class_private_field_get(this, _fieldFunc2).bind(this)`head${1}middle${2}tail`; - _class_private_field_get(_ref = this.getInstance(), _fieldFunc2).bind(_ref)`test${1}and${2}`; + _class_private_field_get(_this_getInstance = this.getInstance(), _fieldFunc2).bind(_this_getInstance)`test${1}and${2}`; } getInstance() { return new A(); diff --git a/crates/swc/tests/tsc-references/privateNameFieldUnaryMutation.1.normal.js b/crates/swc/tests/tsc-references/privateNameFieldUnaryMutation.1.normal.js index d84dd548d1e4..c1c7406dd251 100644 --- a/crates/swc/tests/tsc-references/privateNameFieldUnaryMutation.1.normal.js +++ b/crates/swc/tests/tsc-references/privateNameFieldUnaryMutation.1.normal.js @@ -6,7 +6,7 @@ import _class_private_field_update from "@swc/helpers/src/_class_private_field_u var _test = /*#__PURE__*/ new WeakMap(); class C { test() { - var _ref, _ref1, _ref2, _ref3; + var _this_getInstance, _this_getInstance1, _this_getInstance2, _this_getInstance3; _class_private_field_update(this.getInstance(), _test).value++; _class_private_field_update(this.getInstance(), _test).value--; ++_class_private_field_update(this.getInstance(), _test).value; @@ -15,8 +15,8 @@ class C { const b = _class_private_field_update(this.getInstance(), _test).value--; const c = ++_class_private_field_update(this.getInstance(), _test).value; const d = --_class_private_field_update(this.getInstance(), _test).value; - for(_class_private_field_set(this.getInstance(), _test, 0); _class_private_field_get(_ref = this.getInstance(), _test) < 10; ++_class_private_field_update(this.getInstance(), _test).value){} - for(_class_private_field_set(this.getInstance(), _test, 0); _class_private_field_get(_ref1 = this.getInstance(), _test) < 10; _class_private_field_update(this.getInstance(), _test).value++){} + for(_class_private_field_set(this.getInstance(), _test, 0); _class_private_field_get(_this_getInstance = this.getInstance(), _test) < 10; ++_class_private_field_update(this.getInstance(), _test).value){} + for(_class_private_field_set(this.getInstance(), _test, 0); _class_private_field_get(_this_getInstance1 = this.getInstance(), _test) < 10; _class_private_field_update(this.getInstance(), _test).value++){} _class_private_field_update(this.getInstance(), _test).value++; _class_private_field_update(this.getInstance(), _test).value--; ++_class_private_field_update(this.getInstance(), _test).value; @@ -25,8 +25,8 @@ class C { const f = _class_private_field_update(this.getInstance(), _test).value--; const g = ++_class_private_field_update(this.getInstance(), _test).value; const h = --_class_private_field_update(this.getInstance(), _test).value; - for(_class_private_field_set(this.getInstance(), _test, 0); _class_private_field_get(_ref2 = this.getInstance(), _test) < 10; ++_class_private_field_update(this.getInstance(), _test).value){} - for(_class_private_field_set(this.getInstance(), _test, 0); _class_private_field_get(_ref3 = this.getInstance(), _test) < 10; _class_private_field_update(this.getInstance(), _test).value++){} + for(_class_private_field_set(this.getInstance(), _test, 0); _class_private_field_get(_this_getInstance2 = this.getInstance(), _test) < 10; ++_class_private_field_update(this.getInstance(), _test).value){} + for(_class_private_field_set(this.getInstance(), _test, 0); _class_private_field_get(_this_getInstance3 = this.getInstance(), _test) < 10; _class_private_field_update(this.getInstance(), _test).value++){} } getInstance() { return new C(); diff --git a/crates/swc/tests/tsc-references/privateNameInLhsReceiverExpression.1.normal.js b/crates/swc/tests/tsc-references/privateNameInLhsReceiverExpression.1.normal.js index e819902aa38a..d4c303dc932b 100644 --- a/crates/swc/tests/tsc-references/privateNameInLhsReceiverExpression.1.normal.js +++ b/crates/swc/tests/tsc-references/privateNameInLhsReceiverExpression.1.normal.js @@ -5,7 +5,7 @@ import _class_private_field_set from "@swc/helpers/src/_class_private_field_set. var _y = /*#__PURE__*/ new WeakMap(); class Test { static something(obj) { - var _s; + var _obj__s; var _x, _x1; _class_private_field_set(obj[(new (_x = /*#__PURE__*/ new WeakMap(), class { constructor(){ @@ -16,7 +16,7 @@ class Test { this.s = "prop"; } })).s], _y, 1); - _class_private_field_set(_s = obj[(new (_x1 = /*#__PURE__*/ new WeakMap(), class { + _class_private_field_set(_obj__s = obj[(new (_x1 = /*#__PURE__*/ new WeakMap(), class { constructor(){ _class_private_field_init(this, _x1, { writable: true, @@ -24,7 +24,7 @@ class Test { }); this.s = "prop"; } - })).s], _y, _class_private_field_get(_s, _y) + 1); + })).s], _y, _class_private_field_get(_obj__s, _y) + 1); } constructor(){ _class_private_field_init(this, _y, { diff --git a/crates/swc/tests/tsc-references/privateNameMethodCallExpression.1.normal.js b/crates/swc/tests/tsc-references/privateNameMethodCallExpression.1.normal.js index 06357ff2c65e..28238644cc89 100644 --- a/crates/swc/tests/tsc-references/privateNameMethodCallExpression.1.normal.js +++ b/crates/swc/tests/tsc-references/privateNameMethodCallExpression.1.normal.js @@ -4,7 +4,7 @@ import _class_private_method_init from "@swc/helpers/src/_class_private_method_i var _method = /*#__PURE__*/ new WeakSet(), _method2 = /*#__PURE__*/ new WeakSet(); class AA { test() { - var _ref, _ref1, _ref2, _ref3; + var _this_getInstance, _this_getInstance1, _this_getInstance2, _this_getInstance3; _class_private_method_get(this, _method, method).call(this); const func = _class_private_method_get(this, _method, method); func(); @@ -16,10 +16,10 @@ class AA { _class_private_method_get(this, _method2, method2).call(this, 0, ...arr, 3); const b = new (_class_private_method_get(this, _method2, method2))(0, ...arr, 3); //Error const str = _class_private_method_get(this, _method2, method2).bind(this)`head${1}middle${2}tail`; - _class_private_method_get(_ref = this.getInstance(), _method2, method2).bind(_ref)`test${1}and${2}`; - _class_private_method_get(_ref1 = this.getInstance(), _method2, method2).call(_ref1, 0, ...arr, 3); - const b2 = new (_class_private_method_get(_ref2 = this.getInstance(), _method2, method2))(0, ...arr, 3); //Error - const str2 = _class_private_method_get(_ref3 = this.getInstance(), _method2, method2).bind(_ref3)`head${1}middle${2}tail`; + _class_private_method_get(_this_getInstance = this.getInstance(), _method2, method2).bind(_this_getInstance)`test${1}and${2}`; + _class_private_method_get(_this_getInstance1 = this.getInstance(), _method2, method2).call(_this_getInstance1, 0, ...arr, 3); + const b2 = new (_class_private_method_get(_this_getInstance2 = this.getInstance(), _method2, method2))(0, ...arr, 3); //Error + const str2 = _class_private_method_get(_this_getInstance3 = this.getInstance(), _method2, method2).bind(_this_getInstance3)`head${1}middle${2}tail`; } getInstance() { return new AA(); diff --git a/crates/swc/tests/tsc-references/privateNameStaticFieldAssignment.1.normal.js b/crates/swc/tests/tsc-references/privateNameStaticFieldAssignment.1.normal.js index cecccaeaa599..203abb8ab832 100644 --- a/crates/swc/tests/tsc-references/privateNameStaticFieldAssignment.1.normal.js +++ b/crates/swc/tests/tsc-references/privateNameStaticFieldAssignment.1.normal.js @@ -6,7 +6,7 @@ class A { return A; } constructor(){ - var _A, _A1, _A2, _A3, _A4, _A5, _A6, _A7, _A8, _A9, _A10, _A11, _ref, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9, _ref10, _ref11; + var _A, _A1, _A2, _A3, _A4, _A5, _A6, _A7, _A8, _A9, _A10, _A11, _A_getClass, _A_getClass1, _A_getClass2, _A_getClass3, _A_getClass4, _A_getClass5, _A_getClass6, _A_getClass7, _A_getClass8, _A_getClass9, _A_getClass10, _A_getClass11; _class_static_private_field_spec_set(A, A, _field, 1); _class_static_private_field_spec_set(_A = A, A, _field, _class_static_private_field_spec_get(A, A, _field) + 2); _class_static_private_field_spec_set(_A1 = A, A, _field, _class_static_private_field_spec_get(A, A, _field) - 3); @@ -21,18 +21,18 @@ class A { _class_static_private_field_spec_set(_A10 = A, A, _field, _class_static_private_field_spec_get(A, A, _field) | 12); _class_static_private_field_spec_set(_A11 = A, A, _field, _class_static_private_field_spec_get(A, A, _field) ^ 13); _class_static_private_field_spec_set(A.getClass(), A, _field, 1); - _class_static_private_field_spec_set(_ref = A.getClass(), A, _field, _class_static_private_field_spec_get(A.getClass(), A, _field) + 2); - _class_static_private_field_spec_set(_ref1 = A.getClass(), A, _field, _class_static_private_field_spec_get(A.getClass(), A, _field) - 3); - _class_static_private_field_spec_set(_ref2 = A.getClass(), A, _field, _class_static_private_field_spec_get(A.getClass(), A, _field) / 4); - _class_static_private_field_spec_set(_ref3 = A.getClass(), A, _field, _class_static_private_field_spec_get(A.getClass(), A, _field) * 5); - _class_static_private_field_spec_set(_ref4 = A.getClass(), A, _field, Math.pow(_class_static_private_field_spec_get(A.getClass(), A, _field), 6)); - _class_static_private_field_spec_set(_ref5 = A.getClass(), A, _field, _class_static_private_field_spec_get(A.getClass(), A, _field) % 7); - _class_static_private_field_spec_set(_ref6 = A.getClass(), A, _field, _class_static_private_field_spec_get(A.getClass(), A, _field) << 8); - _class_static_private_field_spec_set(_ref7 = A.getClass(), A, _field, _class_static_private_field_spec_get(A.getClass(), A, _field) >> 9); - _class_static_private_field_spec_set(_ref8 = A.getClass(), A, _field, _class_static_private_field_spec_get(A.getClass(), A, _field) >>> 10); - _class_static_private_field_spec_set(_ref9 = A.getClass(), A, _field, _class_static_private_field_spec_get(A.getClass(), A, _field) & 11); - _class_static_private_field_spec_set(_ref10 = A.getClass(), A, _field, _class_static_private_field_spec_get(A.getClass(), A, _field) | 12); - _class_static_private_field_spec_set(_ref11 = A.getClass(), A, _field, _class_static_private_field_spec_get(A.getClass(), A, _field) ^ 13); + _class_static_private_field_spec_set(_A_getClass = A.getClass(), A, _field, _class_static_private_field_spec_get(A.getClass(), A, _field) + 2); + _class_static_private_field_spec_set(_A_getClass1 = A.getClass(), A, _field, _class_static_private_field_spec_get(A.getClass(), A, _field) - 3); + _class_static_private_field_spec_set(_A_getClass2 = A.getClass(), A, _field, _class_static_private_field_spec_get(A.getClass(), A, _field) / 4); + _class_static_private_field_spec_set(_A_getClass3 = A.getClass(), A, _field, _class_static_private_field_spec_get(A.getClass(), A, _field) * 5); + _class_static_private_field_spec_set(_A_getClass4 = A.getClass(), A, _field, Math.pow(_class_static_private_field_spec_get(A.getClass(), A, _field), 6)); + _class_static_private_field_spec_set(_A_getClass5 = A.getClass(), A, _field, _class_static_private_field_spec_get(A.getClass(), A, _field) % 7); + _class_static_private_field_spec_set(_A_getClass6 = A.getClass(), A, _field, _class_static_private_field_spec_get(A.getClass(), A, _field) << 8); + _class_static_private_field_spec_set(_A_getClass7 = A.getClass(), A, _field, _class_static_private_field_spec_get(A.getClass(), A, _field) >> 9); + _class_static_private_field_spec_set(_A_getClass8 = A.getClass(), A, _field, _class_static_private_field_spec_get(A.getClass(), A, _field) >>> 10); + _class_static_private_field_spec_set(_A_getClass9 = A.getClass(), A, _field, _class_static_private_field_spec_get(A.getClass(), A, _field) & 11); + _class_static_private_field_spec_set(_A_getClass10 = A.getClass(), A, _field, _class_static_private_field_spec_get(A.getClass(), A, _field) | 12); + _class_static_private_field_spec_set(_A_getClass11 = A.getClass(), A, _field, _class_static_private_field_spec_get(A.getClass(), A, _field) ^ 13); } } var _field = { diff --git a/crates/swc/tests/tsc-references/privateNameStaticFieldCallExpression.1.normal.js b/crates/swc/tests/tsc-references/privateNameStaticFieldCallExpression.1.normal.js index 1f7733afb555..8a8fc9e061cb 100644 --- a/crates/swc/tests/tsc-references/privateNameStaticFieldCallExpression.1.normal.js +++ b/crates/swc/tests/tsc-references/privateNameStaticFieldCallExpression.1.normal.js @@ -2,9 +2,9 @@ import _class_static_private_field_spec_get from "@swc/helpers/src/_class_static_private_field_spec_get.mjs"; class A { test() { - var ref; + var _class_static_private_field_spec_get1; _class_static_private_field_spec_get(A, A, _fieldFunc).call(A); - (ref = _class_static_private_field_spec_get(A, A, _fieldFunc)) === null || ref === void 0 ? void 0 : ref.call(A); + (_class_static_private_field_spec_get1 = _class_static_private_field_spec_get(A, A, _fieldFunc)) === null || _class_static_private_field_spec_get1 === void 0 ? void 0 : _class_static_private_field_spec_get1.call(A); const func = _class_static_private_field_spec_get(A, A, _fieldFunc); func(); new (_class_static_private_field_spec_get(A, A, _fieldFunc))(); diff --git a/crates/swc/tests/tsc-references/privateProtectedMembersAreNotAccessibleDestructuring.1.normal.js b/crates/swc/tests/tsc-references/privateProtectedMembersAreNotAccessibleDestructuring.1.normal.js index 85c7696e09e9..ef34bd7ada45 100644 --- a/crates/swc/tests/tsc-references/privateProtectedMembersAreNotAccessibleDestructuring.1.normal.js +++ b/crates/swc/tests/tsc-references/privateProtectedMembersAreNotAccessibleDestructuring.1.normal.js @@ -10,8 +10,8 @@ var K = /*#__PURE__*/ function() { var _proto = K.prototype; _proto.privateMethod = function privateMethod() {}; _proto.m = function m() { - var ref = this, a = ref.priv, b = ref.prot; // ok - var ref1 = new K(), priv = ref1.priv, prot = ref1.prot; // ok + var _this = this, a = _this.priv, b = _this.prot; // ok + var _ref = new K(), priv = _ref.priv, prot = _ref.prot; // ok }; return K; }(); @@ -25,8 +25,8 @@ var C = /*#__PURE__*/ function(K) { } var _proto = C.prototype; _proto.m2 = function m2() { - var ref = this, a = ref.priv; // error - var ref1 = this, b = ref1.prot; // ok + var _this = this, a = _this.priv; // error + var _this1 = this, b = _this1.prot; // ok }; return C; }(K); diff --git a/crates/swc/tests/tsc-references/privateProtectedMembersAreNotAccessibleDestructuring.2.minified.js b/crates/swc/tests/tsc-references/privateProtectedMembersAreNotAccessibleDestructuring.2.minified.js index 59b6a99835b7..e84bd6052695 100644 --- a/crates/swc/tests/tsc-references/privateProtectedMembersAreNotAccessibleDestructuring.2.minified.js +++ b/crates/swc/tests/tsc-references/privateProtectedMembersAreNotAccessibleDestructuring.2.minified.js @@ -10,8 +10,8 @@ var k = new (function() { var _proto = K.prototype; return _proto.privateMethod = function() {}, _proto.m = function() { this.priv, this.prot; - var ref = new K(); - ref.priv, ref.prot; + var _ref = new K(); + _ref.priv, _ref.prot; }, K; }())(); k.priv, k.prot, k.privateMethod, k.priv, k.prot, k.privateMethod; diff --git a/crates/swc/tests/tsc-references/propertyAccessChain.1.normal.js b/crates/swc/tests/tsc-references/propertyAccessChain.1.normal.js index c66428d15709..f9857c3db764 100644 --- a/crates/swc/tests/tsc-references/propertyAccessChain.1.normal.js +++ b/crates/swc/tests/tsc-references/propertyAccessChain.1.normal.js @@ -1,11 +1,11 @@ //// [propertyAccessChain.ts] -var ref, ref1, ref2, ref3, ref4, ref5; +var _o3_b, _o4_b, _ref, _o5_b, _ref1, _o6; o1 === null || o1 === void 0 ? void 0 : o1.b; o2 === null || o2 === void 0 ? void 0 : o2.b.c; -(ref = o3.b) === null || ref === void 0 ? void 0 : ref.c; -(ref2 = (ref1 = o4.b) === null || ref1 === void 0 ? void 0 : ref1.c.d) === null || ref2 === void 0 ? void 0 : ref2.e; -(ref4 = (ref3 = o5.b) === null || ref3 === void 0 ? void 0 : ref3.call(o5).c.d) === null || ref4 === void 0 ? void 0 : ref4.e; -(ref5 = o6()) === null || ref5 === void 0 ? void 0 : ref5.x; +(_o3_b = o3.b) === null || _o3_b === void 0 ? void 0 : _o3_b.c; +(_ref = (_o4_b = o4.b) === null || _o4_b === void 0 ? void 0 : _o4_b.c.d) === null || _ref === void 0 ? void 0 : _ref.e; +(_ref1 = (_o5_b = o5.b) === null || _o5_b === void 0 ? void 0 : _o5_b.call(o5).c.d) === null || _ref1 === void 0 ? void 0 : _ref1.e; +(_o6 = o6()) === null || _o6 === void 0 ? void 0 : _o6.x; // GH#34109 (o1 === null || o1 === void 0 ? void 0 : o1.b) ? 1 : 0; // GH#36031 diff --git a/crates/swc/tests/tsc-references/propertyAccessChain.2.1.normal.js b/crates/swc/tests/tsc-references/propertyAccessChain.2.1.normal.js index 3083849c2845..73b3b4f0d6c8 100644 --- a/crates/swc/tests/tsc-references/propertyAccessChain.2.1.normal.js +++ b/crates/swc/tests/tsc-references/propertyAccessChain.2.1.normal.js @@ -1,5 +1,5 @@ //// [propertyAccessChain.2.ts] -var ref; +var _o3_b; o1 === null || o1 === void 0 ? void 0 : o1.b; o2 === null || o2 === void 0 ? void 0 : o2.b.c; -(ref = o3.b) === null || ref === void 0 ? void 0 : ref.c; +(_o3_b = o3.b) === null || _o3_b === void 0 ? void 0 : _o3_b.c; diff --git a/crates/swc/tests/tsc-references/propertyAccessChain.2.2.minified.js b/crates/swc/tests/tsc-references/propertyAccessChain.2.2.minified.js index 9a534c3ad8ad..6944a9005a11 100644 --- a/crates/swc/tests/tsc-references/propertyAccessChain.2.2.minified.js +++ b/crates/swc/tests/tsc-references/propertyAccessChain.2.2.minified.js @@ -1,3 +1,3 @@ //// [propertyAccessChain.2.ts] -var ref; -null == o1 || o1.b, null == o2 || o2.b.c, null === (ref = o3.b) || void 0 === ref || ref.c; +var _o3_b; +null == o1 || o1.b, null == o2 || o2.b.c, null === (_o3_b = o3.b) || void 0 === _o3_b || _o3_b.c; diff --git a/crates/swc/tests/tsc-references/propertyAccessChain.2.minified.js b/crates/swc/tests/tsc-references/propertyAccessChain.2.minified.js index 2119a6f5fa00..e750bda9691b 100644 --- a/crates/swc/tests/tsc-references/propertyAccessChain.2.minified.js +++ b/crates/swc/tests/tsc-references/propertyAccessChain.2.minified.js @@ -1,3 +1,3 @@ //// [propertyAccessChain.ts] -var ref, ref1, ref2, ref3, ref4, ref5; -null == o1 || o1.b, null == o2 || o2.b.c, null === (ref = o3.b) || void 0 === ref || ref.c, null === (ref2 = null === (ref1 = o4.b) || void 0 === ref1 ? void 0 : ref1.c.d) || void 0 === ref2 || ref2.e, null === (ref4 = null === (ref3 = o5.b) || void 0 === ref3 ? void 0 : ref3.call(o5).c.d) || void 0 === ref4 || ref4.e, null === (ref5 = o6()) || void 0 === ref5 || ref5.x, null == o1 || o1.b, null == o2 || o2.b.c, null == o2 || o2.b.c; +var _o3_b, _o4_b, _ref, _o5_b, _ref1, _o6; +null == o1 || o1.b, null == o2 || o2.b.c, null === (_o3_b = o3.b) || void 0 === _o3_b || _o3_b.c, null === (_ref = null === (_o4_b = o4.b) || void 0 === _o4_b ? void 0 : _o4_b.c.d) || void 0 === _ref || _ref.e, null === (_ref1 = null === (_o5_b = o5.b) || void 0 === _o5_b ? void 0 : _o5_b.call(o5).c.d) || void 0 === _ref1 || _ref1.e, null === (_o6 = o6()) || void 0 === _o6 || _o6.x, null == o1 || o1.b, null == o2 || o2.b.c, null == o2 || o2.b.c; diff --git a/crates/swc/tests/tsc-references/reexportClassDefinition.1.normal.js b/crates/swc/tests/tsc-references/reexportClassDefinition.1.normal.js index d478c07df96b..b9ee51ed89c9 100644 --- a/crates/swc/tests/tsc-references/reexportClassDefinition.1.normal.js +++ b/crates/swc/tests/tsc-references/reexportClassDefinition.1.normal.js @@ -21,9 +21,9 @@ var _classCallCheck = require("@swc/helpers/lib/_class_call_check.js").default; var _inherits = require("@swc/helpers/lib/_inherits.js").default; var _createSuper = require("@swc/helpers/lib/_create_super.js").default; var foo2 = require("./foo2"); -var x = /*#__PURE__*/ function(_x) { +var x = /*#__PURE__*/ function(_foo2_x) { "use strict"; - _inherits(x, _x); + _inherits(x, _foo2_x); var _super = _createSuper(x); function x() { _classCallCheck(this, x); diff --git a/crates/swc/tests/tsc-references/restElementWithBindingPattern2.1.normal.js b/crates/swc/tests/tsc-references/restElementWithBindingPattern2.1.normal.js index e2e44adeaf83..8b0ac919dff2 100644 --- a/crates/swc/tests/tsc-references/restElementWithBindingPattern2.1.normal.js +++ b/crates/swc/tests/tsc-references/restElementWithBindingPattern2.1.normal.js @@ -1,5 +1,5 @@ //// [restElementWithBindingPattern2.ts] -var ref = [ +var _ref = [ 0, 1 -], a = ref[0], b = ref.b; +], a = _ref[0], b = _ref.b; diff --git a/crates/swc/tests/tsc-references/restElementWithNullInitializer.1.normal.js b/crates/swc/tests/tsc-references/restElementWithNullInitializer.1.normal.js index f6ad41730164..eb19c6ccc1a1 100644 --- a/crates/swc/tests/tsc-references/restElementWithNullInitializer.1.normal.js +++ b/crates/swc/tests/tsc-references/restElementWithNullInitializer.1.normal.js @@ -1,14 +1,14 @@ //// [restElementWithNullInitializer.ts] import _to_array from "@swc/helpers/src/_to_array.mjs"; function foo1() { - var ref = _to_array(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null), r = ref.slice(0); + var _ref = _to_array(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null), r = _ref.slice(0); } function foo2() { - var ref = _to_array(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : undefined), r = ref.slice(0); + var _ref = _to_array(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : undefined), r = _ref.slice(0); } function foo3() { - var ref = _to_array(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}), r = ref.slice(0); + var _ref = _to_array(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}), r = _ref.slice(0); } function foo4() { - var ref = _to_array(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []), r = ref.slice(0); + var _ref = _to_array(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []), r = _ref.slice(0); } diff --git a/crates/swc/tests/tsc-references/spreadContextualTypedBindingPattern.1.normal.js b/crates/swc/tests/tsc-references/spreadContextualTypedBindingPattern.1.normal.js index 37d53a6bc99f..d1d9a8442e72 100644 --- a/crates/swc/tests/tsc-references/spreadContextualTypedBindingPattern.1.normal.js +++ b/crates/swc/tests/tsc-references/spreadContextualTypedBindingPattern.1.normal.js @@ -2,4 +2,4 @@ // #18308 import _object_spread from "@swc/helpers/src/_object_spread.mjs"; // [ts] Initializer provides no value for this binding element and the binding element has no default value. -var ref = _object_spread({}, bob, alice), naam = ref.naam, age = ref.age; +var _$_object_spread = _object_spread({}, bob, alice), naam = _$_object_spread.naam, age = _$_object_spread.age; diff --git a/crates/swc/tests/tsc-references/spreadContextualTypedBindingPattern.2.minified.js b/crates/swc/tests/tsc-references/spreadContextualTypedBindingPattern.2.minified.js index 1388553f83a7..99691b00686f 100644 --- a/crates/swc/tests/tsc-references/spreadContextualTypedBindingPattern.2.minified.js +++ b/crates/swc/tests/tsc-references/spreadContextualTypedBindingPattern.2.minified.js @@ -1,4 +1,4 @@ //// [spreadContextualTypedBindingPattern.ts] import _object_spread from "@swc/helpers/src/_object_spread.mjs"; -var ref = _object_spread({}, bob, alice); -ref.naam, ref.age; +var _$_object_spread = _object_spread({}, bob, alice); +_$_object_spread.naam, _$_object_spread.age; diff --git a/crates/swc/tests/tsc-references/superMethodCall.1.normal.js b/crates/swc/tests/tsc-references/superMethodCall.1.normal.js index 557bd238497f..12b42d6985ec 100644 --- a/crates/swc/tests/tsc-references/superMethodCall.1.normal.js +++ b/crates/swc/tests/tsc-references/superMethodCall.1.normal.js @@ -5,14 +5,14 @@ class Base { } class Derived extends Base { method() { - var ref; - return (ref = super.method) === null || ref === void 0 ? void 0 : ref.call(this); + var _super_method; + return (_super_method = super.method) === null || _super_method === void 0 ? void 0 : _super_method.call(this); } asyncMethod() { var _this = this, _superprop_get_method = ()=>super.method; return _async_to_generator(function*() { - var ref; - return (ref = _superprop_get_method()) === null || ref === void 0 ? void 0 : ref.call(_this); + var _super_method; + return (_super_method = _superprop_get_method()) === null || _super_method === void 0 ? void 0 : _super_method.call(_this); })(); } } diff --git a/crates/swc/tests/tsc-references/symbolDeclarationEmit11.1.normal.js b/crates/swc/tests/tsc-references/symbolDeclarationEmit11.1.normal.js index 830125bb5b7e..773161b8694c 100644 --- a/crates/swc/tests/tsc-references/symbolDeclarationEmit11.1.normal.js +++ b/crates/swc/tests/tsc-references/symbolDeclarationEmit11.1.normal.js @@ -1,10 +1,10 @@ //// [symbolDeclarationEmit11.ts] -let _iterator = Symbol.iterator, _isConcatSpreadable = Symbol.isConcatSpreadable, _toPrimitive = Symbol.toPrimitive, _toPrimitive1 = Symbol.toPrimitive; +let _Symbol_iterator = Symbol.iterator, _Symbol_isConcatSpreadable = Symbol.isConcatSpreadable, _Symbol_toPrimitive = Symbol.toPrimitive, _Symbol_toPrimitive1 = Symbol.toPrimitive; class C { - static [_isConcatSpreadable]() {} - static get [_toPrimitive]() { + static [_Symbol_isConcatSpreadable]() {} + static get [_Symbol_toPrimitive]() { return ""; } - static set [_toPrimitive1](x) {} + static set [_Symbol_toPrimitive1](x) {} } -C[_iterator] = 0; +C[_Symbol_iterator] = 0; diff --git a/crates/swc/tests/tsc-references/symbolDeclarationEmit11.2.minified.js b/crates/swc/tests/tsc-references/symbolDeclarationEmit11.2.minified.js index 6e01549ae482..9634df757f70 100644 --- a/crates/swc/tests/tsc-references/symbolDeclarationEmit11.2.minified.js +++ b/crates/swc/tests/tsc-references/symbolDeclarationEmit11.2.minified.js @@ -1,9 +1,9 @@ //// [symbolDeclarationEmit11.ts] -let _isConcatSpreadable = Symbol.isConcatSpreadable, _toPrimitive = Symbol.toPrimitive, _toPrimitive1 = Symbol.toPrimitive; +let _Symbol_isConcatSpreadable = Symbol.isConcatSpreadable, _Symbol_toPrimitive = Symbol.toPrimitive, _Symbol_toPrimitive1 = Symbol.toPrimitive; (class { - static [_isConcatSpreadable]() {} - static get [_toPrimitive]() { + static [_Symbol_isConcatSpreadable]() {} + static get [_Symbol_toPrimitive]() { return ""; } - static set [_toPrimitive1](x) {} + static set [_Symbol_toPrimitive1](x) {} })[Symbol.iterator] = 0; diff --git a/crates/swc/tests/tsc-references/symbolDeclarationEmit2.1.normal.js b/crates/swc/tests/tsc-references/symbolDeclarationEmit2.1.normal.js index 027fc7a1ee7b..cb90bdd5f275 100644 --- a/crates/swc/tests/tsc-references/symbolDeclarationEmit2.1.normal.js +++ b/crates/swc/tests/tsc-references/symbolDeclarationEmit2.1.normal.js @@ -1,7 +1,7 @@ //// [symbolDeclarationEmit2.ts] -let _toPrimitive = Symbol.toPrimitive; +let _Symbol_toPrimitive = Symbol.toPrimitive; class C { constructor(){ - this[_toPrimitive] = ""; + this[_Symbol_toPrimitive] = ""; } } diff --git a/crates/swc/tests/tsc-references/symbolProperty6.1.normal.js b/crates/swc/tests/tsc-references/symbolProperty6.1.normal.js index 1cfc4ae289cf..0186122674a9 100644 --- a/crates/swc/tests/tsc-references/symbolProperty6.1.normal.js +++ b/crates/swc/tests/tsc-references/symbolProperty6.1.normal.js @@ -1,11 +1,11 @@ //// [symbolProperty6.ts] -let _iterator = Symbol.iterator, _toPrimitive = Symbol.toPrimitive, _toStringTag = Symbol.toStringTag; +let _Symbol_iterator = Symbol.iterator, _Symbol_toPrimitive = Symbol.toPrimitive, _Symbol_toStringTag = Symbol.toStringTag; class C { - [_toPrimitive]() {} - get [_toStringTag]() { + [_Symbol_toPrimitive]() {} + get [_Symbol_toStringTag]() { return 0; } constructor(){ - this[_iterator] = 0; + this[_Symbol_iterator] = 0; } } diff --git a/crates/swc/tests/tsc-references/symbolProperty7.1.normal.js b/crates/swc/tests/tsc-references/symbolProperty7.1.normal.js index a321469a0f3f..c34a947d7a1f 100644 --- a/crates/swc/tests/tsc-references/symbolProperty7.1.normal.js +++ b/crates/swc/tests/tsc-references/symbolProperty7.1.normal.js @@ -1,11 +1,11 @@ //// [symbolProperty7.ts] -let _ref = Symbol(), tmp = Symbol(), tmp1 = Symbol(); +let _Symbol = Symbol(), _Symbol1 = Symbol(), _Symbol2 = Symbol(); class C { - [tmp]() {} - get [tmp1]() { + [_Symbol1]() {} + get [_Symbol2]() { return 0; } constructor(){ - this[_ref] = 0; + this[_Symbol] = 0; } } diff --git a/crates/swc/tests/tsc-references/thisInInvalidContexts.1.normal.js b/crates/swc/tests/tsc-references/thisInInvalidContexts.1.normal.js index 74dc650f9d84..4fda5c39bd35 100644 --- a/crates/swc/tests/tsc-references/thisInInvalidContexts.1.normal.js +++ b/crates/swc/tests/tsc-references/thisInInvalidContexts.1.normal.js @@ -42,9 +42,9 @@ var M; //'this' as a type argument function genericFunc(x) {} genericFunc(undefined); // Should be an error -var ErrClass3 = /*#__PURE__*/ function(_superClass) { +var ErrClass3 = /*#__PURE__*/ function(_this) { "use strict"; - _inherits(ErrClass3, _superClass); + _inherits(ErrClass3, _this); var _super = _create_super(ErrClass3); function ErrClass3() { _class_call_check(this, ErrClass3); diff --git a/crates/swc/tests/tsc-references/thisMethodCall.1.normal.js b/crates/swc/tests/tsc-references/thisMethodCall.1.normal.js index da83b8637703..417ebe61c5c0 100644 --- a/crates/swc/tests/tsc-references/thisMethodCall.1.normal.js +++ b/crates/swc/tests/tsc-references/thisMethodCall.1.normal.js @@ -2,7 +2,7 @@ class C { method() {} other() { - var _obj, ref; - (ref = (_obj = this).method) === null || ref === void 0 ? void 0 : ref.call(_obj); + var _this, _this_method; + (_this_method = (_this = this).method) === null || _this_method === void 0 ? void 0 : _this_method.call(_this); } } diff --git a/crates/swc/tests/tsc-references/tsxCorrectlyParseLessThanComparison1.1.normal.js b/crates/swc/tests/tsc-references/tsxCorrectlyParseLessThanComparison1.1.normal.js index 4b0b38a088cd..9b3b55826bec 100644 --- a/crates/swc/tests/tsc-references/tsxCorrectlyParseLessThanComparison1.1.normal.js +++ b/crates/swc/tests/tsc-references/tsxCorrectlyParseLessThanComparison1.1.normal.js @@ -2,9 +2,9 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; import _inherits from "@swc/helpers/src/_inherits.mjs"; import _create_super from "@swc/helpers/src/_create_super.mjs"; -export var ShortDetails = /*#__PURE__*/ function(_Component) { +export var ShortDetails = /*#__PURE__*/ function(_React_Component) { "use strict"; - _inherits(ShortDetails, _Component); + _inherits(ShortDetails, _React_Component); var _super = _create_super(ShortDetails); function ShortDetails() { _class_call_check(this, ShortDetails); diff --git a/crates/swc/tests/tsc-references/tsxCorrectlyParseLessThanComparison1.2.minified.js b/crates/swc/tests/tsc-references/tsxCorrectlyParseLessThanComparison1.2.minified.js index 99501429d865..a856cc11f5be 100644 --- a/crates/swc/tests/tsc-references/tsxCorrectlyParseLessThanComparison1.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxCorrectlyParseLessThanComparison1.2.minified.js @@ -2,9 +2,9 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; import _inherits from "@swc/helpers/src/_inherits.mjs"; import _create_super from "@swc/helpers/src/_create_super.mjs"; -export var ShortDetails = function(_Component) { +export var ShortDetails = function(_React_Component) { "use strict"; - _inherits(ShortDetails, _Component); + _inherits(ShortDetails, _React_Component); var _super = _create_super(ShortDetails); function ShortDetails() { return _class_call_check(this, ShortDetails), _super.apply(this, arguments); diff --git a/crates/swc/tests/tsc-references/tsxDynamicTagName5.1.normal.js b/crates/swc/tests/tsc-references/tsxDynamicTagName5.1.normal.js index c9fb7bc3d7a3..2213d6d8b560 100644 --- a/crates/swc/tests/tsc-references/tsxDynamicTagName5.1.normal.js +++ b/crates/swc/tests/tsc-references/tsxDynamicTagName5.1.normal.js @@ -5,9 +5,9 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; import _inherits from "@swc/helpers/src/_inherits.mjs"; import _create_super from "@swc/helpers/src/_create_super.mjs"; import * as React from "react"; -export var Text = /*#__PURE__*/ function(_Component) { +export var Text = /*#__PURE__*/ function(_React_Component) { "use strict"; - _inherits(Text, _Component); + _inherits(Text, _React_Component); var _super = _create_super(Text); function Text() { _class_call_check(this, Text); diff --git a/crates/swc/tests/tsc-references/tsxDynamicTagName5.2.minified.js b/crates/swc/tests/tsc-references/tsxDynamicTagName5.2.minified.js index 46fb543bace1..942a703659b7 100644 --- a/crates/swc/tests/tsc-references/tsxDynamicTagName5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxDynamicTagName5.2.minified.js @@ -5,9 +5,9 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; import _inherits from "@swc/helpers/src/_inherits.mjs"; import _create_super from "@swc/helpers/src/_create_super.mjs"; import * as React from "react"; -export var Text = function(_Component) { +export var Text = function(_React_Component) { "use strict"; - _inherits(Text, _Component); + _inherits(Text, _React_Component); var _super = _create_super(Text); function Text() { var _this; diff --git a/crates/swc/tests/tsc-references/tsxDynamicTagName7.1.normal.js b/crates/swc/tests/tsc-references/tsxDynamicTagName7.1.normal.js index 33f67dcf782d..689a0133399c 100644 --- a/crates/swc/tests/tsc-references/tsxDynamicTagName7.1.normal.js +++ b/crates/swc/tests/tsc-references/tsxDynamicTagName7.1.normal.js @@ -5,9 +5,9 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; import _inherits from "@swc/helpers/src/_inherits.mjs"; import _create_super from "@swc/helpers/src/_create_super.mjs"; import * as React from "react"; -export var Text = /*#__PURE__*/ function(_Component) { +export var Text = /*#__PURE__*/ function(_React_Component) { "use strict"; - _inherits(Text, _Component); + _inherits(Text, _React_Component); var _super = _create_super(Text); function Text() { _class_call_check(this, Text); diff --git a/crates/swc/tests/tsc-references/tsxDynamicTagName7.2.minified.js b/crates/swc/tests/tsc-references/tsxDynamicTagName7.2.minified.js index 7376447b8497..9f548ca2b234 100644 --- a/crates/swc/tests/tsc-references/tsxDynamicTagName7.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxDynamicTagName7.2.minified.js @@ -5,9 +5,9 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; import _inherits from "@swc/helpers/src/_inherits.mjs"; import _create_super from "@swc/helpers/src/_create_super.mjs"; import * as React from "react"; -export var Text = function(_Component) { +export var Text = function(_React_Component) { "use strict"; - _inherits(Text, _Component); + _inherits(Text, _React_Component); var _super = _create_super(Text); function Text() { var _this; diff --git a/crates/swc/tests/tsc-references/tsxDynamicTagName8.1.normal.js b/crates/swc/tests/tsc-references/tsxDynamicTagName8.1.normal.js index 11eae177f0be..ff8c688bbb4b 100644 --- a/crates/swc/tests/tsc-references/tsxDynamicTagName8.1.normal.js +++ b/crates/swc/tests/tsc-references/tsxDynamicTagName8.1.normal.js @@ -5,9 +5,9 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; import _inherits from "@swc/helpers/src/_inherits.mjs"; import _create_super from "@swc/helpers/src/_create_super.mjs"; import * as React from "react"; -export var Text = /*#__PURE__*/ function(_Component) { +export var Text = /*#__PURE__*/ function(_React_Component) { "use strict"; - _inherits(Text, _Component); + _inherits(Text, _React_Component); var _super = _create_super(Text); function Text() { _class_call_check(this, Text); diff --git a/crates/swc/tests/tsc-references/tsxDynamicTagName8.2.minified.js b/crates/swc/tests/tsc-references/tsxDynamicTagName8.2.minified.js index df39148869a0..e7e1db40fd84 100644 --- a/crates/swc/tests/tsc-references/tsxDynamicTagName8.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxDynamicTagName8.2.minified.js @@ -5,9 +5,9 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; import _inherits from "@swc/helpers/src/_inherits.mjs"; import _create_super from "@swc/helpers/src/_create_super.mjs"; import * as React from "react"; -export var Text = function(_Component) { +export var Text = function(_React_Component) { "use strict"; - _inherits(Text, _Component); + _inherits(Text, _React_Component); var _super = _create_super(Text); function Text() { var _this; diff --git a/crates/swc/tests/tsc-references/tsxDynamicTagName9.1.normal.js b/crates/swc/tests/tsc-references/tsxDynamicTagName9.1.normal.js index 18ed573a23fc..2234af34e743 100644 --- a/crates/swc/tests/tsc-references/tsxDynamicTagName9.1.normal.js +++ b/crates/swc/tests/tsc-references/tsxDynamicTagName9.1.normal.js @@ -5,9 +5,9 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; import _inherits from "@swc/helpers/src/_inherits.mjs"; import _create_super from "@swc/helpers/src/_create_super.mjs"; import * as React from "react"; -export var Text = /*#__PURE__*/ function(_Component) { +export var Text = /*#__PURE__*/ function(_React_Component) { "use strict"; - _inherits(Text, _Component); + _inherits(Text, _React_Component); var _super = _create_super(Text); function Text() { _class_call_check(this, Text); diff --git a/crates/swc/tests/tsc-references/tsxDynamicTagName9.2.minified.js b/crates/swc/tests/tsc-references/tsxDynamicTagName9.2.minified.js index 566aca0f7d6a..3e803431a513 100644 --- a/crates/swc/tests/tsc-references/tsxDynamicTagName9.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxDynamicTagName9.2.minified.js @@ -5,9 +5,9 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; import _inherits from "@swc/helpers/src/_inherits.mjs"; import _create_super from "@swc/helpers/src/_create_super.mjs"; import * as React from "react"; -export var Text = function(_Component) { +export var Text = function(_React_Component) { "use strict"; - _inherits(Text, _Component); + _inherits(Text, _React_Component); var _super = _create_super(Text); function Text() { var _this; diff --git a/crates/swc/tests/tsc-references/tsxExternalModuleEmit1.1.normal.js b/crates/swc/tests/tsc-references/tsxExternalModuleEmit1.1.normal.js index 9a959b32753a..5e2c94d7042c 100644 --- a/crates/swc/tests/tsc-references/tsxExternalModuleEmit1.1.normal.js +++ b/crates/swc/tests/tsc-references/tsxExternalModuleEmit1.1.normal.js @@ -19,9 +19,9 @@ var _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcar var _createSuper = require("@swc/helpers/lib/_create_super.js").default; var _react = /*#__PURE__*/ _interopRequireWildcard(require("react")); var _button = require("./button"); -var App = /*#__PURE__*/ function(_Component) { +var App = /*#__PURE__*/ function(_React_Component) { "use strict"; - _inherits(App, _Component); + _inherits(App, _React_Component); var _super = _createSuper(App); function App() { _classCallCheck(this, App); @@ -49,9 +49,9 @@ var _inherits = require("@swc/helpers/lib/_inherits.js").default; var _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default; var _createSuper = require("@swc/helpers/lib/_create_super.js").default; var _react = /*#__PURE__*/ _interopRequireWildcard(require("react")); -var Button = /*#__PURE__*/ function(_Component) { +var Button = /*#__PURE__*/ function(_React_Component) { "use strict"; - _inherits(Button, _Component); + _inherits(Button, _React_Component); var _super = _createSuper(Button); function Button() { _classCallCheck(this, Button); diff --git a/crates/swc/tests/tsc-references/tsxExternalModuleEmit1.2.minified.js b/crates/swc/tests/tsc-references/tsxExternalModuleEmit1.2.minified.js index eb0eb7b3e281..c1949382ad48 100644 --- a/crates/swc/tests/tsc-references/tsxExternalModuleEmit1.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxExternalModuleEmit1.2.minified.js @@ -12,9 +12,9 @@ Object.defineProperty(exports, "__esModule", { return App; } }); -var _classCallCheck = require("@swc/helpers/lib/_class_call_check.js").default, _inherits = require("@swc/helpers/lib/_inherits.js").default, _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default, _createSuper = require("@swc/helpers/lib/_create_super.js").default, _react = _interopRequireWildcard(require("react")), _button = require("./button"), App = function(_Component) { +var _classCallCheck = require("@swc/helpers/lib/_class_call_check.js").default, _inherits = require("@swc/helpers/lib/_inherits.js").default, _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default, _createSuper = require("@swc/helpers/lib/_create_super.js").default, _react = _interopRequireWildcard(require("react")), _button = require("./button"), App = function(_React_Component) { "use strict"; - _inherits(App, _Component); + _inherits(App, _React_Component); var _super = _createSuper(App); function App() { return _classCallCheck(this, App), _super.apply(this, arguments); @@ -33,9 +33,9 @@ Object.defineProperty(exports, "__esModule", { return Button; } }); -var _classCallCheck = require("@swc/helpers/lib/_class_call_check.js").default, _inherits = require("@swc/helpers/lib/_inherits.js").default, _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default, _createSuper = require("@swc/helpers/lib/_create_super.js").default, _react = _interopRequireWildcard(require("react")), Button = function(_Component) { +var _classCallCheck = require("@swc/helpers/lib/_class_call_check.js").default, _inherits = require("@swc/helpers/lib/_inherits.js").default, _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default, _createSuper = require("@swc/helpers/lib/_create_super.js").default, _react = _interopRequireWildcard(require("react")), Button = function(_React_Component) { "use strict"; - _inherits(Button, _Component); + _inherits(Button, _React_Component); var _super = _createSuper(Button); function Button() { return _classCallCheck(this, Button), _super.apply(this, arguments); diff --git a/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution17.1.normal.js b/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution17.1.normal.js index bead0839e350..98f01de2c961 100644 --- a/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution17.1.normal.js +++ b/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution17.1.normal.js @@ -3,9 +3,9 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; import _extends from "@swc/helpers/src/_extends.mjs"; import _inherits from "@swc/helpers/src/_inherits.mjs"; import _create_super from "@swc/helpers/src/_create_super.mjs"; -export var Empty = /*#__PURE__*/ function(_Component) { +export var Empty = /*#__PURE__*/ function(_React_Component) { "use strict"; - _inherits(Empty, _Component); + _inherits(Empty, _React_Component); var _super = _create_super(Empty); function Empty() { _class_call_check(this, Empty); diff --git a/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution17.2.minified.js b/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution17.2.minified.js index ed4696e0a66b..654d45b8da73 100644 --- a/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution17.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution17.2.minified.js @@ -3,9 +3,9 @@ import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; import _extends from "@swc/helpers/src/_extends.mjs"; import _inherits from "@swc/helpers/src/_inherits.mjs"; import _create_super from "@swc/helpers/src/_create_super.mjs"; -export var Empty = function(_Component) { +export var Empty = function(_React_Component) { "use strict"; - _inherits(Empty, _Component); + _inherits(Empty, _React_Component); var _super = _create_super(Empty); function Empty() { return _class_call_check(this, Empty), _super.apply(this, arguments); diff --git a/crates/swc/tests/tsc-references/tupleElementTypes1.1.normal.js b/crates/swc/tests/tsc-references/tupleElementTypes1.1.normal.js index 8c81921d853b..303b0d6bc511 100644 --- a/crates/swc/tests/tsc-references/tupleElementTypes1.1.normal.js +++ b/crates/swc/tests/tsc-references/tupleElementTypes1.1.normal.js @@ -1,5 +1,5 @@ //// [tupleElementTypes1.ts] -var ref = [ +var _ref = [ undefined, undefined -], a = ref[0], b = ref[1]; +], a = _ref[0], b = _ref[1]; diff --git a/crates/swc/tests/tsc-references/tupleElementTypes1.2.minified.js b/crates/swc/tests/tsc-references/tupleElementTypes1.2.minified.js index c4328523b418..4cba57762ede 100644 --- a/crates/swc/tests/tsc-references/tupleElementTypes1.2.minified.js +++ b/crates/swc/tests/tsc-references/tupleElementTypes1.2.minified.js @@ -1,6 +1,6 @@ //// [tupleElementTypes1.ts] -var ref = [ +var _ref = [ void 0, void 0 ]; -ref[0], ref[1]; +_ref[0], _ref[1]; diff --git a/crates/swc/tests/tsc-references/tupleElementTypes3.1.normal.js b/crates/swc/tests/tsc-references/tupleElementTypes3.1.normal.js index 11509780ac97..31bfe42ad7ac 100644 --- a/crates/swc/tests/tsc-references/tupleElementTypes3.1.normal.js +++ b/crates/swc/tests/tsc-references/tupleElementTypes3.1.normal.js @@ -1,5 +1,5 @@ //// [tupleElementTypes3.ts] -var ref = [ +var _ref = [ 0, undefined -], a = ref[0], b = ref[1]; +], a = _ref[0], b = _ref[1]; diff --git a/crates/swc/tests/tsc-references/tupleElementTypes3.2.minified.js b/crates/swc/tests/tsc-references/tupleElementTypes3.2.minified.js index a06a81789c65..64a28e1a023d 100644 --- a/crates/swc/tests/tsc-references/tupleElementTypes3.2.minified.js +++ b/crates/swc/tests/tsc-references/tupleElementTypes3.2.minified.js @@ -1,6 +1,6 @@ //// [tupleElementTypes3.ts] -var ref = [ +var _ref = [ 0, void 0 ]; -ref[0], ref[1]; +_ref[0], _ref[1]; diff --git a/crates/swc/tests/tsc-references/tupleElementTypes4.1.normal.js b/crates/swc/tests/tsc-references/tupleElementTypes4.1.normal.js index e0d6fca66f28..8dcc8b77cd0c 100644 --- a/crates/swc/tests/tsc-references/tupleElementTypes4.1.normal.js +++ b/crates/swc/tests/tsc-references/tupleElementTypes4.1.normal.js @@ -1,8 +1,8 @@ //// [tupleElementTypes4.ts] import _sliced_to_array from "@swc/helpers/src/_sliced_to_array.mjs"; function f() { - var ref = _sliced_to_array(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [ + var _ref = _sliced_to_array(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [ 0, undefined - ], 2), a = ref[0], b = ref[1]; + ], 2), a = _ref[0], b = _ref[1]; } diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignment25.1.normal.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignment25.1.normal.js index 9bc34f3113cc..1bf7db83d7df 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignment25.1.normal.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignment25.1.normal.js @@ -8,9 +8,9 @@ Common.I = function _class() { _class_call_check(this, _class); this.i = 1; }; -Common.O = /*#__PURE__*/ function(_I) { +Common.O = /*#__PURE__*/ function(_Common_I) { "use strict"; - _inherits(_class, _I); + _inherits(_class, _Common_I); var _super = _create_super(_class); function _class() { _class_call_check(this, _class); diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignment25.2.minified.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignment25.2.minified.js index 989ac22ce51e..0e3a95af6587 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignment25.2.minified.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignment25.2.minified.js @@ -6,9 +6,9 @@ var Common = {}; Common.I = function _class() { "use strict"; _class_call_check(this, _class), this.i = 1; -}, Common.O = function(_I) { +}, Common.O = function(_Common_I) { "use strict"; - _inherits(_class, _I); + _inherits(_class, _Common_I); var _super = _create_super(_class); function _class() { var _this; diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignment26.1.normal.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignment26.1.normal.js index 5ab09c5082cc..49f6712a627a 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignment26.1.normal.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignment26.1.normal.js @@ -9,9 +9,9 @@ UI.TreeElement = function _class() { this.treeOutline = 12; }; UI.context = new UI.TreeElement(); -var C = /*#__PURE__*/ function(_TreeElement) { +var C = /*#__PURE__*/ function(_UI_TreeElement) { "use strict"; - _inherits(C, _TreeElement); + _inherits(C, _UI_TreeElement); var _super = _create_super(C); function C() { _class_call_check(this, C); diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignmentOutOfOrder.1.normal.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignmentOutOfOrder.1.normal.js index 8c5d8ba99dca..f49e9186b2ca 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignmentOutOfOrder.1.normal.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignmentOutOfOrder.1.normal.js @@ -6,9 +6,9 @@ First.Item = function I() { "use strict"; _class_call_check(this, I); }; -Common.Object = /*#__PURE__*/ function(_Item) { +Common.Object = /*#__PURE__*/ function(_First_Item) { "use strict"; - _inherits(_class, _Item); + _inherits(_class, _First_Item); var _super = _create_super(_class); function _class() { _class_call_check(this, _class); @@ -16,9 +16,9 @@ Common.Object = /*#__PURE__*/ function(_Item) { } return _class; }(First.Item); -Workspace.Object = /*#__PURE__*/ function(_Object) { +Workspace.Object = /*#__PURE__*/ function(_Common_Object) { "use strict"; - _inherits(_class, _Object); + _inherits(_class, _Common_Object); var _super = _create_super(_class); function _class() { _class_call_check(this, _class); diff --git a/crates/swc/tests/tsc-references/typeFromPropertyAssignmentOutOfOrder.2.minified.js b/crates/swc/tests/tsc-references/typeFromPropertyAssignmentOutOfOrder.2.minified.js index 344a84331ec1..63c451c96d44 100644 --- a/crates/swc/tests/tsc-references/typeFromPropertyAssignmentOutOfOrder.2.minified.js +++ b/crates/swc/tests/tsc-references/typeFromPropertyAssignmentOutOfOrder.2.minified.js @@ -5,17 +5,17 @@ import _create_super from "@swc/helpers/src/_create_super.mjs"; First.Item = function I() { "use strict"; _class_call_check(this, I); -}, Common.Object = function(_Item) { +}, Common.Object = function(_First_Item) { "use strict"; - _inherits(_class, _Item); + _inherits(_class, _First_Item); var _super = _create_super(_class); function _class() { return _class_call_check(this, _class), _super.apply(this, arguments); } return _class; -}(First.Item), Workspace.Object = function(_Object) { +}(First.Item), Workspace.Object = function(_Common_Object) { "use strict"; - _inherits(_class, _Object); + _inherits(_class, _Common_Object); var _super = _create_super(_class); function _class() { return _class_call_check(this, _class), _super.apply(this, arguments); diff --git a/crates/swc/tests/tsc-references/typeOfThisInStaticMembers12(target=es2015).1.normal.js b/crates/swc/tests/tsc-references/typeOfThisInStaticMembers12(target=es2015).1.normal.js index d9086bae1141..afb1dfe70023 100644 --- a/crates/swc/tests/tsc-references/typeOfThisInStaticMembers12(target=es2015).1.normal.js +++ b/crates/swc/tests/tsc-references/typeOfThisInStaticMembers12(target=es2015).1.normal.js @@ -1,11 +1,11 @@ //// [typeOfThisInStaticMembers12.ts] -let _c, _c1; +let _this_c, _this_c1; var _Inner; class C { } C.c = "foo"; -C.bar = (_c = C.c, _c1 = C.c, _Inner = class Inner { +C.bar = (_this_c = C.c, _this_c1 = C.c, _Inner = class Inner { constructor(){ - this[_c1] = 123; + this[_this_c1] = 123; } -}, _Inner[_c] = 123, _Inner); +}, _Inner[_this_c] = 123, _Inner); diff --git a/crates/swc/tests/tsc-references/typeOfThisInStaticMembers12(target=es2015).2.minified.js b/crates/swc/tests/tsc-references/typeOfThisInStaticMembers12(target=es2015).2.minified.js index e44fb08981f1..268a28aee94d 100644 --- a/crates/swc/tests/tsc-references/typeOfThisInStaticMembers12(target=es2015).2.minified.js +++ b/crates/swc/tests/tsc-references/typeOfThisInStaticMembers12(target=es2015).2.minified.js @@ -1,10 +1,10 @@ //// [typeOfThisInStaticMembers12.ts] var _Inner; -let _c, _c1; +let _this_c, _this_c1; class C { } -C.c = "foo", C.bar = (_c = C.c, _c1 = C.c, (_Inner = class { +C.c = "foo", C.bar = (_this_c = C.c, _this_c1 = C.c, (_Inner = class { constructor(){ - this[_c1] = 123; + this[_this_c1] = 123; } -})[_c] = 123, _Inner); +})[_this_c] = 123, _Inner); diff --git a/crates/swc/tests/tsc-references/typeOfThisInStaticMembers12(target=es5).1.normal.js b/crates/swc/tests/tsc-references/typeOfThisInStaticMembers12(target=es5).1.normal.js index 15654b6e7e57..77492bf1a06d 100644 --- a/crates/swc/tests/tsc-references/typeOfThisInStaticMembers12(target=es5).1.normal.js +++ b/crates/swc/tests/tsc-references/typeOfThisInStaticMembers12(target=es5).1.normal.js @@ -1,14 +1,14 @@ //// [typeOfThisInStaticMembers12.ts] import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -var _c, _c1; +var _this_c, _this_c1; var _Inner; var C = function C() { "use strict"; _class_call_check(this, C); }; C.c = "foo"; -C.bar = (_c = C.c, _c1 = C.c, _Inner = function Inner() { +C.bar = (_this_c = C.c, _this_c1 = C.c, _Inner = function Inner() { "use strict"; _class_call_check(this, Inner); - this[_c1] = 123; -}, _Inner[_c] = 123, _Inner); + this[_this_c1] = 123; +}, _Inner[_this_c] = 123, _Inner); diff --git a/crates/swc/tests/tsc-references/typeOfThisInStaticMembers12(target=es5).2.minified.js b/crates/swc/tests/tsc-references/typeOfThisInStaticMembers12(target=es5).2.minified.js index 3459a5c2f66c..b006ea285963 100644 --- a/crates/swc/tests/tsc-references/typeOfThisInStaticMembers12(target=es5).2.minified.js +++ b/crates/swc/tests/tsc-references/typeOfThisInStaticMembers12(target=es5).2.minified.js @@ -1,10 +1,10 @@ //// [typeOfThisInStaticMembers12.ts] import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; -var _c, _c1, _Inner, C = function C() { +var _this_c, _this_c1, _Inner, C = function C() { "use strict"; _class_call_check(this, C); }; -C.c = "foo", C.bar = (_c = C.c, _c1 = C.c, (_Inner = function Inner() { +C.c = "foo", C.bar = (_this_c = C.c, _this_c1 = C.c, (_Inner = function Inner() { "use strict"; - _class_call_check(this, Inner), this[_c1] = 123; -})[_c] = 123, _Inner); + _class_call_check(this, Inner), this[_this_c1] = 123; +})[_this_c] = 123, _Inner); diff --git a/crates/swc/tests/tsc-references/typeOfThisInStaticMembers13(target=es2015).1.normal.js b/crates/swc/tests/tsc-references/typeOfThisInStaticMembers13(target=es2015).1.normal.js index 7a27a701ba1e..1607299e3bba 100644 --- a/crates/swc/tests/tsc-references/typeOfThisInStaticMembers13(target=es2015).1.normal.js +++ b/crates/swc/tests/tsc-references/typeOfThisInStaticMembers13(target=es2015).1.normal.js @@ -1,12 +1,12 @@ //// [typeOfThisInStaticMembers13.ts] import _define_property from "@swc/helpers/src/_define_property.mjs"; -let _c, _c1; +let _this_c, _this_c1; var _Inner; class C { } _define_property(C, "c", "foo"); -_define_property(C, "bar", (_c = C.c, _c1 = C.c, _Inner = class Inner { +_define_property(C, "bar", (_this_c = C.c, _this_c1 = C.c, _Inner = class Inner { constructor(){ - _define_property(this, _c1, 123); + _define_property(this, _this_c1, 123); } -}, _define_property(_Inner, _c, 123), _Inner)); +}, _define_property(_Inner, _this_c, 123), _Inner)); diff --git a/crates/swc/tests/tsc-references/typeOfThisInStaticMembers13(target=es2015).2.minified.js b/crates/swc/tests/tsc-references/typeOfThisInStaticMembers13(target=es2015).2.minified.js index 2e7dbae14f73..533beae27733 100644 --- a/crates/swc/tests/tsc-references/typeOfThisInStaticMembers13(target=es2015).2.minified.js +++ b/crates/swc/tests/tsc-references/typeOfThisInStaticMembers13(target=es2015).2.minified.js @@ -1,11 +1,11 @@ //// [typeOfThisInStaticMembers13.ts] var _Inner; -let _c, _c1; +let _this_c, _this_c1; import _define_property from "@swc/helpers/src/_define_property.mjs"; class C { } -_define_property(C, "c", "foo"), _define_property(C, "bar", (_c = C.c, _c1 = C.c, _Inner = class { +_define_property(C, "c", "foo"), _define_property(C, "bar", (_this_c = C.c, _this_c1 = C.c, _Inner = class { constructor(){ - _define_property(this, _c1, 123); + _define_property(this, _this_c1, 123); } -}, _define_property(_Inner, _c, 123), _Inner)); +}, _define_property(_Inner, _this_c, 123), _Inner)); diff --git a/crates/swc/tests/tsc-references/typeOfThisInStaticMembers13(target=es5).1.normal.js b/crates/swc/tests/tsc-references/typeOfThisInStaticMembers13(target=es5).1.normal.js index be88de709183..7bfbaf075923 100644 --- a/crates/swc/tests/tsc-references/typeOfThisInStaticMembers13(target=es5).1.normal.js +++ b/crates/swc/tests/tsc-references/typeOfThisInStaticMembers13(target=es5).1.normal.js @@ -1,15 +1,15 @@ //// [typeOfThisInStaticMembers13.ts] import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; import _define_property from "@swc/helpers/src/_define_property.mjs"; -var _c, _c1; +var _this_c, _this_c1; var _Inner; var C = function C() { "use strict"; _class_call_check(this, C); }; _define_property(C, "c", "foo"); -_define_property(C, "bar", (_c = C.c, _c1 = C.c, _Inner = function Inner() { +_define_property(C, "bar", (_this_c = C.c, _this_c1 = C.c, _Inner = function Inner() { "use strict"; _class_call_check(this, Inner); - _define_property(this, _c1, 123); -}, _define_property(_Inner, _c, 123), _Inner)); + _define_property(this, _this_c1, 123); +}, _define_property(_Inner, _this_c, 123), _Inner)); diff --git a/crates/swc/tests/tsc-references/typeOfThisInStaticMembers13(target=es5).2.minified.js b/crates/swc/tests/tsc-references/typeOfThisInStaticMembers13(target=es5).2.minified.js index eaf257f64f2e..1e88a5887d85 100644 --- a/crates/swc/tests/tsc-references/typeOfThisInStaticMembers13(target=es5).2.minified.js +++ b/crates/swc/tests/tsc-references/typeOfThisInStaticMembers13(target=es5).2.minified.js @@ -1,11 +1,11 @@ //// [typeOfThisInStaticMembers13.ts] import _class_call_check from "@swc/helpers/src/_class_call_check.mjs"; import _define_property from "@swc/helpers/src/_define_property.mjs"; -var _c, _c1, _Inner, C = function C() { +var _this_c, _this_c1, _Inner, C = function C() { "use strict"; _class_call_check(this, C); }; -_define_property(C, "c", "foo"), _define_property(C, "bar", (_c = C.c, _c1 = C.c, _Inner = function Inner() { +_define_property(C, "c", "foo"), _define_property(C, "bar", (_this_c = C.c, _this_c1 = C.c, _Inner = function Inner() { "use strict"; - _class_call_check(this, Inner), _define_property(this, _c1, 123); -}, _define_property(_Inner, _c, 123), _Inner)); + _class_call_check(this, Inner), _define_property(this, _this_c1, 123); +}, _define_property(_Inner, _this_c, 123), _Inner)); diff --git a/crates/swc/tests/tsc-references/typeOfThisInstanceMemberNarrowedWithLoopAntecedent.1.normal.js b/crates/swc/tests/tsc-references/typeOfThisInstanceMemberNarrowedWithLoopAntecedent.1.normal.js index 680b5f7bad02..57341e5850c4 100644 --- a/crates/swc/tests/tsc-references/typeOfThisInstanceMemberNarrowedWithLoopAntecedent.1.normal.js +++ b/crates/swc/tests/tsc-references/typeOfThisInstanceMemberNarrowedWithLoopAntecedent.1.normal.js @@ -23,13 +23,13 @@ var SomeClass2 = /*#__PURE__*/ function() { } var _proto = SomeClass2.prototype; _proto.method = function method() { - var ref; + var _this_state; var c = false; while(c){} if (this.state.type === "numberVariant") { this.state.data; } - var n = (ref = this.state) === null || ref === void 0 ? void 0 : ref.data; // This should be an error + var n = (_this_state = this.state) === null || _this_state === void 0 ? void 0 : _this_state.data; // This should be an error }; return SomeClass2; }(); diff --git a/crates/swc/tests/tsc-references/unionTypeReduction2.1.normal.js b/crates/swc/tests/tsc-references/unionTypeReduction2.1.normal.js index ddb5b18f6731..27dd723f84ae 100644 --- a/crates/swc/tests/tsc-references/unionTypeReduction2.1.normal.js +++ b/crates/swc/tests/tsc-references/unionTypeReduction2.1.normal.js @@ -38,7 +38,7 @@ var k = { something: function something() {} }; function run(options) { - var _something; - var something = (_something = options.something) !== null && _something !== void 0 ? _something : val.something; + var _options_something; + var something = (_options_something = options.something) !== null && _options_something !== void 0 ? _options_something : val.something; something(""); } diff --git a/crates/swc/tests/tsc-references/wideningTuples5.1.normal.js b/crates/swc/tests/tsc-references/wideningTuples5.1.normal.js index c7a340282d21..3862b05ce207 100644 --- a/crates/swc/tests/tsc-references/wideningTuples5.1.normal.js +++ b/crates/swc/tests/tsc-references/wideningTuples5.1.normal.js @@ -1,5 +1,5 @@ //// [wideningTuples5.ts] -var ref = [ +var _ref = [ undefined, null -], a = ref[0], b = ref[1]; +], a = _ref[0], b = _ref[1]; diff --git a/crates/swc/tests/tsc-references/wideningTuples5.2.minified.js b/crates/swc/tests/tsc-references/wideningTuples5.2.minified.js index 2f951821accf..99501dbd2a0f 100644 --- a/crates/swc/tests/tsc-references/wideningTuples5.2.minified.js +++ b/crates/swc/tests/tsc-references/wideningTuples5.2.minified.js @@ -1,6 +1,6 @@ //// [wideningTuples5.ts] -var ref = [ +var _ref = [ void 0, null ]; -ref[0], ref[1]; +_ref[0], _ref[1]; diff --git a/crates/swc/tests/tsc-references/wideningTuples6.1.normal.js b/crates/swc/tests/tsc-references/wideningTuples6.1.normal.js index 0bd1cb3886c1..386ef597f06b 100644 --- a/crates/swc/tests/tsc-references/wideningTuples6.1.normal.js +++ b/crates/swc/tests/tsc-references/wideningTuples6.1.normal.js @@ -1,7 +1,7 @@ //// [wideningTuples6.ts] -var ref = [ +var _ref = [ undefined, null -], a = ref[0], b = ref[1]; +], a = _ref[0], b = _ref[1]; a = ""; b = ""; diff --git a/crates/swc/tests/tsc-references/wideningTuples6.2.minified.js b/crates/swc/tests/tsc-references/wideningTuples6.2.minified.js index 7a3ea1af65a3..dd83e317fb4e 100644 --- a/crates/swc/tests/tsc-references/wideningTuples6.2.minified.js +++ b/crates/swc/tests/tsc-references/wideningTuples6.2.minified.js @@ -1,6 +1,6 @@ //// [wideningTuples6.ts] -var ref = [ +var _ref = [ void 0, null ]; -ref[0], ref[1]; +_ref[0], _ref[1]; diff --git a/crates/swc/tests/vercel/loader-only/2/output/index.js b/crates/swc/tests/vercel/loader-only/2/output/index.js index b9c5df7fa247..8805cc89e04c 100644 --- a/crates/swc/tests/vercel/loader-only/2/output/index.js +++ b/crates/swc/tests/vercel/loader-only/2/output/index.js @@ -4,11 +4,11 @@ import { useRouter } from "next/router"; import { useProject } from "@swr/use-project"; import useTeam from "@swr/use-team"; export default function MyComp() { - var _query = useRouter().query, projectName = _query.project; - var ref = useProject(projectName), projectInfo = ref.data; + var _useRouter_query = useRouter().query, projectName = _useRouter_query.project; + var _useProject = useProject(projectName), projectInfo = _useProject.data; var teamSlug = useTeam().teamSlug; var projectId = projectInfo === null || projectInfo === void 0 ? void 0 : projectInfo.id; - var ref1 = useProjectBranches(projectId), branches = ref1.data; + var _useProjectBranches = useProjectBranches(projectId), branches = _useProjectBranches.data; return /*#__PURE__*/ _jsx(_Fragment, {}); } for(var i = 0; i < points.length; i++){ diff --git a/crates/swc/tests/vercel/loader-only/next-39460/output/snippetSession.js b/crates/swc/tests/vercel/loader-only/next-39460/output/snippetSession.js index dcd340051f3a..babebf7a4542 100644 --- a/crates/swc/tests/vercel/loader-only/next-39460/output/snippetSession.js +++ b/crates/swc/tests/vercel/loader-only/next-39460/output/snippetSession.js @@ -193,7 +193,7 @@ export var OneSnippet = /*#__PURE__*/ function() { // change stickness to never grow when typing at its edges // so that in-active tabstops never grow for(var _iterator2 = _this._placeholderDecorations[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true){ - var _value = _sliced_to_array(_step2.value, 2), placeholder1 = _value[0], id2 = _value[1]; + var _step_value = _sliced_to_array(_step2.value, 2), placeholder1 = _step_value[0], id2 = _step_value[1]; if (!activePlaceholders.has(placeholder1)) { accessor.changeDecorationOptions(id2, placeholder1.isFinalTabstop ? OneSnippet._decor.inactiveFinal : OneSnippet._decor.inactive); } @@ -468,7 +468,7 @@ export var SnippetSession = /*#__PURE__*/ function() { return; } // make insert edit and start with first selections - var ref = SnippetSession.createEditsAndSnippets(this._editor, this._template, this._options.overwriteBefore, this._options.overwriteAfter, false, this._options.adjustWhitespace, this._options.clipboardText, this._options.overtypingCapturer), edits = ref.edits, snippets = ref.snippets; + var _SnippetSession_createEditsAndSnippets = SnippetSession.createEditsAndSnippets(this._editor, this._template, this._options.overwriteBefore, this._options.overwriteAfter, false, this._options.adjustWhitespace, this._options.clipboardText, this._options.overtypingCapturer), edits = _SnippetSession_createEditsAndSnippets.edits, snippets = _SnippetSession_createEditsAndSnippets.snippets; this._snippets = snippets; this._editor.executeEdits("snippet", edits, function(undoEdits) { if (_this._snippets[0].hasPlaceholder) { @@ -495,7 +495,7 @@ export var SnippetSession = /*#__PURE__*/ function() { this._snippets[0]._placeholderGroupsIdx, template ]); - var ref = SnippetSession.createEditsAndSnippets(this._editor, template, options.overwriteBefore, options.overwriteAfter, true, options.adjustWhitespace, options.clipboardText, options.overtypingCapturer), edits = ref.edits, snippets = ref.snippets; + var _SnippetSession_createEditsAndSnippets = SnippetSession.createEditsAndSnippets(this._editor, template, options.overwriteBefore, options.overwriteAfter, true, options.adjustWhitespace, options.clipboardText, options.overtypingCapturer), edits = _SnippetSession_createEditsAndSnippets.edits, snippets = _SnippetSession_createEditsAndSnippets.snippets; this._editor.executeEdits("snippet", edits, function(undoEdits) { var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined; try { @@ -590,7 +590,7 @@ export var SnippetSession = /*#__PURE__*/ function() { var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined; try { for(var _iterator = possibleSelections[Symbol.iterator](), _step1; !(_iteratorNormalCompletion = (_step1 = _iterator.next()).done); _iteratorNormalCompletion = true){ - var _value = _sliced_to_array(_step1.value, 2), index = _value[0], ranges = _value[1]; + var _step_value = _sliced_to_array(_step1.value, 2), index = _step_value[0], ranges = _step_value[1]; ranges.sort(Range.compareRangesUsingStarts); var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined; try { @@ -670,7 +670,7 @@ export var SnippetSession = /*#__PURE__*/ function() { var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined; try { for(var _iterator1 = allPossibleSelections[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){ - var _value = _sliced_to_array(_step1.value, 2), index = _value[0], ranges = _value[1]; + var _step_value = _sliced_to_array(_step1.value, 2), index = _step_value[0], ranges = _step_value[1]; if (ranges.length !== selections.length) { allPossibleSelections.delete(index); continue; @@ -805,7 +805,7 @@ export var SnippetSession = /*#__PURE__*/ function() { var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined; try { for(var _iterator = indexedSelections[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){ - var _value = _step.value, selection = _value.selection, idx = _value.idx; + var _step_value = _step.value, selection = _step_value.selection, idx = _step_value.idx; // extend selection with the `overwriteBefore` and `overwriteAfter` and then // compare if this matches the extensions of the primary selection var extensionBefore = SnippetSession.adjustSelection(model, selection, overwriteBefore, 0); diff --git a/crates/swc/tests/vercel/loader-only/react-autowhatever/1/output/index.js b/crates/swc/tests/vercel/loader-only/react-autowhatever/1/output/index.js index d6d175c5b82c..3ee1d4440b6d 100644 --- a/crates/swc/tests/vercel/loader-only/react-autowhatever/1/output/index.js +++ b/crates/swc/tests/vercel/loader-only/react-autowhatever/1/output/index.js @@ -29,7 +29,7 @@ var ItemsList = /*#__PURE__*/ function(Component) { }; _proto.render = function render() { var _this = this; - var _props = this.props, items = _props.items, itemProps = _props.itemProps, renderItem = _props.renderItem, renderItemData = _props.renderItemData, sectionIndex = _props.sectionIndex, highlightedItemIndex = _props.highlightedItemIndex, getItemId = _props.getItemId, theme = _props.theme, keyPrefix = _props.keyPrefix; + var _this_props = this.props, items = _this_props.items, itemProps = _this_props.itemProps, renderItem = _this_props.renderItem, renderItemData = _this_props.renderItemData, sectionIndex = _this_props.sectionIndex, highlightedItemIndex = _this_props.highlightedItemIndex, getItemId = _this_props.getItemId, theme = _this_props.theme, keyPrefix = _this_props.keyPrefix; var sectionPrefix = sectionIndex === null ? keyPrefix : "".concat(keyPrefix, "section-").concat(sectionIndex, "-"); var isItemPropsFunction = typeof itemProps === "function"; return /*#__PURE__*/ _jsx("ul", _object_spread_props(_object_spread({ diff --git a/crates/swc/tests/vercel/loader-only/react-instantsearch/1/output/index.js b/crates/swc/tests/vercel/loader-only/react-instantsearch/1/output/index.js index 49f1dd250216..30217b86aec6 100644 --- a/crates/swc/tests/vercel/loader-only/react-instantsearch/1/output/index.js +++ b/crates/swc/tests/vercel/loader-only/react-instantsearch/1/output/index.js @@ -72,7 +72,7 @@ function serializeQueryParameters(parameters) { * @param {number} stalledSearchDelay - time (in ms) after the search is stalled * @return {InstantSearchManager} a new instance of InstantSearchManager */ export default function createInstantSearchManager(param) { - var indexName = param.indexName, _initialState = param.initialState, initialState = _initialState === void 0 ? {} : _initialState, searchClient = param.searchClient, resultsState = param.resultsState, stalledSearchDelay = param.stalledSearchDelay; + var indexName = param.indexName, _param_initialState = param.initialState, initialState = _param_initialState === void 0 ? {} : _param_initialState, searchClient = param.searchClient, resultsState = param.resultsState, stalledSearchDelay = param.stalledSearchDelay; var createStore = function createStore(initialState) { var state = initialState; var listeners = []; @@ -160,7 +160,7 @@ function serializeQueryParameters(parameters) { }; var search = function search() { if (!skip) { - var ref = getSearchParameters(helper.state), mainParameters = ref.mainParameters, derivedParameters = ref.derivedParameters; + var _getSearchParameters = getSearchParameters(helper.state), mainParameters = _getSearchParameters.mainParameters, derivedParameters = _getSearchParameters.derivedParameters; // We have to call `slice` because the method `detach` on the derived // helpers mutates the value `derivedHelpers`. The `forEach` loop does // not iterate on each value and we're not able to correctly clear the @@ -247,15 +247,15 @@ function serializeQueryParameters(parameters) { }; var handleNewSearch = function handleNewSearch() { if (!stalledSearchTimer) { - var _tmp; - _tmp = setTimeout(function() { - var _ref = store.getState(), resultsFacetValues = _ref.resultsFacetValues, partialState = _object_without_properties(_ref, [ + var _setTimeout; + _setTimeout = setTimeout(function() { + var _store_getState = store.getState(), resultsFacetValues = _store_getState.resultsFacetValues, partialState = _object_without_properties(_store_getState, [ "resultsFacetValues" ]); store.setState(_object_spread_props(_object_spread({}, partialState), { isSearchStalled: true })); - }, stalledSearchDelay), stalledSearchTimer = _tmp, _tmp; + }, stalledSearchDelay), stalledSearchTimer = _setTimeout, _setTimeout; } }; var hydrateSearchClient = function hydrateSearchClient(client, results) { @@ -427,7 +427,7 @@ function serializeQueryParameters(parameters) { search(); }; var onSearchForFacetValues = function onSearchForFacetValues(param) { - var facetName = param.facetName, query = param.query, _maxFacetHits = param.maxFacetHits, maxFacetHits = _maxFacetHits === void 0 ? 10 : _maxFacetHits; + var facetName = param.facetName, query = param.query, _param_maxFacetHits = param.maxFacetHits, maxFacetHits = _param_maxFacetHits === void 0 ? 10 : _param_maxFacetHits; // The values 1, 100 are the min / max values that the engine accepts. // see: https://www.algolia.com/doc/api-reference/api-parameters/maxFacetHits var maxFacetHitsWithinRange = Math.max(1, Math.min(maxFacetHits, 100)); diff --git a/crates/swc_ecma_transforms/tests/es2015_function_name.rs b/crates/swc_ecma_transforms/tests/es2015_function_name.rs index 2250324f73ff..0d2db2fe877f 100644 --- a/crates/swc_ecma_transforms/tests/es2015_function_name.rs +++ b/crates/swc_ecma_transforms/tests/es2015_function_name.rs @@ -324,9 +324,9 @@ var _store = require("./store"); let Login = /*#__PURE__*/ -function (_Component) { +function (_React_Component) { "use strict"; - _inherits(Login, _Component); + _inherits(Login, _React_Component); var _super = _createSuper(Login); function Login() { _classCallCheck(this, Login); diff --git a/crates/swc_ecma_transforms_compat/src/es2015/mod.rs b/crates/swc_ecma_transforms_compat/src/es2015/mod.rs index 690440124e85..4a29c9ead8bd 100644 --- a/crates/swc_ecma_transforms_compat/src/es2015/mod.rs +++ b/crates/swc_ecma_transforms_compat/src/es2015/mod.rs @@ -176,9 +176,9 @@ export var Foo = function() { class HomePage extends React.Component {} "#, r#" - var HomePage = /*#__PURE__*/function (_Component) { + var HomePage = /*#__PURE__*/function (_React_Component) { "use strict"; - _inherits(HomePage, _Component); + _inherits(HomePage, _React_Component); var _super = _createSuper(HomePage); diff --git a/crates/swc_ecma_transforms_compat/src/es2018/object_rest_spread.rs b/crates/swc_ecma_transforms_compat/src/es2018/object_rest_spread.rs index ae41043ce0db..112280dd9795 100644 --- a/crates/swc_ecma_transforms_compat/src/es2018/object_rest_spread.rs +++ b/crates/swc_ecma_transforms_compat/src/es2018/object_rest_spread.rs @@ -363,7 +363,7 @@ impl VisitMut for ObjectRest { Pat::Ident(ref i) => (i.id.clone(), false), _ => match decl.init { - Some(ref e) => alias_if_required(e, "_ref"), + Some(ref e) => alias_if_required(e, "ref"), _ => (private_ident!("_ref"), true), }, }; diff --git a/crates/swc_ecma_transforms_compat/src/es2020/nullish_coalescing/mod.rs b/crates/swc_ecma_transforms_compat/src/es2020/nullish_coalescing.rs similarity index 99% rename from crates/swc_ecma_transforms_compat/src/es2020/nullish_coalescing/mod.rs rename to crates/swc_ecma_transforms_compat/src/es2020/nullish_coalescing.rs index ece24839d67c..be06b22d83bc 100644 --- a/crates/swc_ecma_transforms_compat/src/es2020/nullish_coalescing/mod.rs +++ b/crates/swc_ecma_transforms_compat/src/es2020/nullish_coalescing.rs @@ -7,9 +7,6 @@ use swc_ecma_utils::{alias_if_required, undefined, StmtLike}; use swc_ecma_visit::{as_folder, noop_visit_mut_type, Fold, VisitMut, VisitMutWith}; use swc_trace_macro::swc_trace; -#[cfg(test)] -mod tests; - #[tracing::instrument(level = "info", skip_all)] pub fn nullish_coalescing(c: Config) -> impl Fold + VisitMut + 'static { as_folder(NullishCoalescing { diff --git a/crates/swc_ecma_transforms_compat/src/es2020/opt_chaining.rs b/crates/swc_ecma_transforms_compat/src/es2020/opt_chaining.rs index a52844351558..2a8b4af1050b 100644 --- a/crates/swc_ecma_transforms_compat/src/es2020/opt_chaining.rs +++ b/crates/swc_ecma_transforms_compat/src/es2020/opt_chaining.rs @@ -7,7 +7,7 @@ use swc_ecma_ast::*; use swc_ecma_transforms_base::perf::Check; use swc_ecma_transforms_macros::fast_path; use swc_ecma_utils::{ - alias_if_required, opt_chain_test, prepend_stmt, private_ident, undefined, ExprFactory, + alias_ident_for, alias_if_required, opt_chain_test, prepend_stmt, undefined, ExprFactory, IntoIndirectCall, StmtLike, }; use swc_ecma_visit::{ @@ -389,7 +389,7 @@ impl OptChaining { let (left, right, alt) = match &mut **obj { Expr::Ident(..) => (obj.clone(), obj.clone(), Box::new(e.base.take().into())), _ => { - let i = private_ident!(obj_span, "ref"); + let i = alias_ident_for(obj, "ref"); self.vars_without_init.push(VarDeclarator { span: obj_span, definite: false, @@ -462,6 +462,9 @@ impl OptChaining { } else { (Ident::dummy(), false) }; + + let tmp = alias_ident_for(&call.callee, "ref"); + let obj_expr = if !is_super_access && aliased { self.vars_without_init.push(VarDeclarator { span: obj_span, @@ -493,8 +496,6 @@ impl OptChaining { call.callee.take() }; - let tmp = private_ident!(obj_span, "ref"); - self.vars_without_init.push(VarDeclarator { span: obj_span, definite: false, diff --git a/crates/swc_ecma_transforms_compat/tests/es2015_classes.rs b/crates/swc_ecma_transforms_compat/tests/es2015_classes.rs index e8258d99434c..7c527c43c57e 100644 --- a/crates/swc_ecma_transforms_compat/tests/es2015_classes.rs +++ b/crates/swc_ecma_transforms_compat/tests/es2015_classes.rs @@ -76,9 +76,9 @@ test!( class HomePage extends React.Component {} "#, r#" -let HomePage = function(_Component) { +let HomePage = function(_React_Component) { "use strict"; - _inherits(HomePage, _Component); + _inherits(HomePage, _React_Component); var _super = _createSuper(HomePage); function HomePage() { _classCallCheck(this, HomePage); @@ -4479,10 +4479,10 @@ class BaseController2 extends Chaplin.Controller.Another { r#" var BaseController = /*#__PURE__*/ -function (_Controller) { +function (_Chaplin_Controller) { "use strict"; - _inherits(BaseController, _Controller); + _inherits(BaseController, _Chaplin_Controller); var _super = _createSuper(BaseController); function BaseController() { _classCallCheck(this, BaseController); @@ -4494,10 +4494,10 @@ function (_Controller) { var BaseController2 = /*#__PURE__*/ -function (_Another) { +function (_Chaplin_Controller_Another) { "use strict"; - _inherits(BaseController2, _Another); + _inherits(BaseController2, _Chaplin_Controller_Another); var _super = _createSuper(BaseController2); function BaseController2() { _classCallCheck(this, BaseController2); @@ -7252,27 +7252,27 @@ class BaseController extends Chaplin.Controller { } class BaseController2 extends Chaplin.Controller.Another { } "#, r#" -let BaseController = /*#__PURE__*/function (_Controller) { +let BaseController = /*#__PURE__*/function (_Chaplin_Controller) { "use strict"; - _inherits(BaseController, _Controller); + _inherits(BaseController, _Chaplin_Controller); function BaseController() { _classCallCheck(this, BaseController); - return _Controller.apply(this, arguments); + return _Chaplin_Controller.apply(this, arguments); } return BaseController; }(Chaplin.Controller); -let BaseController2 = /*#__PURE__*/function (_Another) { +let BaseController2 = /*#__PURE__*/function (_Chaplin_Controller_Another) { "use strict"; - _inherits(BaseController2, _Another); + _inherits(BaseController2, _Chaplin_Controller_Another); function BaseController2() { _classCallCheck(this, BaseController2); - return _Another.apply(this, arguments); + return _Chaplin_Controller_Another.apply(this, arguments); } return BaseController2; diff --git a/crates/swc_ecma_transforms_compat/tests/es2015_destructuring.rs b/crates/swc_ecma_transforms_compat/tests/es2015_destructuring.rs index 40d296b45499..929cfa9a0e29 100644 --- a/crates/swc_ecma_transforms_compat/tests/es2015_destructuring.rs +++ b/crates/swc_ecma_transforms_compat/tests/es2015_destructuring.rs @@ -38,9 +38,9 @@ test!( |_| tr(), issue_2821, r#"const [x, y, ...z] = [1];"#, - r#"const ref = [ + r#"const _ref = [ 1 -], x = ref[0], y = ref[1], z = ref.slice(2)"#, +], x = _ref[0], y = _ref[1], z = _ref.slice(2)"#, ok_if_code_eq ); @@ -257,8 +257,8 @@ test!( array_pat_assign_prop_binding_6, "const [foo = 1] = [];", " -const ref = [], - tmp = ref[0], +const _ref = [], + tmp = _ref[0], foo = tmp === void 0 ? 1 : tmp; " ); @@ -269,8 +269,8 @@ test!( array_pat_assign_prop_binding_7, "const [foo = 1] = [1, 2];", " -const ref = [1, 2], - tmp = ref[0], +const _ref = [1, 2], + tmp = _ref[0], foo = tmp === void 0 ? 1 : tmp; " ); @@ -306,9 +306,9 @@ test!( object_pat_assign_prop_2, "const {code = 1} = {}", " -const ref = {}, - _code = ref.code, - code = _code === void 0 ? 1 : _code; +const _ref = {}, + _ref_code = _ref.code, + code = _ref_code === void 0 ? 1 : _ref_code; " ); @@ -329,8 +329,8 @@ test!( object_pat_assign_prop_binding_2, "const {foo: bar = 1} = {}", " -const ref = {}, - tmp = ref.foo, +const _ref = {}, + tmp = _ref.foo, bar = tmp === void 0 ? 1 : tmp; " ); @@ -392,7 +392,7 @@ test!( |_| tr(), obj_assign_pat, r#"let { a = 1 } = foo"#, - r#"let _a = foo.a, a = _a === void 0 ? 1 : _a;"# + r#"let _foo_a = foo.a, a = _foo_a === void 0 ? 1 : _foo_a;"# ); test!( @@ -411,7 +411,7 @@ test!( |_| tr(), array1, r#"var [a, [b], [c]] = ["hello", [", ", "junk"], ["world"]];"#, - r#"var a = "hello", ref = [", ", "junk"], b = ref[0], c = "world";"# + r#"var a = "hello", _ref = [", ", "junk"], b = _ref[0], c = "world";"# ); test!( @@ -478,8 +478,8 @@ test!( |_| tr(), empty, r#"var [, a, [b], [c], d] = ["foo", "hello", [", ", "junk"], ["world"]];"#, - r#"var ref = ["foo", "hello", [", ", "junk"], ["world"]], a = ref[1], ref1 = ref[2], - b = ref1[0], ref2 = ref[3], c = ref2[0], d = ref[4]; + r#"var _ref = ["foo", "hello", [", ", "junk"], ["world"]], a = _ref[1], _ref_ = _ref[2], + b = _ref_[0], _ref_1 = _ref[3], c = _ref_1[0], d = _ref[4]; "# ); @@ -557,11 +557,11 @@ test!( export_variable_issue_2858_1, r#"export const { a: a2, b: b2 } = { a: 1, b: 2 };"#, r#" -var ref = { +var _ref = { a: 1, b: 2, }; -export const a2 = ref.a, b2 = ref.b; +export const a2 = _ref.a, b2 = _ref.b; "# ); @@ -571,10 +571,10 @@ test!( export_variable_issue_2858_2, r#"export const { a: b } = { a: 1 }"#, r#" -var ref = { +var _ref = { a: 1 }; -export const b = ref.a; +export const b = _ref.a; "# ); @@ -590,16 +590,16 @@ export const { } = { a: 1, b: { c: 1 } }; "#, r#" -var ref = { +var _ref = { a: 1, b: { c: 1, }, }, - _b = ref.b; -export const a1 = ref.a, - b1 = ref.b, - c1 = _b.c; + _ref_b = _ref.b; +export const a1 = _ref.a, + b1 = _ref.b, + c1 = _ref_b.c; "# ); @@ -1360,9 +1360,9 @@ console.log(unpackArray(["hello", ", ", "world"], [1, 2, 3])); "#, r#" function somethingAdvanced(param, p2, p3) { - var tmp = param.topLeft, ref = tmp === void 0 ? { - } : tmp, x1 = ref.x, y1 = ref.y, tmp1 = param.bottomRight, ref1 = tmp1 === void 0 ? { - } : tmp1, x2 = ref1.x, y2 = ref1.y; + var tmp = param.topLeft, _ref = tmp === void 0 ? { + } : tmp, x1 = _ref.x, y1 = _ref.y, tmp1 = param.bottomRight, _ref1 = tmp1 === void 0 ? { + } : tmp1, x2 = _ref1.x, y2 = _ref1.y; } function unpackObject(param) { @@ -1442,31 +1442,31 @@ test!( var a = 1, b = 2, c = [3, 4]; - var ref = [1, 2, 3], - a = ref[0], - b = ref[1]; - var ref1 = [1, 2, 3], - a = ref1[0], - b = ref1[1]; - var ref2 = [a, b], - a = ref2[0], - b = ref2[1]; - var ref3; - ref3 = [a[1], a[0]], a[0] = ref3[0], a[1] = ref3[1], ref3; - - - var ref4 = _slicedToArray(_toConsumableArray(foo).concat([bar]), 2), a = ref4[0], b = ref4[1]; + var _ref = [1, 2, 3], + a = _ref[0], + b = _ref[1]; + var _ref1 = [1, 2, 3], + a = _ref1[0], + b = _ref1[1]; + var _ref2 = [a, b], + a = _ref2[0], + b = _ref2[1]; + var ref; + ref = [a[1], a[0]], a[0] = ref[0], a[1] = ref[1], ref; + + + var _toConsumableArray_concat = _slicedToArray(_toConsumableArray(foo).concat([bar]), 2), a = _toConsumableArray_concat[0], b = _toConsumableArray_concat[1]; // TODO: var ref4 = _toConsumableArray(foo).concat([bar]), a = ref4[0], b = ref4[1]; -var ref5 = [foo(), bar], - a = ref5[0], - b = ref5[1]; -var ref6 = [clazz.foo(), bar], - a = ref6[0], - b = ref6[1]; -var ref7 = [clazz.foo, bar], - a = ref7[0], - b = ref7[1]; +var _ref3 = [foo(), bar], + a = _ref3[0], + b = _ref3[1]; +var _ref4 = [clazz.foo(), bar], + a = _ref4[0], + b = _ref4[1]; +var _ref5 = [clazz.foo, bar], + a = _ref5[0], + b = _ref5[1]; var a, b = 2; a = 1, b = 2; @@ -1627,16 +1627,15 @@ var { 3: foo, 5: bar } = [0, 1, 2, 3, 4, 5, 6]; "#, r#" var rect = {}; -var _topLeft = rect.topLeft, - x1 = _topLeft.x, - y1 = _topLeft.y, - _bottomRight = rect.bottomRight, - x2 = _bottomRight.x, - y2 = _bottomRight.y; -var ref = [0, 1, 2, 3, 4, 5, 6], - foo = ref[3], - bar = ref[5]; - +var _rect_topLeft = rect.topLeft, + x1 = _rect_topLeft.x, + y1 = _rect_topLeft.y, + _rect_bottomRight = rect.bottomRight, + x2 = _rect_bottomRight.x, + y2 = _rect_bottomRight.y; +var _ref = [0, 1, 2, 3, 4, 5, 6], + foo = _ref[3], + bar = _ref[5]; "# ); @@ -1705,13 +1704,12 @@ var {topLeft: [x1, y1], bottomRight: [x2, y2] } = rect; r#" var rect = {}; -var _topLeft = _slicedToArray(rect.topLeft, 2), - x1 = _topLeft[0], - y1 = _topLeft[1], - _bottomRight = _slicedToArray(rect.bottomRight, 2), - x2 = _bottomRight[0], - y2 = _bottomRight[1]; - +var _rect_topLeft = _slicedToArray(rect.topLeft, 2), + x1 = _rect_topLeft[0], + y1 = _rect_topLeft[1], + _rect_bottomRight = _slicedToArray(rect.bottomRight, 2), + x2 = _rect_bottomRight[0], + y2 = _rect_bottomRight[1]; "# ); @@ -1779,17 +1777,17 @@ var [a, [b], [c]] = ["hello", [", ", "junk"], ["world"]]; "#, r#" var a = "hello", - ref = [", ", "junk"], - b = ref[0], + _ref = [", ", "junk"], + b = _ref[0], c = "world"; -var ref1, ref2; +var ref, ref1; a = "hello", - ref1 = [", ", "junk"], - b = ref1[0], - ref1, - ref2 = ["world"], - c = ref2[0], - ref2; + ref = [", ", "junk"], + b = ref[0], + ref, + ref1 = ["world"], + c = ref1[0], + ref1; "# ); @@ -1854,14 +1852,14 @@ const { r#" var input = {}; -var key = prefix + 'state', - key1 = `${prefix}consents`, +var _key = prefix + 'state', + _key1 = `${prefix}consents`, givenName = input.given_name, lastName = input['last_name'], country = input[`country`], - state = input[key], - consents = input[key1], - rest = _objectWithoutProperties(input, ["given_name", 'last_name', `country`, key, key1].map(_toPropertyKey)); + state = input[_key], + consents = input[_key1], + rest = _objectWithoutProperties(input, ["given_name", 'last_name', `country`, _key, _key1].map(_toPropertyKey)); "# @@ -2030,7 +2028,7 @@ test!( const [ { a: a_ = 1 } ] = b ", " - const ref = b[0], tmp = ref.a, a_ = tmp === void 0 ? 1 : tmp; + const _b_ = b[0], tmp = _b_.a, a_ = tmp === void 0 ? 1 : tmp; " ); @@ -2045,7 +2043,8 @@ test!( ", " async function f(a, b) { - const ref = JSON.parse(b), ref1 = ref[0], tmp = ref1.a, a_ = tmp === void 0 ? 1 : tmp; + const _JSON_parse = JSON.parse(b), _JSON_parse_ = _JSON_parse[0], tmp = _JSON_parse_.a, a_ \ + = tmp === void 0 ? 1 : tmp; } " ); @@ -2209,8 +2208,8 @@ test!( yield 2; } let bar = foo(); - const ref = [,bar.next().value], tmp = ref[0], - x = tmp === void 0 ? bar.next().value : tmp, y = ref[1]; + const _ref = [,bar.next().value], tmp = _ref[0], + x = tmp === void 0 ? bar.next().value : tmp, y = _ref[1]; console.log(x, y);" ); @@ -2267,7 +2266,7 @@ test!( |_| tr(), issue_6304, "let [] = [];", - "let ref = [];" + "let _ref = [];" ); test!( @@ -2275,7 +2274,7 @@ test!( |_| tr(), issue_6304_1, "let [] = [,];", - "let ref = [,];" + "let _ref = [,];" ); test!( @@ -2283,5 +2282,5 @@ test!( |_| tr(), issue_6304_2, "let [] = [...[1, 2, 3]];", - "let ref = [...[1, 2, 3]];" + "let _ref = [...[1, 2, 3]];" ); diff --git a/crates/swc_ecma_transforms_compat/tests/es2015_parameters.rs b/crates/swc_ecma_transforms_compat/tests/es2015_parameters.rs index c396d9a38892..a8a7dc1a3ef4 100644 --- a/crates/swc_ecma_transforms_compat/tests/es2015_parameters.rs +++ b/crates/swc_ecma_transforms_compat/tests/es2015_parameters.rs @@ -102,7 +102,7 @@ test!( default_before_last, r#"function foo({x,y} = "foo", b) {}"#, r#"function foo() { - var ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "foo", x = ref.x, y = ref.y, b = arguments.length > 1 ? arguments[1] : void 0; + var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "foo", x = _ref.x, y = _ref.y, b = arguments.length > 1 ? arguments[1] : void 0; }"# ); @@ -300,10 +300,10 @@ test!( a5, {a6, a7} = {}) {}"#, "function fn(a1) { - var a2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 4, ref = \ - arguments.length > 2 ? arguments[2] : void 0, a3 = ref.a3, a4 = ref.a4, a5 = \ - arguments.length > 3 ? arguments[3] : void 0, ref1 = arguments.length > 4 && arguments[4] \ - !== void 0 ? arguments[4] : {}, a6 = ref1.a6, a7 = ref1.a7; + var a2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 4, _ref = \ + arguments.length > 2 ? arguments[2] : void 0, a3 = _ref.a3, a4 = _ref.a4, a5 = \ + arguments.length > 3 ? arguments[3] : void 0, _ref1 = arguments.length > 4 && arguments[4] \ + !== void 0 ? arguments[4] : {}, a6 = _ref1.a6, a7 = _ref1.a7; } " ); @@ -421,14 +421,14 @@ set arr([x, y] = []) { };"#, "var obj = { set obj (param){ - var ref = param === void 0 ? {} : param, a = ref.a, b = ref.b; + var _ref = param === void 0 ? {} : param, a = _ref.a, b = _ref.b; this.num = { a, b }; }, set arr (param){ - var ref1 = _slicedToArray(param === void 0 ? [] : param, 2), x = ref1[0], y = ref1[1]; + var _ref1 = _slicedToArray(param === void 0 ? [] : param, 2), x = _ref1[0], y = _ref1[1]; this.num = { x, y @@ -476,7 +476,7 @@ function t(x = "default", { a, b }, ...args) { }"#, r#"// #3861 function t() { - var x = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "default", ref = arguments.length > 1 ? arguments[1] : void 0, a = ref.a, b = ref.b; + var x = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "default", _ref = arguments.length > 1 ? arguments[1] : void 0, a = _ref.a, b = _ref.b; for(var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++){ args[_key - 2] = arguments[_key]; } @@ -1305,7 +1305,7 @@ test!( for(var _len = arguments.length, _tmp = new Array(_len), _key = 0; _key < _len; _key++){ _tmp[_key] = arguments[_key]; } - var __tmp = _slicedToArray(_tmp, 1), a = __tmp[0]; + var _tmp1 = _slicedToArray(_tmp, 1), a = _tmp1[0]; }"# ); @@ -2035,8 +2035,8 @@ test!( fn_len_complex_assign, "function test({a: b} = {}) {}", "function test(param) { - var ref = param === void 0 ? {} : param, - b = ref.a; + var _ref = param === void 0 ? {} : param, + b = _ref.a; }" ); @@ -2048,8 +2048,8 @@ test!( fn_len_default_array_destructuring, "function t([,,a] = [1,2,3]) { return a }", "function t(param) { - var ref = _slicedToArray(param === void 0 ? [1, 2, 3] : param, 3), - a = ref[2]; + var _ref = _slicedToArray(param === void 0 ? [1, 2, 3] : param, 3), + a = _ref[2]; return a; }" @@ -2205,9 +2205,9 @@ test!( var a3 = param.a3, a4 = param.a4; - var ref = param1 === void 0 ? {} : param1, - a6 = ref.a6, - a7 = ref.a7; + var _ref = param1 === void 0 ? {} : param1, + a6 = _ref.a6, + a7 = _ref.a7; } "# ); diff --git a/crates/swc_ecma_transforms_compat/tests/es2015_spread.rs b/crates/swc_ecma_transforms_compat/tests/es2015_spread.rs index e0d1366429ec..c780d9861166 100644 --- a/crates/swc_ecma_transforms_compat/tests/es2015_spread.rs +++ b/crates/swc_ecma_transforms_compat/tests/es2015_spread.rs @@ -250,8 +250,8 @@ var obj = { switch (true) { case true: - var _obj; - (_obj = obj.obj).fn.apply(_obj, _toConsumableArray(args)); + var _obj_obj; + (_obj_obj = obj.obj).fn.apply(_obj_obj, _toConsumableArray(args)); break; } @@ -285,11 +285,11 @@ foob.test.add(foo, bar, ...numbers); "#, r#" -var _foob, _test; +var _foob, _foob_test; (_foob = foob).add.apply(_foob, [foo, bar].concat(_toConsumableArray(numbers))); -(_test = foob.test).add.apply(_test, [foo, bar].concat(_toConsumableArray(numbers))); +(_foob_test = foob.test).add.apply(_foob_test, [foo, bar].concat(_toConsumableArray(numbers))); "# ); @@ -592,9 +592,9 @@ foob.test.add(foo, bar, ...numbers); "#, r#" -var _foob, _test; +var _foob, _foob_test; (_foob = foob).add.apply(_foob, [foo, bar].concat(_toConsumableArray(numbers))); -(_test = foob.test).add.apply(_test, [foo, bar].concat(_toConsumableArray(numbers))) +(_foob_test = foob.test).add.apply(_foob_test, [foo, bar].concat(_toConsumableArray(numbers))) "# ); @@ -728,9 +728,9 @@ foob.test.add(...numbers); "#, r#" -var _foob, _test; +var _foob, _foob_test; (_foob = foob).add.apply(_foob, _toConsumableArray(numbers)); -(_test = foob.test).add.apply(_test, _toConsumableArray(numbers)); +(_foob_test = foob.test).add.apply(_foob_test, _toConsumableArray(numbers)); "# ); diff --git a/crates/swc_ecma_transforms_compat/tests/es2017_async_to_generator.rs b/crates/swc_ecma_transforms_compat/tests/es2017_async_to_generator.rs index c7cffaa43331..f814deb42eac 100644 --- a/crates/swc_ecma_transforms_compat/tests/es2017_async_to_generator.rs +++ b/crates/swc_ecma_transforms_compat/tests/es2017_async_to_generator.rs @@ -142,7 +142,7 @@ function foo(param) { } function _foo() { _foo = _asyncToGenerator(function*(param) { - let a = param.a, _b = param.b, b = _b === void 0 ? mandatory("b") : _b; + let a = param.a, _param_b = param.b, b = _param_b === void 0 ? mandatory("b") : _param_b; return Promise.resolve(b); }); return _foo.apply(this, arguments); @@ -1485,8 +1485,8 @@ function foo(_) { function _foo() { _foo = _asyncToGenerator(function* (param) { let a = param.a, - _b = param.b, - b = _b === void 0 ? mandatory("b") : _b; + _param_b = param.b, + b = _param_b === void 0 ? mandatory("b") : _param_b; return Promise.resolve(b); }); return _foo.apply(this, arguments); diff --git a/crates/swc_ecma_transforms_compat/tests/es2018_object_rest_spread.rs b/crates/swc_ecma_transforms_compat/tests/es2018_object_rest_spread.rs index 3c66de619eec..55324ca2ae4a 100644 --- a/crates/swc_ecma_transforms_compat/tests/es2018_object_rest_spread.rs +++ b/crates/swc_ecma_transforms_compat/tests/es2018_object_rest_spread.rs @@ -282,18 +282,18 @@ for (var _ref of []) { } for (var _ref1 of []) { - var __ref; - __ref = _ref1, b = _objectWithoutProperties(__ref, [ + var _ref2; + _ref2 = _ref1, b = _objectWithoutProperties(_ref2, [ "a" - ]), ({ a } = __ref), __ref; + ]), ({ a } = _ref2), _ref2; } async function a() { for await (var _ref of []) { - var __ref; - __ref = _ref, b = _objectWithoutProperties(__ref, [ + var _ref1; + _ref1 = _ref, b = _objectWithoutProperties(_ref1, [ "a" - ]), ({ a } = __ref), __ref; + ]), ({ a } = _ref1), _ref1; } } // skip @@ -498,15 +498,15 @@ const { r#" var _tmp; const _ref = { -}, key = (_param)=>{ +}, _key = (_param)=>{ var rest = _extends({ }, _param); let b = _extends({ }, { }); -}, key1 = (_tmp = { +}, _key1 = (_tmp = { }, d = _extends({ -}, _tmp), _tmp), { [key]: a , [key1]: c } = _ref; +}, _tmp), _tmp), { [_key]: a , [_key1]: c } = _ref; "# ); @@ -1660,16 +1660,15 @@ const s = _extends({}, r), t = foo(s); // ordering is preserved var l = foo(), - _ref = bar(), + _bar = bar(), { m: { n } -} = _ref, - o = _objectWithoutProperties(_ref.m, ["n"]), - p = _objectWithoutProperties(_ref, ["m"]), +} = _bar, + o = _objectWithoutProperties(_bar.m, ["n"]), + p = _objectWithoutProperties(_bar, ["m"]), q = baz(); - "# ); @@ -2736,14 +2735,12 @@ const { a } = foo(({ b, ...c }) => { "#, r#" -const _ref = foo(), { s } = _ref, t = _objectWithoutProperties(_ref, ["s"]); -const _ref1 = bar(), { s: { q1 } } = _ref1, q2 = _objectWithoutProperties(_ref1.s, ["q1"]), q3 = _objectWithoutProperties(_ref1, ["s"]); -const _ref2 = foo((_param)=>{ +const _foo = foo(), { s } = _foo, t = _objectWithoutProperties(_foo, ["s"]); +const _bar = bar(), { s: { q1 } } = _bar, q2 = _objectWithoutProperties(_bar.s, ["q1"]), q3 = _objectWithoutProperties(_bar, ["s"]); +const _foo1 = foo((_param)=>{ var { b } = _param, c = _objectWithoutProperties(_param, ["b"]); console.log(b, c); -}), { a } = _ref2; - - +}), { a } = _foo1; "# ); @@ -3048,8 +3045,8 @@ test!( var src = {}; var counter = 0; for (var _ref of [{ x: 1, y: 2 }]) { - var __ref; - __ref = _ref, src.y = _extends({}, __ref), __ref; + var _ref1; + _ref1 = _ref, src.y = _extends({}, _ref1), _ref1; expect(src.y.x).toEqual(1); expect(src.y.y).toEqual(2); diff --git a/crates/swc_ecma_transforms_compat/src/es2020/nullish_coalescing/tests.rs b/crates/swc_ecma_transforms_compat/tests/es2020_nullish_coalescing.rs similarity index 77% rename from crates/swc_ecma_transforms_compat/src/es2020/nullish_coalescing/tests.rs rename to crates/swc_ecma_transforms_compat/tests/es2020_nullish_coalescing.rs index 13a3c615c3f6..ea46fd43b757 100644 --- a/crates/swc_ecma_transforms_compat/src/es2020/nullish_coalescing/tests.rs +++ b/crates/swc_ecma_transforms_compat/tests/es2020_nullish_coalescing.rs @@ -1,7 +1,7 @@ use swc_ecma_parser::{EsConfig, Syntax}; +use swc_ecma_transforms_compat::es2020::nullish_coalescing::{nullish_coalescing, Config}; use swc_ecma_transforms_testing::{test, test_exec}; - -use super::*; +use swc_ecma_visit::Fold; fn tr(c: Config) -> impl Fold { nullish_coalescing(c) @@ -48,9 +48,8 @@ test!( function foo(foo, qux = foo.bar ?? "qux") {} "#, r#" -var _bar; -function foo(foo, qux = (_bar = foo.bar) !== null && _bar !== void 0 ? _bar : "qux") { -} +var _foo_bar; +function foo(foo, qux = (_foo_bar = foo.bar) !== null && _foo_bar !== void 0 ? _foo_bar : "qux") {} "# ); @@ -66,9 +65,9 @@ function foo(opts) { "#, r#" function foo(opts) { - var _foo; + var _opts_foo; - var foo = (_foo = opts.foo) !== null && _foo !== void 0 ? _foo : "default"; + var foo = (_opts_foo = opts.foo) !== null && _opts_foo !== void 0 ? _opts_foo : "default"; } "# ); @@ -100,8 +99,8 @@ function foo() { "#, r#" function foo() { - var ref; - var foo = (ref = this) !== null && ref !== void 0 ? ref : { + var _this; + var foo = (_this = this) !== null && _this !== void 0 ? _this : { }; } @@ -131,8 +130,8 @@ test!( " const a = { }; - var _b; - _b = (_b = a.b) !== null && _b !== void 0 ? _b : a.b = '1'; + var _a_b; + _a_b = (_a_b = a.b) !== null && _a_b !== void 0 ? _a_b : a.b = '1'; " ); @@ -160,9 +159,9 @@ function foo(opts) { "#, r#" function foo(opts) { - var _foo; + var _opts_foo; - var foo = (_foo = opts.foo) != null ? _foo : "default"; + var foo = (_opts_foo = opts.foo) != null ? _opts_foo : "default"; } "# ); @@ -173,7 +172,7 @@ test!( issue_6328, "switch ( 0 ) { case 0 ?? 0 : }", r#" - var ref; - switch ( 0 ) { case (ref = 0) !== null && ref !== void 0 ? ref : 0: } + var _ref; + switch ( 0 ) { case (_ref = 0) !== null && _ref !== void 0 ? _ref : 0: } "# ); diff --git a/crates/swc_ecma_transforms_compat/tests/es2020_optional_chaining.rs b/crates/swc_ecma_transforms_compat/tests/es2020_optional_chaining.rs index c85470925e5b..cf4f48943b93 100644 --- a/crates/swc_ecma_transforms_compat/tests/es2020_optional_chaining.rs +++ b/crates/swc_ecma_transforms_compat/tests/es2020_optional_chaining.rs @@ -60,23 +60,22 @@ function test(foo) { "use strict"; function test(foo) { - var ref, ref1, ref2, ref3, _obj, ref4, _obj1, ref5, ref6, ref7, ref8, ref9; - + var _foo_bar, _foo_get, _foo_bar1, _foo_bar2, _foo_bar3, _foo_bar_baz, _foo_bar4, _foo_bar_baz1, _foo_bar5, _foo_bar6, _foo_bar7, _foo_bar8; foo == null ? void 0 : foo.bar; - foo == null ? void 0 : (ref = foo.bar) == null ? void 0 : ref.baz; + foo == null ? void 0 : (_foo_bar = foo.bar) == null ? void 0 : _foo_bar.baz; foo == null ? void 0 : foo(foo); foo == null ? void 0 : foo.bar(); - (ref1 = foo.get(bar)) == null ? void 0 : ref1(); - (ref2 = foo.bar()) == null ? void 0 : ref2(); - (ref3 = foo[bar]()) == null ? void 0 : ref3(); - (ref4 = (_obj = foo.bar()).baz) == null ? void 0 : ref4.call(_obj); - (ref5 = (_obj1 = foo[bar]()).baz) == null ? void 0 : ref5.call(_obj1); + (_foo_get = foo.get(bar)) == null ? void 0 : _foo_get(); + (_foo_bar1 = foo.bar()) == null ? void 0 : _foo_bar1(); + (_foo_bar2 = foo[bar]()) == null ? void 0 : _foo_bar2(); + (_foo_bar_baz = (_foo_bar3 = foo.bar()).baz) == null ? void 0 : _foo_bar_baz.call(_foo_bar3); + (_foo_bar_baz1 = (_foo_bar4 = foo[bar]()).baz) == null ? void 0 : _foo_bar_baz1.call(_foo_bar4); foo.bar == null ? void 0 : foo.bar(foo.bar, false); foo == null ? void 0 : foo.bar == null ? void 0 : foo.bar(foo.bar, true); - (ref6 = foo.bar) == null ? void 0 : ref6.baz(foo.bar, false); - foo == null ? void 0 : (ref7 = foo.bar) == null ? void 0 : ref7.baz(foo.bar, true); - (ref8 = foo.bar) == null ? void 0 : ref8.baz == null ? void 0 : ref8.baz(foo.bar, false); - foo == null ? void 0 : (ref9 = foo.bar) == null ? void 0 : ref9.baz == null ? void 0 : ref9.baz(foo.bar, true); + (_foo_bar5 = foo.bar) == null ? void 0 : _foo_bar5.baz(foo.bar, false); + foo == null ? void 0 : (_foo_bar6 = foo.bar) == null ? void 0 : _foo_bar6.baz(foo.bar, true); + (_foo_bar7 = foo.bar) == null ? void 0 : _foo_bar7.baz == null ? void 0 : _foo_bar7.baz(foo.bar, false); + foo == null ? void 0 : (_foo_bar8 = foo.bar) == null ? void 0 : _foo_bar8.baz == null ? void 0 : _foo_bar8.baz(foo.bar, true); } "# ); @@ -119,10 +118,10 @@ eval?.("console.log()"); window.eval?.("console.log()"); "#, r#" -var ref; +var _window_eval; eval === null || eval === void 0 ? void 0 : (0, eval)(); eval === null || eval === void 0 ? void 0 : (0, eval)("console.log()"); -(ref = window.eval) === null || ref === void 0 ? void 0 : ref.call(window, "console.log()"); +(_window_eval = window.eval) === null || _window_eval === void 0 ? void 0 : _window_eval.call(window, "console.log()"); "# ); @@ -284,23 +283,21 @@ val = obj?.a?.b; r#" "use strict"; -var ref, ref1, ref2; - +var _obj_a, _obj_b, _obj_a1; const obj = { - a: { - b: { - c: { - d: 2 - } + a: { + b: { + c: { + d: 2 + } + } } - } }; const a = obj === null || obj === void 0 ? void 0 : obj.a; -const b = obj === null || obj === void 0 ? void 0 : (ref = obj.a) === null || ref === void 0 ? void 0 : ref.b; -const bad = obj === null || obj === void 0 ? void 0 : (ref1 = obj.b) === null || ref1 === void 0 ? void 0 : ref1.b; +const b = obj === null || obj === void 0 ? void 0 : (_obj_a = obj.a) === null || _obj_a === void 0 ? void 0 : _obj_a.b; +const bad = obj === null || obj === void 0 ? void 0 : (_obj_b = obj.b) === null || _obj_b === void 0 ? void 0 : _obj_b.b; let val; -val = obj === null || obj === void 0 ? void 0 : (ref2 = obj.a) === null || ref2 === void 0 ? void 0 : ref2.b; - +val = obj === null || obj === void 0 ? void 0 : (_obj_a1 = obj.a) === null || _obj_a1 === void 0 ? void 0 : _obj_a1.b; "# ); @@ -335,17 +332,17 @@ function test(foo) { "#, r#" function test(foo) { - var ref, ref1, ref2, ref3, ref4, ref5, ref6, ref7, ref8; + var _foo_bar, _foo_bar1, _foo_bar2, _foo_bar3, _foo_bar4, _foo_bar5, _foo_bar_baz, _foo_bar6, _foo_bar_baz1; foo === null || foo === void 0 ? void 0 : foo.bar; - foo === null || foo === void 0 ? void 0 : (ref = foo.bar) === null || ref === void 0 ? void 0 : ref.baz; + foo === null || foo === void 0 ? void 0 : (_foo_bar = foo.bar) === null || _foo_bar === void 0 ? void 0 : _foo_bar.baz; foo === null || foo === void 0 ? void 0 : foo(foo); foo === null || foo === void 0 ? void 0 : foo.bar(); - (ref1 = foo.bar) === null || ref1 === void 0 ? void 0 : ref1.call(foo, foo.bar, false); - foo === null || foo === void 0 ? void 0 : (ref2 = foo.bar) === null || ref2 === void 0 ? void 0 : ref2.call(foo, foo.bar, true); - (ref3 = foo.bar) === null || ref3 === void 0 ? void 0 : ref3.baz(foo.bar, false); - foo === null || foo === void 0 ? void 0 : (ref4 = foo.bar) === null || ref4 === void 0 ? void 0 : ref4.baz(foo.bar, true); - (ref5 = foo.bar) === null || ref5 === void 0 ? void 0 : (ref6 = ref5.baz) === null || ref6 === void 0 ? void 0 : ref6.call(ref5, foo.bar, false); - foo === null || foo === void 0 ? void 0 : (ref7 = foo.bar) === null || ref7 === void 0 ? void 0 : (ref8 = ref7.baz) === null || ref8 === void 0 ? void 0 : ref8.call(ref7, foo.bar, true); + (_foo_bar1 = foo.bar) === null || _foo_bar1 === void 0 ? void 0 : _foo_bar1.call(foo, foo.bar, false); + foo === null || foo === void 0 ? void 0 : (_foo_bar2 = foo.bar) === null || _foo_bar2 === void 0 ? void 0 : _foo_bar2.call(foo, foo.bar, true); + (_foo_bar3 = foo.bar) === null || _foo_bar3 === void 0 ? void 0 : _foo_bar3.baz(foo.bar, false); + foo === null || foo === void 0 ? void 0 : (_foo_bar4 = foo.bar) === null || _foo_bar4 === void 0 ? void 0 : _foo_bar4.baz(foo.bar, true); + (_foo_bar5 = foo.bar) === null || _foo_bar5 === void 0 ? void 0 : (_foo_bar_baz = _foo_bar5.baz) === null || _foo_bar_baz === void 0 ? void 0 : _foo_bar_baz.call(_foo_bar5, foo.bar, false); + foo === null || foo === void 0 ? void 0 : (_foo_bar6 = foo.bar) === null || _foo_bar6 === void 0 ? void 0 : (_foo_bar_baz1 = _foo_bar6.baz) === null || _foo_bar_baz1 === void 0 ? void 0 : _foo_bar_baz1.call(_foo_bar6, foo.bar, true); } "# ); @@ -362,16 +359,13 @@ street = user.address?.street test(a?.b, 1); (a?.b, 2); - "#, r#" -var ref, ref1; - -var street = (ref = user.address) === null || ref === void 0 ? void 0 : ref.street; -street = (ref1 = user.address) === null || ref1 === void 0 ? void 0 : ref1.street; +var _user_address, _user_address1; +var street = (_user_address = user.address) === null || _user_address === void 0 ? void 0 : _user_address.street; +street = (_user_address1 = user.address) === null || _user_address1 === void 0 ? void 0 : _user_address1.street; test(a === null || a === void 0 ? void 0 : a.b, 1); a === null || a === void 0 ? void 0 : a.b, 2; - "# ); @@ -439,17 +433,17 @@ orders[client.key]?.price; "#, r#" -var ref, ref1, ref2, ref3, ref4, ref5, ref6, ref7; +var _ref, _a_b, _ref1, _a_b_c, _a_b_c_d, _orders_, _orders_client_key, _c; foo === null || foo === void 0 ? void 0 : foo.bar; -(ref = a === null || a === void 0 ? void 0 : a.b.c) === null || ref === void 0 ? void 0 : ref.d.e; -(ref2 = (ref1 = a.b) === null || ref1 === void 0 ? void 0 : ref1.c.d) === null || ref2 === void 0 ? void 0 : ref2.e; -(ref3 = a.b.c) === null || ref3 === void 0 ? void 0 : (ref4 = ref3.d) === null || ref4 === void 0 ? void 0 : ref4.e; +(_ref = a === null || a === void 0 ? void 0 : a.b.c) === null || _ref === void 0 ? void 0 : _ref.d.e; +(_ref1 = (_a_b = a.b) === null || _a_b === void 0 ? void 0 : _a_b.c.d) === null || _ref1 === void 0 ? void 0 : _ref1.e; +(_a_b_c = a.b.c) === null || _a_b_c === void 0 ? void 0 : (_a_b_c_d = _a_b_c.d) === null || _a_b_c_d === void 0 ? void 0 : _a_b_c_d.e; orders === null || orders === void 0 ? void 0 : orders[0].price; -orders === null || orders === void 0 ? void 0 : (ref5 = orders[0]) === null || ref5 === void 0 ? void 0 : ref5.price; +orders === null || orders === void 0 ? void 0 : (_orders_ = orders[0]) === null || _orders_ === void 0 ? void 0 : _orders_.price; orders[client === null || client === void 0 ? void 0 : client.key].price; -(ref6 = orders[client.key]) === null || ref6 === void 0 ? void 0 : ref6.price; +(_orders_client_key = orders[client.key]) === null || _orders_client_key === void 0 ? void 0 : _orders_client_key.price; (0, a === null || a === void 0 ? void 0 : a.b).c; -(0, (ref7 = (0, a === null || a === void 0 ? void 0 : a.b).c) === null || ref7 === void 0 ? void 0 : ref7.d).e; +(0, (_c = (0, a === null || a === void 0 ? void 0 : a.b).c) === null || _c === void 0 ? void 0 : _c.d).e; "# ); @@ -479,18 +473,16 @@ test = +obj?.b?.b; r#" "use strict"; -var ref, ref1, ref2; - +var _obj_a, _obj_b, _obj_b1; const obj = { - a: { - b: 0 - } + a: { + b: 0 + } }; -let test = +(obj === null || obj === void 0 ? void 0 : (ref = obj.a) === null || ref === void 0 ? void 0 : ref.b); +let test = +(obj === null || obj === void 0 ? void 0 : (_obj_a = obj.a) === null || _obj_a === void 0 ? void 0 : _obj_a.b); test = +(obj === null || obj === void 0 ? void 0 : obj.a.b); -test = +(obj === null || obj === void 0 ? void 0 : (ref1 = obj.b) === null || ref1 === void 0 ? void 0 : ref1.b); -test = +(obj === null || obj === void 0 ? void 0 : (ref2 = obj.b) === null || ref2 === void 0 ? void 0 : ref2.b); - +test = +(obj === null || obj === void 0 ? void 0 : (_obj_b = obj.b) === null || _obj_b === void 0 ? void 0 : _obj_b.b); +test = +(obj === null || obj === void 0 ? void 0 : (_obj_b1 = obj.b) === null || _obj_b1 === void 0 ? void 0 : _obj_b1.b); "# ); @@ -526,18 +518,19 @@ foo?.bar()?.() "#, r#" -var ref, ref1, ref2, ref3, ref4, ref5, ref6, ref7, ref8, ref9; +var _foo_bar, _foo_bar1, _foo, _foo_bar2, _foo_bar3, _foo_bar_call, _foo_bar4, _foo_bar5, _foo_bar_call1, _ref; foo === null || foo === void 0 ? void 0 : foo(foo); foo === null || foo === void 0 ? void 0 : foo.bar(); -(ref = foo.bar) === null || ref === void 0 ? void 0 : ref.call(foo, foo.bar, false); -foo === null || foo === void 0 ? void 0 : (ref1 = foo.bar) === null || ref1 === void 0 ? void 0 : ref1.call(foo, foo.bar, true); +(_foo_bar = foo.bar) === null || _foo_bar === void 0 ? void 0 : _foo_bar.call(foo, foo.bar, false); +foo === null || foo === void 0 ? void 0 : (_foo_bar1 = foo.bar) === null || _foo_bar1 === void 0 ? void 0 : _foo_bar1.call(foo, foo.bar, true); foo === null || foo === void 0 ? void 0 : foo().bar; -foo === null || foo === void 0 ? void 0 : (ref2 = foo()) === null || ref2 === void 0 ? void 0 : ref2.bar; -(ref3 = foo.bar) === null || ref3 === void 0 ? void 0 : ref3.call(foo).baz; -(ref4 = foo.bar) === null || ref4 === void 0 ? void 0 : (ref5 = ref4.call(foo)) === null || ref5 === void 0 ? void 0 : ref5.baz; -foo === null || foo === void 0 ? void 0 : (ref6 = foo.bar) === null || ref6 === void 0 ? void 0 : ref6.call(foo).baz; -foo === null || foo === void 0 ? void 0 : (ref7 = foo.bar) === null || ref7 === void 0 ? void 0 : (ref8 = ref7.call(foo)) === null || ref8 === void 0 ? void 0 : ref8.baz; -(ref9 = foo === null || foo === void 0 ? void 0 : foo.bar()) === null || ref9 === void 0 ? void 0 : ref9();"# +foo === null || foo === void 0 ? void 0 : (_foo = foo()) === null || _foo === void 0 ? void 0 : _foo.bar; +(_foo_bar2 = foo.bar) === null || _foo_bar2 === void 0 ? void 0 : _foo_bar2.call(foo).baz; +(_foo_bar3 = foo.bar) === null || _foo_bar3 === void 0 ? void 0 : (_foo_bar_call = _foo_bar3.call(foo)) === null || _foo_bar_call === void 0 ? void 0 : _foo_bar_call.baz; +foo === null || foo === void 0 ? void 0 : (_foo_bar4 = foo.bar) === null || _foo_bar4 === void 0 ? void 0 : _foo_bar4.call(foo).baz; +foo === null || foo === void 0 ? void 0 : (_foo_bar5 = foo.bar) === null || _foo_bar5 === void 0 ? void 0 : (_foo_bar_call1 = _foo_bar5.call(foo)) === null || _foo_bar_call1 === void 0 ? void 0 : _foo_bar_call1.baz; +(_ref = foo === null || foo === void 0 ? void 0 : foo.bar()) === null || _ref === void 0 ? void 0 : _ref(); +"# ); // general_unary_exec @@ -605,18 +598,16 @@ delete obj?.a; r#" "use strict"; -var ref, ref1; - +var _obj_a, _obj_b; const obj = { - a: { - b: 0 - } + a: { + b: 0 + } }; -let test = obj === null || obj === void 0 ? void 0 : (ref = obj.a) === null || ref === void 0 ? void 0 : delete ref.b; +let test = obj === null || obj === void 0 ? void 0 : (_obj_a = obj.a) === null || _obj_a === void 0 ? void 0 : delete _obj_a.b; test = obj === null || obj === void 0 ? void 0 : delete obj.a.b; -test = obj === null || obj === void 0 ? void 0 : (ref1 = obj.b) === null || ref1 === void 0 ? void 0 : delete ref1.b; +test = obj === null || obj === void 0 ? void 0 : (_obj_b = obj.b) === null || _obj_b === void 0 ? void 0 : delete _obj_b.b; obj === null || obj === void 0 ? void 0 : delete obj.a; - "# ); @@ -699,16 +690,13 @@ class Base { method() { return 'Hello!'; } - } class Derived extends Base { method() { - var ref; - - return (ref = super.method) === null || ref === void 0 ? void 0 : ref.call(this); + var _super_method; + return (_super_method = super.method) === null || _super_method === void 0 ? void 0 : _super_method.call(this); } - } "# @@ -727,9 +715,9 @@ test!( |_| tr(Default::default()), simple_2, "obj?.a?.b", - "var ref; -obj === null || obj === void 0 ? void 0 : (ref = obj.a) === null || ref === void 0 ? void 0 : \ - ref.b;" + "var _obj_a; + obj === null || obj === void 0 ? void 0 : (_obj_a = obj.a) === null || _obj_a === void 0 ? \ + void 0 : _obj_a.b;" ); test!( @@ -737,9 +725,9 @@ test!( |_| tr(Default::default()), simple_3, "obj?.a?.b.c", - "var ref; -obj === null || obj === void 0 ? void 0 : (ref = obj.a) === null || ref === void 0 ? void 0 : \ - ref.b.c;" + "var _obj_a; + obj === null || obj === void 0 ? void 0 : (_obj_a = obj.a) === null || _obj_a === void 0 ? \ + void 0 : _obj_a.b.c;" ); test!( @@ -747,9 +735,9 @@ test!( |_| tr(Default::default()), call_1, "obj?.a?.b()", - "var ref; -obj === null || obj === void 0 ? void 0 : (ref = obj.a) === null || ref === void 0 ? void 0 : \ - ref.b();", + "var _obj_a; + obj === null || obj === void 0 ? void 0 : (_obj_a = obj.a) === null || _obj_a === void 0 ? \ + void 0 : _obj_a.b();", ok_if_code_eq ); @@ -758,15 +746,10 @@ test!( |_| tr(Default::default()), call_2, "a?.b?.c?.()", - "var ref, ref1; - -a === null || a === void 0 - ? void 0 - : (ref = a.b) === null || ref === void 0 - ? void 0 - : (ref1 = ref.c) === null || ref1 === void 0 - ? void 0 - : ref1.call(ref);" + "var _a_b, _a_b_c; + + a === null || a === void 0 ? void 0 : (_a_b = a.b) === null || _a_b === void 0 ? void 0 : \ + (_a_b_c = _a_b.c) === null || _a_b_c === void 0 ? void 0 : _a_b_c.call(_a_b);" ); test!( @@ -774,8 +757,8 @@ test!( |_| tr(Default::default()), issue_732_1, "test.a?.b.c.d", - "var ref; -(ref = test.a) === null || ref === void 0 ? void 0 : ref.b.c.d" + "var _test_a; + (_test_a = test.a) === null || _test_a === void 0 ? void 0 : _test_a.b.c.d;" ); test!( @@ -783,8 +766,8 @@ test!( |_| tr(Default::default()), issue_732_2, "test.a?.b.c", - "var ref; -(ref = test.a) === null || ref === void 0 ? void 0 : ref.b.c;" + "var _test_a; + (_test_a = test.a) === null || _test_a === void 0 ? void 0 : _test_a.b.c;" ); test!( @@ -792,8 +775,8 @@ test!( |_| tr(Default::default()), issue_732_3, "test.a?.b.c.d.e.f.g.h.i", - "var ref; -(ref = test.a) === null || ref === void 0 ? void 0 : ref.b.c.d.e.f.g.h.i" + "var _test_a; + (_test_a = test.a) === null || _test_a === void 0 ? void 0 : _test_a.b.c.d.e.f.g.h.i;" ); // https://github.com/Brooooooklyn/swc-node/issues/62 @@ -802,8 +785,8 @@ test!( |_| tr(Default::default()), swc_node_issue_62, "a.focus?.()", - "var ref; - (ref = a.focus) === null || ref === void 0 ? void 0 : ref.call(a);" + "var _a_focus; + (_a_focus = a.focus) === null || _a_focus === void 0 ? void 0 : _a_focus.call(a);" ); test!( @@ -851,9 +834,10 @@ test!( obj?.a?.b?.c() ", " - var ref, ref1; -obj === null || obj === void 0 ? void 0 : (ref = obj.a) === null || ref === void 0 ? void 0 : \ - (ref1 = ref.b) === null || ref1 === void 0 ? void 0 : ref1.c();" +var _obj_a, _obj_a_b; +obj === null || obj === void 0 ? void 0 : (_obj_a = obj.a) === null || _obj_a === void 0 ? void 0 \ + : (_obj_a_b = _obj_a.b) === null || _obj_a_b === void 0 ? void 0 : _obj_a_b.c(); +" ); test!( @@ -864,9 +848,10 @@ test!( expect(obj?.a?.b?.c()).toBe(2) ", " - var ref, ref1; -expect(obj === null || obj === void 0 ? void 0 : (ref = obj.a) === null || ref === void 0 ? void 0 \ - : (ref1 = ref.b) === null || ref1 === void 0 ? void 0 : ref1.c()).toBe(2); +var _obj_a, _obj_a_b; +expect(obj === null || obj === void 0 ? void 0 : (_obj_a = obj.a) === null || _obj_a === void 0 ? \ + void 0 : (_obj_a_b = _obj_a.b) === null || _obj_a_b === void 0 ? void 0 : \ + _obj_a_b.c()).toBe(2); " ); @@ -923,10 +908,10 @@ test!( const patch = PATCHES.get(ident)?.(); "#, r#" - var ref; + var _PATCHES_get; const PATCHES = new Map(); const ident = 'foo'; - const patch = (ref = PATCHES.get(ident)) === null || ref === void 0 ? void 0 : ref(); + const patch = (_PATCHES_get = PATCHES.get(ident)) === null || _PATCHES_get === void 0 ? void 0 : _PATCHES_get(); "# ); @@ -936,8 +921,8 @@ test!( pr_2791, r#"UNCONFIRMED_CALLBACK_MAP.get(pid)?.(error, response)"#, r#" -var ref; -(ref = UNCONFIRMED_CALLBACK_MAP.get(pid)) === null || ref === void 0 ? void 0 : ref(error, response) +var _UNCONFIRMED_CALLBACK_MAP_get; +(_UNCONFIRMED_CALLBACK_MAP_get = UNCONFIRMED_CALLBACK_MAP.get(pid)) === null || _UNCONFIRMED_CALLBACK_MAP_get === void 0 ? void 0 : _UNCONFIRMED_CALLBACK_MAP_get(error, response); "# ); @@ -954,13 +939,13 @@ test!( ", " function bug() { - const arrowFn = (arg)=>{ - var _object, ref; - return (ref = (_object = this.object)[arg]) === null || ref === void 0 ? void 0 : \ - ref.call(_object); - }; + const arrowFn = (arg)=>{ + var _this_object, _this_object_arg; + return (_this_object_arg = (_this_object = this.object)[arg]) === null || \ + _this_object_arg === void 0 ? void 0 : _this_object_arg.call(_this_object) + }; } - bug(); + bug(); " ); diff --git a/crates/swc_ecma_transforms_compat/tests/es2022_class_properties.rs b/crates/swc_ecma_transforms_compat/tests/es2022_class_properties.rs index bc37f6317c96..b8e944e99388 100644 --- a/crates/swc_ecma_transforms_compat/tests/es2022_class_properties.rs +++ b/crates/swc_ecma_transforms_compat/tests/es2022_class_properties.rs @@ -1037,20 +1037,20 @@ var foo = "foo"; var bar = ()=>{ }; var four = 4; -var _ref = one(), - _ref1 = 2 * 4 + 7, - _ref2 = 2 * four + 7, - _ref3 = 2 * four + seven, +var _one = one(), + _ref = 2 * 4 + 7, + _ref1 = 2 * four + 7, + _ref2 = 2 * four + seven, _undefined = undefined, - _ref4 = void 0, - tmp = computed(), - tmp1 = computed(), - tmp2 = "test" + one, - _ref5 = /regex/, + _ref3 = void 0, + _computed = computed(), + _computed1 = computed(), + _tmp = "test" + one, + _ref4 = /regex/, _foo = foo, _bar = bar, _baz = baz, - _ref6 = `template${expression}`; + _ref5 = `template${expression}`; var MyClass = function() { @@ -1059,13 +1059,13 @@ var MyClass = function() { _classCallCheck(this, MyClass); _defineProperty(this, null, "null"); _defineProperty(this, _undefined, "undefined"); - _defineProperty(this, _ref4, "void 0"); - _defineProperty(this, _ref5, "regex"); + _defineProperty(this, _ref3, "void 0"); + _defineProperty(this, _ref4, "regex"); _defineProperty(this, _foo, "foo"); _defineProperty(this, _bar, "bar"); _defineProperty(this, _baz, "baz"); _defineProperty(this, `template`, "template"); - _defineProperty(this, _ref6, "template-with-expression"); + _defineProperty(this, _ref5, "template-with-expression"); } _createClass(MyClass, [{ key: "whatever", get: function () { @@ -1074,13 +1074,13 @@ var MyClass = function() { key: "whatever", set: function (value) { } }, { - key: tmp, get: function () { + key: _computed, get: function () { } }, { - key: tmp1, set: function (value) { + key: _computed1, set: function (value) { } }, { - key: tmp2, value: function () { + key: _tmp, value: function () { } }], [{ key: 10, value: function () { @@ -1088,11 +1088,10 @@ var MyClass = function() { }]); return MyClass; }(); -_defineProperty(MyClass, _ref, "test"); +_defineProperty(MyClass, _one, "test"); +_defineProperty(MyClass, _ref, "247"); _defineProperty(MyClass, _ref1, "247"); _defineProperty(MyClass, _ref2, "247"); -_defineProperty(MyClass, _ref3, "247"); - "# ); @@ -1452,8 +1451,8 @@ var Outer = function Outer() { value: void 0 }); - var Test = function (_superClass) { - _inherits(Test, _superClass); + var Test = function (_classPrivateFieldGet1) { + _inherits(Test, _classPrivateFieldGet1); var _super = _createSuper(Test); function Test() { _classCallCheck(this, Test); @@ -1899,11 +1898,11 @@ var Outer = function (Hello) { _classCallCheck(this, Outer); var _this = _super.call(this); - var _ref = _get((_assertThisInitialized(_this), _getPrototypeOf(Outer.prototype)), "toString", _this).call(_this); + var _super_toString = _get((_assertThisInitialized(_this), _getPrototypeOf(Outer.prototype)), "toString", _this).call(_this); var Inner = function Inner() { _classCallCheck(this, Inner); - _defineProperty(this, _ref, 'hello'); + _defineProperty(this, _super_toString, 'hello'); }; return _possibleConstructorReturn(_this, new Inner()); @@ -2036,11 +2035,11 @@ function () { _createClass(Foo, [{ key: "test", value: function test(other) { - var _obj; + var _other_obj; _classPrivateFieldSet(this, _foo, _classPrivateFieldGet(this, _foo) + 1); _classPrivateFieldSet(this, _foo, 2); - _classPrivateFieldSet(_obj = other.obj, _foo, _classPrivateFieldGet(_obj, _foo) + 1); + _classPrivateFieldSet(_other_obj = other.obj, _foo, _classPrivateFieldGet(_other_obj, _foo) + 1); _classPrivateFieldSet(other.obj, _foo, 2); } }]); @@ -2350,10 +2349,10 @@ var Foo = function () { _createClass(Foo, [{ key: "test", value: function test(other) { - var _obj; + var _other_obj; _classPrivateFieldGet(this, _foo).call(this); - _classPrivateFieldGet(_obj = other.obj, _foo).call(_obj); + _classPrivateFieldGet(_other_obj = other.obj, _foo).call(_other_obj); } }]); return Foo; @@ -4081,9 +4080,9 @@ new SuperClass(); // ensure ComputedKey Method is still transformed class ComputedMethod extends Obj { constructor() { var _temp; - let tmp = (_temp = super(), _defineProperty(this, "field", 1), _temp); + let _tmp = (_temp = super(), _defineProperty(this, "field", 1), _temp); class B extends Obj { - [tmp]() {} + [_tmp]() {} constructor() { super(); @@ -4767,11 +4766,11 @@ const createClass = (k) => class { [k()] = 2 }; "#, r#" var createClass = (k)=>{ - var _ref = k(); + var _k = k(); var _class = function _class() { "use strict"; _classCallCheck(this, _class); - _defineProperty(this, _ref, 2); + _defineProperty(this, _k, 2); }; return _class; }; @@ -5397,9 +5396,9 @@ export class Node { } } function bar(parent) { - var _baz1; + var _parent_baz; _classPrivateMethodGet(parent, _baz, baz).call(parent, this); - _classPrivateMethodGet(_baz1 = parent.baz, _baz, baz).call(_baz1, this); + _classPrivateMethodGet(_parent_baz = parent.baz, _baz, baz).call(_parent_baz, this); } function baz(child) {} " @@ -6182,30 +6181,31 @@ class MyClass { const foo = "foo"; const bar = ()=>{}; const four = 4; -let _ref = one(), _ref1 = 2 * 4 + 7, _ref2 = 2 * four + 7, _ref3 = 2 * four + seven, _undefined = undefined, _ref4 = void 0, tmp = computed(), tmp1 = computed(), tmp2 = "test" + one, _ref5 = /regex/, _foo = foo, _bar = bar, _baz = baz, _ref6 = `template${expression}`; +let _one = one(), _ref = 2 * 4 + 7, _ref1 = 2 * four + 7, _ref2 = 2 * four + seven, _undefined = undefined, _ref3 = void 0, _computed = computed(), _computed1 = computed(), _tmp = "test" + one, _ref4 = /regex/, _foo = foo, _bar = bar, _baz = baz, _ref5 = `template${expression}`; class MyClass { get ["whatever"]() {} set ["whatever"](value) {} - get [tmp]() {} - set [tmp1](value) {} - [tmp2]() {} + get [_computed]() {} + set [_computed1](value) {} + [_tmp]() {} static [10]() {} constructor(){ this[null] = "null"; this[_undefined] = "undefined"; - this[_ref4] = "void 0"; - this[_ref5] = "regex"; + this[_ref3] = "void 0"; + this[_ref4] = "regex"; this[_foo] = "foo"; this[_bar] = "bar"; this[_baz] = "baz"; this[`template`] = "template"; - this[_ref6] = "template-with-expression"; + this[_ref5] = "template-with-expression"; } } -MyClass[_ref] = "test"; +MyClass[_one] = "test"; +MyClass[_ref] = "247"; MyClass[_ref1] = "247"; MyClass[_ref2] = "247"; -MyClass[_ref3] = "247"; + "# ); diff --git a/crates/swc_ecma_transforms_typescript/tests/strip.rs b/crates/swc_ecma_transforms_typescript/tests/strip.rs index 5078959aea80..6974d86f6045 100644 --- a/crates/swc_ecma_transforms_typescript/tests/strip.rs +++ b/crates/swc_ecma_transforms_typescript/tests/strip.rs @@ -3342,11 +3342,11 @@ test!( r#" const normalizedQuestionSet = { }; - var _submissionIds; - const submissions = ((_submissionIds = normalizedQuestionSet.submissionIds) !== null && _submissionIds !== void 0 ? _submissionIds : []).map((id, index)=>{ + var _normalizedQuestionSet_submissionIds; + const submissions = ((_normalizedQuestionSet_submissionIds = normalizedQuestionSet.submissionIds) !== null && _normalizedQuestionSet_submissionIds !== void 0 ? _normalizedQuestionSet_submissionIds : []).map((id, index)=>{ const submission = normalizedQuestionSet.submissions?.[id]; - var _answers; - const submissionAnswers = ((_answers = submission.answers) !== null && _answers !== void 0 ? _answers : []).map((answerId)=>normalizedQuestionSet.answers?.[answerId] + var _submission_answers; + const submissionAnswers = ((_submission_answers = submission.answers) !== null && _submission_answers !== void 0 ? _submission_answers : []).map((answerId)=>normalizedQuestionSet.answers?.[answerId] ); console.log(id, index); return { @@ -3832,9 +3832,9 @@ to!( } ", " - let _ref = (console.log(1), 'a'), _ref1 = (console.log(2), 'b'), tmp = (console.log(3), 'c'); + let _ref = (console.log(1), 'a'), _ref1 = (console.log(2), 'b'), _tmp = (console.log(3), 'c'); class A { - [tmp]() {} + [_tmp]() {} constructor() { this[_ref] = 1; } @@ -4556,18 +4556,18 @@ let b = class { } ", " -let _key; -let _key1 = console.log(123); +let _console_log; +let _console_log1 = console.log(123); class A { constructor(a = 1){ this.a = a; - this[_key1] = 456; + this[_console_log1] = 456; } } -let b = (_key = console.log(456), class { +let b = (_console_log = console.log(456), class { constructor(a = 1){ this.a = a; - this[_key] = 123; + this[_console_log] = 123; } }); " diff --git a/crates/swc_ecma_utils/src/lib.rs b/crates/swc_ecma_utils/src/lib.rs index 545394b908b7..8261637b0a3b 100644 --- a/crates/swc_ecma_utils/src/lib.rs +++ b/crates/swc_ecma_utils/src/lib.rs @@ -1912,27 +1912,62 @@ impl Visit for LiteralVisitor { /// Used to determine super_class_ident pub fn alias_ident_for(expr: &Expr, default: &str) -> Ident { - fn sym(expr: &Expr, default: &str) -> JsWord { + fn sym(expr: &Expr) -> Option { match expr { + Expr::Lit(Lit::Str(s)) => Some(s.value.to_string()), + Expr::This(_) => Some("this".to_string()), + Expr::Ident(ident) - | Expr::Member(MemberExpr { - prop: MemberProp::Ident(ident), - .. + | Expr::Fn(FnExpr { + ident: Some(ident), .. }) | Expr::Class(ClassExpr { ident: Some(ident), .. - }) => format!("_{}", ident.sym).into(), + }) => Some(ident.sym.to_string()), + + Expr::Call(CallExpr { + callee: Callee::Expr(expr), + .. + }) => sym(expr), + + Expr::SuperProp(SuperPropExpr { + prop: SuperProp::Ident(ident), + .. + }) => Some(format!("super_{}", ident.sym)), + + Expr::SuperProp(SuperPropExpr { + prop: SuperProp::Computed(ComputedPropName { expr, .. }), + .. + }) => Some(format!("super_{}", sym(expr).unwrap_or_default())), + Expr::Member(MemberExpr { - prop: MemberProp::Computed(computed), + prop: MemberProp::Ident(ident), + obj, .. - }) => sym(&computed.expr, default), + }) => Some(format!("{}_{}", sym(obj).unwrap_or_default(), ident.sym)), - _ => default.into(), + Expr::Member(MemberExpr { + prop: MemberProp::Computed(ComputedPropName { expr, .. }), + obj, + .. + }) => Some(format!( + "{}_{}", + sym(obj).unwrap_or_default(), + sym(expr).unwrap_or_default() + )), + + _ => None, } } let span = expr.span().apply_mark(Mark::fresh(Mark::root())); - quote_ident!(span, sym(expr, default)) + + let mut sym = sym(expr).unwrap_or_else(|| default.to_string()); + + if !sym.starts_with('_') { + sym = format!("_{}", sym) + } + quote_ident!(span, sym) } /// Returns `(ident, aliased)` diff --git a/crates/swc_node_bundler/tests/pass/issue-1138/example-1/output/entry.js b/crates/swc_node_bundler/tests/pass/issue-1138/example-1/output/entry.js index 1edb043e85d7..3b1e587c840e 100644 --- a/crates/swc_node_bundler/tests/pass/issue-1138/example-1/output/entry.js +++ b/crates/swc_node_bundler/tests/pass/issue-1138/example-1/output/entry.js @@ -1,4 +1,4 @@ var a = "a"; var o = {}; -var _a = o.a, a1 = _a === void 0 ? a : _a; +var _o_a = o.a, a1 = _o_a === void 0 ? a : _o_a; console.log(a1); diff --git a/crates/swc_node_bundler/tests/pass/issue-1138/example-2/output/entry.js b/crates/swc_node_bundler/tests/pass/issue-1138/example-2/output/entry.js index 5488f7f0317c..8c753e8a8a86 100644 --- a/crates/swc_node_bundler/tests/pass/issue-1138/example-2/output/entry.js +++ b/crates/swc_node_bundler/tests/pass/issue-1138/example-2/output/entry.js @@ -1,4 +1,4 @@ var defaultA = "a"; var o = {}; -var _a = o.a, a = _a === void 0 ? defaultA : _a; +var _o_a = o.a, a = _o_a === void 0 ? defaultA : _o_a; console.log(a);